You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Juntunen (Jira)" <ji...@apache.org> on 2020/12/22 16:41:00 UTC

[jira] [Commented] (GEOMETRY-111) Metric interface instead of Point/Verctor interface [BREAKING CHANGE]

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

Matt Juntunen commented on GEOMETRY-111:
----------------------------------------

How would this affect the APIs? What would the {{Point}} and {{Vector}} interfaces look like? Can you give a before/after example of how things would be simplified?

> Metric interface instead of Point/Verctor 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
>            Priority: Major
>
> Using a Point/Vector 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(P start, P 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)