Package com.github.micycle1.geoblitz
Class ProHausdorffDistance
java.lang.Object
com.github.micycle1.geoblitz.ProHausdorffDistance
ProHD: Projection-based Hausdorff Distance approximation for JTS
Geometry.
Intuition: the Hausdorff distance is typically determined by a small set of
"extreme" points. ProHD finds candidate extreme points by projecting each
geometry's sampled points onto a few informative directions (the
centroid-to-centroid axis and principal-component axis/axes), keeping only
the top/bottom alpha tails along each projection. It then computes
the Hausdorff distance on the union of these selected points, yielding a fast
underestimate of the Hausdorff distance of the sampled point sets.
Reference: Jiuzhou Fu, Luanzheng Guo, Nathan R. Tallent, Dongfang Zhao, ProHD: Projection-Based Hausdorff Distance Approximation, arXiv:2511.18207.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubledistance(org.locationtech.jts.geom.Geometry a, org.locationtech.jts.geom.Geometry b, double alpha, double maxSegmentLength) Approximates the (undirected) Hausdorff distance using ProHD: keep only points that are extreme under a few projection directions (centroid axis + PCA axis), then compute Hausdorff on those reduced point sets.
-
Method Details
-
distance
public static double distance(org.locationtech.jts.geom.Geometry a, org.locationtech.jts.geom.Geometry b, double alpha, double maxSegmentLength) Approximates the (undirected) Hausdorff distance using ProHD: keep only points that are extreme under a few projection directions (centroid axis + PCA axis), then compute Hausdorff on those reduced point sets.- Parameters:
a- non-empty geometry Ab- non-empty geometry Balpha- tail fraction kept per projection direction, in (0, 0.5]. For each direction and each set of n sampled points, we keep k = max(1, floor(alpha * n)) points with the smallest projections AND k points with the largest projections (≈ 2 * alpha * n per direction, before unions across directions). Typical values: 0.01–0.1.maxSegmentLength- if > 0, densifies geometry segments so consecutive sample points are at most this far apart (in geometry units). If <= 0, uses only the geometry's existing vertices.- Returns:
- the approximate Hausdorff distance
-