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. A branch thinner than
the grid crosses no pair of triangles; where it meets a spline’s border it
is found as a piercing, and a closed loop inside both surfaces is found
from the approach of the surfaces inside it. A branch running along a
border of either chart, where one surface ends in the other, is found by
sampling the border itself. Where the surfaces lie close
along a whole curve only part of that search is made, and there the grid
is the knob.
§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.
- branches_
cut_ at_ poles - Every branch of the intersection, as
branches, each cut at a pole of either chart lying on the other surface withinreachof it as well as within the chord (seecut_at_poles). - chart_
poles - The poles of a surface’s chart: each bound of a direction that does not
repeat along which the surface collapses to a point (a sphere’s pole, a
patch’s collapsed side), as the unknown that holds it (0 for
u, 1 forv), the bound, and the point. - cut_
at_ poles - A branch cut where it runs through a pole of either surface’s chart: the pieces between the poles, each ending on the pole, its image there on the line of the chart it arrives or leaves along.
- passes_
a_ pole - Whether
curvepasses a pole of either surface’s chart withinreachbetween its ends: nearer the pole thanreachsomewhere, its ends both farther. - seeds
- Starting points on the intersection, one per branch found.
- trace
- Follow the intersection from a starting point, in both directions.