Affine transforms - matrix algebra
Jim Graham
james.graham at oracle.com
Mon Aug 13 17:03:12 PDT 2012
On 8/13/2012 12:33 PM, Pedro Duque Vieira wrote:
>>> // 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.
>>
>>
>> Yes, it will be stated. I'm just not sure why 'magnitude' is better then
>> 'length'..
>>
> Personally I think it's better because magnitude is mostly applied to
> vectors so one would immediately infer that he's getting the lenght of a
> vector. Lenght would also be fine by me though.
I also suggested magnitude, but I'm also not married to it.
Some other reasons:
- vectors are often defined as having "direction and magnitude" (though
we don't have a "getDirection" method)
- normalization is usually specified as dividing by magnitude
- length is for something with 2 ends, but a point just has one end.
We'd have to define it as having an implicit "other end", like "length
to the origin". Magnitude is less colloquially limited that way, though
by often being associated with the implicit 'to the origin" that we
could just as easily document our way around - but it seems more natural
with the term magnitude. Also, consider that an absolute value of a
number is often called its "magnitude" with its implicit "direction"
(left or right of zero on the number line) discarded.
I'm OK with either term, though...
...jim
More information about the openjfx-dev
mailing list