Skip to main content

Module knots

Module knots 

Source
Expand description

Knot vectors and B-spline basis functions.

The basis is the foundation of every free-form curve and surface in the kernel. Everything else (de Boor evaluation, knot insertion, degree elevation, Bézier decomposition) is built on the functions here.

§Representation

A KnotVector stores the flat non-decreasing sequence, with repeated knots written out. That is what every algorithm wants, and deriving it from a distinct-knots-plus-multiplicities form on each call would cost an allocation in the hottest loop in the crate.

Repeated knots must be bit-identical, and every operation here preserves that: knot insertion copies the inserted value rather than recomputing it. Multiplicity is therefore an exact question, not a tolerance one, which matters because multiplicity determines continuity: a knot of multiplicity p in a degree-p curve is a corner, and “nearly a corner” is not a thing.

§Conventions

For degree p and n control points the flat vector has n + p + 1 entries. A clamped vector repeats its first and last knots p + 1 times, so the curve passes through its first and last control points; that is the usual form for a bounded curve and the one KnotVector::clamped_uniform produces.

Structs§

KnotVector
A non-decreasing knot sequence with an associated degree.

Type Aliases§

BasisValues
Basis values for one span, sized to avoid allocating for typical degrees.
DerivativeRows
One row of basis values per derivative order, inline up to the jet orders the kernel asks for.