Skip to content

Add DirectedHausdorffDistance class#1182

Merged
dr-jts merged 43 commits intolocationtech:masterfrom
dr-jts:add-directed-hausdorff-distance
Mar 3, 2026
Merged

Add DirectedHausdorffDistance class#1182
dr-jts merged 43 commits intolocationtech:masterfrom
dr-jts:add-directed-hausdorff-distance

Conversation

@dr-jts
Copy link
Contributor

@dr-jts dr-jts commented Feb 16, 2026

Adds the DirectedHausdorffDistance class, and supporting code. It computes the directed Hausdorff distance (and thus the Hausdorff distance) to any desired accuracy. It has the following features:

  • uses a fast branch-and-bound algorithm with lazy densification
  • where the distance occurs at a non-vertex, computes the result to a given distance tolerance
  • can compute distance tolerance automatically, providing a "magic-number-free" API
  • supports any combination of points, lines, and polygons (and allows the Hausdorff distance to be determined at interior points of polygons)
  • provides prepared mode execution (caching computed indexes)
  • provides a isFullyWithinDistance predicate to test whether the directed Hausdorff distance meets a given limit, with short-circuiting used to improve performance for repeated queries
  • provides fast performance for topologically equal geometries, and ones with very small distances

This essentially replaces the DiscreteHausdorffDistance class.

For more details see blog post.

@dr-jts dr-jts force-pushed the add-directed-hausdorff-distance branch from 8c8f41b to 50c0104 Compare February 27, 2026 20:22
@dr-jts dr-jts marked this pull request as ready for review March 3, 2026 21:07
@dr-jts dr-jts merged commit af11591 into locationtech:master Mar 3, 2026
2 checks passed
@dr-jts dr-jts deleted the add-directed-hausdorff-distance branch March 3, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant