[ 
https://issues.apache.org/jira/browse/GEOMETRY-17?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16624465#comment-16624465
 ] 

Matt Juntunen commented on GEOMETRY-17:
---------------------------------------

I just pushed some changes for this. Here's what I did:
 # I renamed the getRealNonZeroNorm() method to getCheckedNorm() and made it 
private like it was before. External classes can use the utility method in 
Vectors to perform the checks.
 # I made a new interface named MultiDimensionalEuclideanVector and moved the 
project and reject methods to it. So, now Vector1D does not include them. That 
interface also includes orthogonal() and orthogonal(Vector).

Here's what I did NOT do:
 # I did not make the angle() method propagate NaNs. I thought about it more 
and the existing behavior with the exception makes sense to me. My thought was 
that with all of the other methods, we would usually be just propagating 
NaNs/infs but in the case of angle(), we might actually be producing them. For 
example, calculating the angle between two vectors with zero norms introduces 
an NaN where one did not exist before.
 # I did not make the UnitVector getNorm() and getNormSq() methods return 1.0. 
This is because I'm not sure how doing so affects the overall floating point 
accuracy. When I tried it out, some unit tests in commons-geometry-spherical 
started failing. So, I reverted it.

Let me know what you think.

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

Reply via email to