Module intersect

Source
Expand description

Triangle-triangle self-intersection over a mesh (#73).

§Why adjacency is the hard part

In a closed mesh, every triangle shares an edge with three neighbours and a vertex with many more. Those touch by construction. A naive predicate that answers “do these two triangles share a point” reports every closed mesh as broken, so adjacency is excluded structurally: pairs sharing any vertex INDEX are skipped before any arithmetic runs.

Index-based exclusion, not coordinate comparison. Two distinct vertices holding equal coordinates are a DuplicateVertex defect, reported separately; treating them as adjacent here would hide it.

§Broad phase

Candidate pairs come from the shared Bvh. The index is an accelerator only: self_intersections_brute_force computes the same answer by checking every pair, and the two must agree on every input. If they ever disagree, the index is wrong – that is a bug, not a tuning parameter.

Structs§

IntersectingPair
One intersecting triangle pair, lower index first.

Functions§

self_intersections
Self-intersecting triangle pairs, found through the spatial index.
self_intersections_brute_force
The same answer without the spatial index, by checking every pair.