isInCircleAdapt sketch Java port - #311
Conversation
| if (-det > errbound)) { | ||
| return false; | ||
| } | ||
| return isInCircleDDSlow(a, b, c, p); |
There was a problem hiding this comment.
Should call inCircleDDFast - it is equivalent and faster
|
Need unit tests before rolling this in. |
|
Good find. This should provide both performance and robustness. The same approach is currently used in computing the orientationIndex. Also based on Shewchuk's fine work. |
|
Just in case, I would be happy if someone familiar with java takes over this PR, to make proper formatting, unit tests and code style. |
|
Makes sense. And add some unit tests. Not sure when I'll have time to work on this though. |
Do the non-robust calculation and calculation of error margin. If calculation is possibly not robust, fall back on slower math. https://www.cs.cmu.edu/afs/cs/project/quake/public/code/predicates.c
|
Thanks for keeping this open — design-history note from the NetTopologySuite.Proofs mesh / Delaunay lane (we treated #311 → #1094 → #1212 as one product lineage; tip for merge discussion is #1212). What this PR established (2018)Stage A Shewchuk in-circle filter (coords translated so Numbers (Stage A only vs extracted
|
| Check | Result |
|---|---|
| Oracle flip pin | POS 1.5 |
| Stage A#311 CERTAIN vs oracle sign conflicts | 0 |
| Stage A#311 UNCERTAIN | 7 (correct declines) |
GEOS955 / JTS#1171 subset still shows why escalation exists: Stage A ZERO/UNCERTAIN, oracle POS.
Two archive notes (not merge blockers for a history PR)
- Name vs body:
isInCircleAdapthere is Stage A + DDFast, not Shewchuk’s fullincircleadaptexpansion stages (that fuller port is Make isInCircleRobust robust #1094). - ε: this PR uses
Math.ulp(1.0)(= (2^{-52})); Shewchuk / Improve triangulation robustness #1212 / Make isInCircleRobust robust #1094 use (2^{-53}). Bound is ~2× looser (more DD). Direction is safe; later PRs align with the published constant. - 2026 large-coord unit test: after binary64 rounding of the (10^{14}) literals, Stage A det and the Rocq in-circle kernel both say ZERO (not strictly inside). If
isInCircleDDFaststill returnstrueon those doubles, that is a useful DD-path check against an independent kernel — happy to dig further if useful.
Bottom line
Valuable as the first open sketch of robust in-circle Stage A in JTS. For production merge we point at #1212 (Stage A + DDNormalized + Vertex.isCCW → Orientation.index); corpus gates for the tip are already green.
(Affiliation: NetTopologySuite.Proofs — formal mesh/predicate companion, not a JTS committer review.)
Do the non-robust calculation and calculation of error margin. If calculation is possibly not robust, fall back on slower math.
https://www.cs.cmu.edu/afs/cs/project/quake/public/code/predicates.c
References #298