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(). 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