Skip to main content

Module surface

Module surface 

Source
Expand description

Surface/surface intersection: the analytic cases.

Where two surfaces meet has a closed form for a specific and well-known set of pairs, and a general answer that needs a marching intersector with a fitting stage after it. This module is the first of those. It is deliberately not a partial implementation of the second: a pair it cannot solve exactly is reported as needing the general path, never approximated.

§Why the exact cases come first, and separately

Three reasons, and the third is the one that matters.

They are common. Plane against plane, plane against cylinder, sphere against sphere: a mechanical part is mostly these, and running a marching intersector over a pair whose answer is a circle is slower and less accurate than writing down the circle.

They are fast. No stepping, no refinement, no approximation stage.

And they are ground truth. Every result here can be checked without reference to anything but the two surfaces themselves: sample the curve, ask each surface how far away it is, and the answer should be zero. That check is the instrument the intersection gate is measured with (docs/PLAN.md), and it only exists because these cases are exact. A benchmark whose reference answers came from the thing being benchmarked would measure nothing.

§What it reports

Not just curves. Two surfaces can miss, touch at a point, meet along curves, or be the same surface, and those are four different answers that downstream code has to distinguish. A boolean that treats coincidence as “no intersection” produces a solid with a face missing.

Enums§

Meeting
What two surfaces do where they meet.

Functions§

surface_surface
Where two surfaces meet, when that has a closed form.