rf-geom / ridgeforge Public

Overview/Examples/5. Reporting self-intersections as a gate

worked example 5 of 6

Reporting self-intersections as a gate

SelfIntersection::find is exact and tolerance-free, which makes it suitable as a pass/fail gate in a pipeline: either triangles share a point or they do not.

Example 5 of six - the program sits on the examples page, and this page takes it from the running end: the console it produces, the Status values that end it early, and the options worth changing.

What it prints

2 intersecting pairs
  tri 40118 x tri 40236
  tri 88004 x tri 88010
exit code 3 (gate failed)

Detection reports a pair if and only if the two closed triangles share a point; there is no tolerance to tune and no false positive to argue about.

When it goes wrong

Adjacent faces flagged
By default ignore_adjacent=true skips pairs that share a vertex or edge; turning it off floods the report with legitimate neighbours.
resolve never converges
On two shells nested inside one another it exhausts its passes and reports pairs_after unchanged - this is RF-41 and the reason it is still experimental.
The search is slow on huge meshes
Set threads above zero; the hierarchy descent is embarrassingly parallel and scales well, unlike the collapse loop.

Variations

Stop at the first hit
Set max_pairs=1 to turn the gate into a cheap boolean that stops descending once it finds anything.
Attempt a repair
Follow find with resolve, but check the report: it is best-effort and says so in its name.

Symbols used here