[ https://issues.apache.org/jira/browse/GEOMETRY-17?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624894#comment-16624894 ]
Matt Juntunen commented on GEOMETRY-17: --------------------------------------- Hi [~erans], {quote}However you did not comment on my {{withCheckedNorm()}} (untested) suggestion. {quote} I'm not sure on the idea of having a private subclass primarily for validation (and some optimization on retrieving a norm). It seems a bit more than what's needed for the problem and I'm having trouble picturing a use case where it would fit. {quote}I don't see how the constant 1 can be less accurate than a variable holding a value that is supposed to be 1! {quote} I believe the issue here is that the norm of the normalized vector is _supposed_ to be 1, but it very well may not actually be 1 due to floating point errors. So, if we return exactly 1.0 as the norm for normalized vector, we may introduce a mismatch between what we're saying the norm is and what it actually is given the vector coordinates. I believe that's where the issue arises but I can't say for certain. Are you picturing more follow-up tickets here or should we close this issue? > Euclidean Vector Method Follow-Up > --------------------------------- > > Key: GEOMETRY-17 > URL: https://issues.apache.org/jira/browse/GEOMETRY-17 > Project: Apache Commons Geometry > Issue Type: Improvement > Reporter: Matt Juntunen > Priority: Major > > This is a follow-up issue to GEOMETRY-9. The following tasks should be > completed: > # Vector2D - needs an orthogonal() method like Vector3D > # Vector#getMagnitude() should be removed. I originally added this as part > of GEOMETRY-9 as an alias for getNorm(), but after thinking about it more and > working with it, I believe it's more confusing than useful to have multiple > names in the code base for the same idea. > # Vector#withMagnitude() should be renamed to Vector#withNorm() for the same > reason as above. > # Vector#getRealNonZeroNorm() - This is currently a private method in the > Vector implementation classes but I believe it is useful enough to be made > public. The idea is that this would return the vector norm but throw an > IllegalNormException if the norm is zero, NaN, or infinite. I've already come > across some places in other classes (such as Rotation) where I want to use > this. > > Pull request: https://github.com/apache/commons-geometry/pull/11 -- This message was sent by Atlassian JIRA (v7.6.3#76005)