Skip to content

isInCircleAdapt sketch Java port - #311

Open
Komzpa wants to merge 3 commits into
locationtech:masterfrom
Komzpa:patch-1
Open

isInCircleAdapt sketch Java port#311
Komzpa wants to merge 3 commits into
locationtech:masterfrom
Komzpa:patch-1

Conversation

@Komzpa

@Komzpa Komzpa commented Sep 4, 2018

Copy link
Copy Markdown

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

if (-det > errbound)) {
return false;
}
return isInCircleDDSlow(a, b, c, p);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should call inCircleDDFast - it is equivalent and faster

@dr-jts

dr-jts commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Need unit tests before rolling this in.

@dr-jts

dr-jts commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

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.

@Komzpa

Komzpa commented Sep 4, 2018

Copy link
Copy Markdown
Author

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.

@dr-jts

dr-jts commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Makes sense. And add some unit tests. Not sure when I'll have time to work on this though.

Komzpa added 3 commits May 25, 2026 04:22
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
@grootstebozewolf

Copy link
Copy Markdown
Contributor

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 P is origin) with permanent-scaled iccerrboundA, then escalate when uncertain. That filter-then-escalate shape is exactly what #1212 and #1094 still use. Maintainer notes from 2018 (isInCircleDDFast, unit tests) aged well.

Numbers (Stage A only vs extracted b64_inCircle)

Write-up: jts-311-incircle-lane (oracle/jts311_incircle_history.txt, 22 vectors).

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)

  1. Name vs body: isInCircleAdapt here is Stage A + DDFast, not Shewchuk’s full incircleadapt expansion stages (that fuller port is Make isInCircleRobust robust #1094).
  2. ε: 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.
  3. 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 isInCircleDDFast still returns true on 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.isCCWOrientation.index); corpus gates for the tip are already green.

(Affiliation: NetTopologySuite.Proofs — formal mesh/predicate companion, not a JTS committer review.)

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.

3 participants