Skip to main content

Module bspline

Module bspline 

Source
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§

ControlGrid
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 u by 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 span in 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, over span in parameter: a Bézier piece whose first continuity + 1 controls carry the curve’s own end derivatives (as extend does) and whose last is target, joined on. The curve is raised a degree first where the piece needs one more than it has.
insert_knot
Insert value into the knot vector count times, 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 u into 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§

BezierSegment
A Bézier segment: the parameter interval it covers, and its control points.
DerivativeGrid
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.