Expand description
The general surface/surface intersector: seed, then walk.
Where two surfaces meet has no closed form in general: the curve is
transcendental, and docs/DATA_MODEL.md §9 is blunt about the consequence:
there is no exact answer to be exact about, which is why the topology carries
tolerances. What there is instead is a curve that can be followed, one
corrected step at a time, to a stated accuracy.
§Two problems, kept apart on purpose
Finding a branch and following one fail in completely different ways, and lumping them together is how an intersector comes to look better than it is. A tracer that follows one branch beautifully while never noticing the second reports a smooth, accurate, wrong answer, and the obvious accuracy measure, “is every point on both surfaces”, scores it perfectly.
So seeds and trace are separate, separately testable, and separately
measured. Seeding is polyhedral: both surfaces are sampled into triangles and
the triangle pairs that cross give starting points. It finds a branch if the
sampling resolves it, and misses one thinner than the grid, which is a
real limitation with a knob attached rather than a mystery.
§Following the curve
At a point on both surfaces the intersection runs along the cross product of the two normals: the one direction that stays in both tangent planes. Step along it and you leave both surfaces slightly; a Newton correction brings you back.
The correction has four unknowns (two parameters on each surface) and three
equations, A(u1,v1) = B(u2,v2). That is deliberately one short, because the
solution set is the curve and pinning it to a point needs one more
condition. The fourth is a plane across the direction of travel: it says how
far along to land, and it is what turns “somewhere on the curve” into “the
next point”.
§What it reports about itself
Whether the curve closed, and whether it ran out of steps. A polyline that stopped because it hit a limit is not the same answer as one that stopped because the curve ended, and a caller that cannot tell them apart will treat a truncated branch as a complete one.
Structs§
- Contact
- A point that lies on both surfaces, with where it is on each.
- Marching
- How hard to look, and how closely to follow.
- Traced
- One traced branch.
Enums§
- Stopped
- Why a traced branch stopped.
Functions§
- branches
- Every branch of the intersection: seed, trace each, and keep the distinct ones.
- seeds
- Starting points on the intersection, one per branch found.
- trace
- Follow the intersection from a starting point, in both directions.
- trace_
tangential - Trace tangential contact along a curve: the walker an earlier plan owed, following the valley of the gap function rather than a crossing.