BSpline

class BSpline<T : LinearType<T>>(val controlPoints: List<T>, val degree: Int, val knots: List<Double>, val closed: Boolean = false)(source)

A B-spline curve of degree p with controlPoints and a non-decreasing knots vector of length controlPoints.size + p + 1, after Piegl and Tiller, "The NURBS Book" (Springer, 1997). The curve is defined on the domain from knot p to knot controlPoints.size, is C^(p-k) where a knot has multiplicity k, and stays inside the convex hull of every p + 1 consecutive control points.

Create one with BSpline.clamped, BSpline.periodic or by interpolation with interpolatingBSpline.

Parameters

closed

whether the curve is closed, as a periodic spline is; drawn as a closed contour or path

Constructors

Link copied to clipboard
constructor(controlPoints: List<T>, degree: Int, knots: List<Double>, closed: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val degree: Int
Link copied to clipboard

The parameter range on which the curve is defined.

Link copied to clipboard

Functions

Link copied to clipboard

The control points of the Bézier pieces of the curve, one list of p + 1 points per non-empty knot span of the domain: every knot in the domain, its ends included, is inserted until it has multiplicity p.

Link copied to clipboard

The derivative at parameter u.

Link copied to clipboard

The derivative B-spline of degree p - 1, with control points p·(Pᵢ₊₁ - Pᵢ) / (uᵢ₊ₚ₊₁ - uᵢ₊₁) and the inner knots; null for degree 1, whose derivative is piecewise constant.

Link copied to clipboard

The spline with knot u inserted once, by Boehm's algorithm (Piegl and Tiller, algorithm A5.1); it describes the same curve. With k the last knot index at or before u and s the multiplicity of u, the control points k - p + 1 to k - s are replaced by points on the edges of the control polygon.

Link copied to clipboard
fun position(u: Double): T

The position at parameter u in the domain, by de Boor's algorithm.

Link copied to clipboard
fun BSpline<Vector2>.toContour(tolerance: Double = 0.01, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

This spline as a ShapeContour: exactly, one Bézier segment per knot span, for degree 1 to 3, and approximated by cubic Béziers within tolerance for higher degrees.

Link copied to clipboard
fun BSpline<Vector3>.toPath3D(): Path3D

This spline as a Path3D, exactly for degree 1 to 3, see toContour; higher degrees are not supported.