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

Raymond DeCampo commented on MATH-1284:
---------------------------------------

Please take a look at the {{feature-MATH-1284}} branch.

First, I made it so that {{Vector}} no longer extends {{Point}}.  Then I added 
the appropriate methods from the {{Point}} interface to the {{Vector}} 
interface.

The only implementations which represented problems were the {{Vector?D}} 
classes.  I noticed that the existing code dealing with these implementations 
relied pretty heavily on casting back and forth between {{Point}} and 
{{Vector}}, so the most prudent thing seemed to be supplying a class which 
implements both.

I decided on {{Coordinates?D}} for the "new" classes (these are really just 
{{Vector?D}} renamed).  Here I am using the fact that point a vector and a 
point in finite dimensional Euclidean space can be represented by a set of 
coordinates.  (Keeping the classes with {{Vector?D}} name would feel like we 
hadn't really addressed the issue.)

If it is a problem that the {{Vector?D}} classes are just dropped we could 
introduce them as an intermediate interface (or even as a concrete class which 
{{Coordinates?D}} extends but that feels less satisfying).

Having {{Coordinates?D}} implement both interfaces led to some method calls 
being ambiguously defined.  Here I just removed one of the methods.  I am 
thinking now it would have been better just to create an implementation 
accepting the {{Coordinate?D}} class.

In any case, there would be more work in terms of cleaning up and 
documentation, this is not meant to be a finished product but a basis for 
discussion.


> Vector is-not-a Point
> ---------------------
>
>                 Key: MATH-1284
>                 URL: https://issues.apache.org/jira/browse/MATH-1284
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.5
>            Reporter: Roman Werpachowski
>            Priority: Minor
>             Fix For: 4.0
>
>
> The class hierarchy for geometry claims that Vector is-a Point: 
> https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/geometry/Point.html
> This is mathematically incorrect, see e.g. 
> http://math.stackexchange.com/a/645827
> Just because they share the same numerical representation, Point and Vector 
> shouldn't be crammed into a common class hierarchy.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to