Expand description
B-spline algorithms over control points: evaluation, refinement, elevation.
Everything here is generic over Blend, the affine structure a control
point needs. That is what lets one implementation serve curves and surfaces,
2D and 3D, and (through the homogeneous trick) rational and non-rational
alike, instead of four near-copies that drift apart.
§Rational curves
A rational B-spline is a non-rational one in one higher dimension: weight
each control point, carry the weight as an extra coordinate, evaluate as
usual, then divide through. Every algorithm here therefore applies unchanged
to rational geometry via Weighted, which matters because exact circles,
cylinders and spheres are only representable rationally.
Structs§
- Control
Grid - A rectangular grid of control points for a tensor-product surface.
- Weighted
- A control point carrying a weight, for rational geometry.
Traits§
- Blend
- The affine structure a control point needs: scaling and addition.
Functions§
- binomial_
coefficient n choose k, computed multiplicatively so it stays exact for the small values derivative formulas need.- derivatives
- Evaluate a B-spline and its derivatives up to order
n. - elevate_
degree - Raise the degree by one, leaving the curve unchanged.
- evaluate
- Evaluate a B-spline at
uby de Boor’s algorithm. - evaluate_
rational - Evaluate a rational B-spline: de Boor in homogeneous coordinates, then divide through by the weight.
- evaluate_
rational_ surface - Evaluate a rational tensor-product surface: homogeneous evaluation, then divide through.
- evaluate_
surface - Evaluate a tensor-product B-spline surface at
(u, v). - extend
- Continue a clamped B-spline past one end by
spanin parameter: the polynomial continuation of the curve’s own end derivatives, joined on. - extend_
to - Continue a clamped B-spline past one end to
target, overspanin parameter: a Bézier piece whose firstcontinuity + 1controls carry the curve’s own end derivatives (asextenddoes) and whose last istarget, joined on. The curve is raised a degree first where the piece needs one more than it has. - insert_
knot - Insert
valueinto the knot vectorcounttimes, adjusting control points so the curve is unchanged. - join
- Join two clamped B-splines of one degree end to start into one.
- rational_
derivatives - Evaluate a rational B-spline and its derivatives up to order
n. - rational_
surface_ derivatives - Evaluate a rational surface and its partial derivatives up to total order
order. - reverse
- Reverse the parameter direction, leaving the curve’s shape unchanged.
- split
- Split a B-spline at
uinto two, each with its own clamped knot vector. - surface_
derivatives - Evaluate a surface and its partial derivatives up to total order
order. - to_
bezier_ segments - Decompose a B-spline into its Bézier segments.
Type Aliases§
- Bezier
Segment - A Bézier segment: the parameter interval it covers, and its control points.
- Derivative
Grid - Derivatives up to a small order in each direction, inline: the kernel asks for jets of order two, and the innermost evaluation loops must not pay heap for their own scratch.
- Spline
- A B-spline: a knot vector paired with its control points.