Hello,

I recently posted a PR [1] for GEOMETRY-142 [2], which is for adding
PointMap and PointSet implementations. These are Map and Set
implementations specifically designed to use Points as keys. They
support fuzzy key comparison, meaning that points do not have to be
exactly equal to each other in order to be considered equal by the
map/set. (Note that this means these types do not follow the strict
Map/Set contracts since they are not consistent with equals. This is
documented in the PointMap/PointSet javadocs.) I've completely hidden
the implementation details from the public API since I anticipate
changes in the future with regard to the algorithms used. Instances
are created through factory classes in each space. Ex:

PointMap<Vector3D, String> map = EuclideanCollections.pointMap3D(precision);
PointSet<Point2S> set = SphericalCollections.pointSet2S(precision);

Since fuzzy key comparison is used, I've added the following methods
to the interfaces to allow access to the exact, "canonical" version of
the key stored in the collection.

PointMap<P, V>  {
    // return the key corresponding to pt, or null if not found
    P resolveKey(P pt);

    // return the map entry corresponding to pt, or null if not found
    Map.Entry<P, V> resolveEntry(P pt);
}

PointSet<P> {
    // return the key corresponding to pt, or null if not found
    P resolve(P pt);
}

Reviews and comments are welcome.

Regards,
Matt Juntunen


[1] https://github.com/apache/commons-geometry/pull/194
[2] https://issues.apache.org/jira/projects/GEOMETRY/issues/GEOMETRY-142

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to