VoronoiDiagramBuilder: tolerance-based dedup + safe cell construction (stacked on #1212)#1213
Closed
grootstebozewolf wants to merge 0 commit into
Closed
Conversation
14e9a97 to
d5d5dab
Compare
d5d5dab to
07833d3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked PR on top of #1212
Suggested title:
VoronoiDiagramBuilder: tolerance-based dedup + safe cell construction (stacked on #1212)Base: the head of PR #1212 (or
micycle1:fixup/ the PR branch once merged).Summary
This is a stacked PR built directly on top of the great work in #1212.
PR #1212 delivers:
isInCircleRobust(double fast-path + DD fallback)Orientation.indexforVertex.isCCWThis change adds the pieces required to fully resolve the original #20 report for the public
VoronoiDiagramBuilderAPI:KdTreewhensetTolerance(tol > 0)DelaunayTriangulationBuilder.unique(Coordinate[], double)LinearRingconstruction ingetVoronoiCellPolygon(guarantees a valid ≥4-point ring and that cell count always matches the number of unique sites)setTolerance(0.1), assertingisValid()+ exactly 4 cellsdoc/issue20-verification.md)Why this stack?
The predicate improvements in #1212 are an excellent foundation for the whole triangulation stack.
For the specific scenario reported in #20 (
VoronoiDiagramBuilder+ positive tolerance on near-coincident sites), we also need upstream prevention and downstream safety:setTolerance(0.1)to collapse near-coincident sites and produce the correct number of cells.This work provides exactly that defense-in-depth on top of the predicate improvements.
Relationship to #1212
isInCircleRobustfilter from Improve triangulation robustness #1212 becomes the new robust implementation.setTolerancebehavior) actually work.Testing & verification
VoronoiDiagramBuilderTest#testRobustnessIssue20NearCoincidentPoints(literal WKB +setTolerance(0.1)) passes and asserts the expected 4 cells.Request to the author / maintainers
@micycler1 — I really like the direction in #1212. The bounded fast-path incircle predicate is a nice improvement.
I put this together as a stack on top because the original #20 issue (and many real-world Voronoi users) specifically exercise
VoronoiDiagramBuilder.setTolerance(...). Would you be open to reviewing this, or folding the relevant parts (dedup + cell safety) into the base PR? I'm very happy to rebase, adjust scope, or change anything to make the overall contribution stronger.The only goal here is to make JTS more robust for everyone.
Happy to chat about any trade-offs.
Thanks again for pushing on this area!
#MakeJTSStronger
High-level diff
DelaunayTriangulationBuilder/VoronoiDiagramBuilder: dedup via KdTree +unique(..., tolerance)QuadEdgeSubdivision: safegetVoronoiCellPolygon(tiny valid ring synthesis + count invariant)VoronoiDiagramBuilderTest: exact Robustness failure in VoronoiDiagramBuilder #20 repro test with count assertiondoc/: verification report + history entryHow to publish this stacked PR (copy-paste these steps):
Ready-to-paste PR title + body:
(Also see
stacked-pr-setup-commands.txtfor the full setup commands.)