Matt Juntunen created GEOMETRY-140:
--------------------------------------

             Summary: Vector/Point EquivalenceComparator
                 Key: GEOMETRY-140
                 URL: https://issues.apache.org/jira/browse/GEOMETRY-140
             Project: Apache Commons Geometry
          Issue Type: New Feature
            Reporter: Matt Juntunen


I propose adding the following static method to the VectorXD and PointXS 
classes, where {{P}} is the Vector/Point type:
{code:java}
public static Comparator<P> equivalenceComparator(Precision.DoubleEquivalence 
eq) {...}
{code}
The method would return a {{Comparator}} that delegates to the 
{{Precision.DoubleEquivalence.compare()}} method of the argument, passing each 
vector/point coordinate in order. This comparator could be used, for example, 
to create {{TreeMap}} or {{TreeSet}} instances that loosely compare 
vectors/points, as done currently in 
[SimpleTriangleMesh|https://github.com/apache/commons-geometry/blob/master/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/mesh/SimpleTriangleMesh.java#L679].



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

Reply via email to