Affine transforms - matrix algebra
Pedro Duque Vieira
pedro.duquevieira at gmail.com
Mon Aug 13 10:52:51 PDT 2012
>
> Hi Pedro,
> looks like we are condemned to stick to our existing precedents..
pity :(
On 13.8.2012 18:26, Pedro Duque Vieira wrote:
> // Creates a point with distances from origin added (adds two
> vectors)
> public Point3D subtract(Point3D point)
> // Creates a point with the given point's distances from origin
> subtracted
> // (subtracts two vectors)
> public Point3D normalize()
> // Gets a point in the same direction from the origin with
> distance from the origin equal to one
> // (normalizes a vector)
> ? should the above three methods be named getSomething to stress that
> the operation doesn't modify the object?
> Yes, I think it's better to call them getSomething.
> As I wrote in my other email, we already have distance(Point3D), so to be
> consistent we should rather strip the 'get' everywhere..
>
>
> // Gets distance from the origin (lenght of a vector)
>
> I'd prefer getMagnitude(), this way it's obvious your getting the lenght
> of a vector
> I'm not sure, magnitude of a point is similar nonsense to length of a
> point and I guess users would search for the word "length" first. Does
> anyone else have an opinion on this?
You're already doing things that make no sense for a Point3D, like adding
two points, so it's pretty obvious that this is being used to represent
Points and Vectors so this shouldn't be hidden from the user to prevent
further confusion.
I think this should really also be stated on the javadoc of Point3D.
Hi Pavel,
>
>> public Point3D add(Point3D point)
>>
> public double getLength()
>
Your missing:
- getAngle()
// gets the angle of the vector
Angle from what?
A Vector has an angle (or direction) it's normally from the the right side
of the horizontal axis (the vertical axis splits the horizontal axis into
right and left side).
>
> - getType
> // returns whether this represents a vector or a point
> If we wanted to distinguish vector from point, we would introduce Vector3D
> class. But we have the Rotate class that is already used with Point3D
> representing a vector and it has no such flag..
Again, you are using Point as a vector although without separating them
into distinct classes and you should distinguish the two. It makes no sense
to add two points, make the cross product, etc.
Your missing on matrix or affine:
> - transpose()
> // transposes the matrix
> I don't think we can add this because the resulting transform would
> generally not be affine.
Yes your right, it does come in handy for some computer graphics operations
though.
Thanks again,
--
Pedro Duque Vieira
More information about the openjfx-dev
mailing list