Skip to main content

Module approx

Module approx 

Source
Expand description

The approximation stage: a traced branch becomes curves.

A traced branch is a polyline with a stated chord tolerance: honest, and not what anything downstream wants to hold. An edge wants a curve in space; a face wants that curve in its own parameter space, because splitting a face happens there and a curve the face cannot express is a curve it cannot be split along (docs/DATA_MODEL.md §6).

So one branch becomes three fits sharing one tolerance: the 3D curve, and one pcurve per surface, each fitted from the samples the tracer already recorded. The tracer kept the parameters on both surfaces at every point precisely for this moment; re-deriving them here would be a projection per point, solving again what the marcher already solved.

§The tolerance story, stated once

The result’s tolerance is a sum of stated parts, not a hope: the trace sits within its chord tolerance of the true intersection, and the fit sits within its own reported error of the trace. Both numbers are carried, and the total is what an edge built on this curve must widen its tolerance to. Nothing here rounds a miss up to a hit; a fit that could not reach its target says so, and the caller decides whether the looser curve is usable.

§Seams

A branch crossing a periodic surface’s seam has parameter samples that jump by a period: the pcurve polyline tears even though the curve in space is smooth. The samples are unwrapped before fitting: each step is folded to the nearest image, so the pcurve runs continuously past the seam and may legitimately leave [0, 2π). That is what a pcurve on a periodic surface is; folding it back would re-tear it.

Structs§

IntersectionCurve
A branch of an intersection, as curves.

Functions§

approximate_branch
Fit one traced branch to curves, within tolerance.