Thanks, Gilles. "magnitude" sounds good. We'd then have "getMagnitude()" and 
"withMagnitude(double mag)".

-Matt

________________________________
From: Gilles <[email protected]>
Sent: Monday, June 25, 2018 8:27:29 AM
To: [email protected]
Subject: Re: [geometry] Additional Euclidean Point/Vector Methods

On Sun, 24 Jun 2018 19:09:38 +0000, Matt Juntunen wrote:
> Hi all,
>
>
> I'd like to add some additional methods to the Euclidean Point/Vector
> classes. Some are for convenience/readability and some are critical
> pieces of functionality that I believe are missing.
>
>
>
> Vector Methods:
>
>   1.  length() - Return the length of the vector; this is a more
> intuitive and easier to read alias for getNorm().

"length" has a different usage in Java.
"magnitude" would more readily convey the intended meaning.
But "norm" is shorter, and as clear IMHO.

I've no issue with the other proposals.

Best,
Gilles

>   2.  withLength(double len) - Return a new vector with the same
> direction as the current one but with the given length. This is
> equivalent  to "vec.normalize().scalarMultiply(len);" but without the
> intermediate vector.
>   3.  project(Vector?D v) - Return a new vector representing the
> result of projecting the current vector onto the given vector.
>   4.  reject(Vector?D v) - Return a new vector with all components in
> the direction of v "rejected". This can also be pictured as returning
> a new vector representing the result of projecting the current vector
> onto the plane with the given normal. This operation is the
> complement
> of the project() function since "vec.project(n).add(vec.reject(n))"
> equals the original vector.
>   5.  lerp(double t, Vector?D v) - Perform a linear interpolation
> between the current vector and the given vector. If t == 0, a vector
> equal to the current vector is returned. If t == 1, a vector equal to
> the given vector is returned. All other values are interpolated
> linearly. For example, t == 0.5 would give the halfway point between
> the two vectors. There should also be a static version of this
> method.
>
>
>
> Point Methods:
>
>   1.  lerp(double t, Point?D p) - Same as the vector lerp() method
> but for points. There should also be a static version available.
>
>
>
> Thoughts? Comments? I've opened up a JIRA issue for this as well:
> https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-9
>
>
>
> Thanks,
>
> Matt


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to