Affine transforms - matrix algebra

Richard Bair richard.bair at oracle.com
Mon Aug 13 09:38:00 PDT 2012


In the JavaFX API, we've avoided using get prefix for anything that isn't an actual getter method for a property. I think layout is the only place we've violated this. So I'd more use "length(param)" vs. "getLength(param)" personally.

Richard

On Aug 13, 2012, at 9:26 AM, Pedro Duque Vieira wrote:

> Hi Pavel,
> 
>     public Point3D add(Point3D point)
>>         // 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.
> 
> public double getLength()
>>         // 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
> 
> Your missing:
> - getAngle()
> // gets the angle of the vector
> - getType
> // returns whether this represents a vector or a point
> 
> Your missing on matrix or affine:
> - transpose()
> // transposes the matrix
> 
> Thanks, best regards,
> 
> -- 
> Pedro Duque Vieira



More information about the openjfx-dev mailing list