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

Matt Juntunen commented on GEOMETRY-13:
---------------------------------------

bq. The purpose is to eliminate/minimize duplication by finding the most 
appropriate "home" for reusable bits of code. 

Yes, but my question is more of a practical one. The externally useful methods 
in {{Vectors}} are 
* {{norm}} - 1D, 2D, 3D
* {{normSq}] - 1D, 2D, 3D

The {{normSq}} methods are trivial but could be useful as part of a public API. 
The 1D and 2D {{norm}} methods simply delegate to the JDK methods {{Math.abs}} 
and {{Math.hypot}}, respectively. The 3D {{norm}} method uses {{SafeNorm}}. So, 
the question is, what would be the most useful parts to move to 
commons-numbers? I'm picturing two possible approaches here:
# Create a {{Vectors}} class in commons-numbers-arrays that has 1D, 2D, 3D, and 
ND (double array) methods for {{norm}}, and {{normSq}}. This would replace 
{{SafeNorm}}.
# Add a 3D overload for {{SafeNorm.value}} and leave the other trivial methods 
as internal implementation details of commons-geometry.

Thoughts?

> Move Vector Norm Methods to commons-numbers-arrays
> --------------------------------------------------
>
>                 Key: GEOMETRY-13
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-13
>             Project: Apache Commons Geometry
>          Issue Type: Task
>            Reporter: Matt Juntunen
>            Priority: Minor
>             Fix For: 1.0
>
>
> The code we have now in the Vectors utility class for computing vector norms 
> should be placed in commons-numbers-arrays and used from there. This should 
> allow for greater re-usability of the code. We should also try to use the 
> SafeNorm class from that module for computing L2 norms.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to