Baljit Singh created GEOMETRY-111:
-------------------------------------

             Summary: Metric interface instead of Point interface [BREAKING 
CHANGE]
                 Key: GEOMETRY-111
                 URL: https://issues.apache.org/jira/browse/GEOMETRY-111
             Project: Apache Commons Geometry
          Issue Type: New Feature
            Reporter: Baljit Singh


Using a Point interface (especially, the self-bounded/referencing Point<P 
extends Point<P>>), leads to awkward use of Java generics in other classes. The 
need is understood in that it makes things "easier" within the subclasses, but 
it does make other APIs and method signatures a lot more complicated.

Instead, I would propose a Metric<P> interface, with a single method `double 
distance(T start, T end)`. This makes the API a lot more flexible. For example, 
using the same point type (Vector3D), one can define two metrics (Euclidean 
distance for Cartesian space, and angle for Spherical space). 

I understand that it is difficult to prove the usability case, but I'm speaking 
from experience, having implemented both ways in other libraries.



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

Reply via email to