B-Spline Curve with Knots

This Demonstration illustrates the relation between B-spline curves and their knot vectors. Start with the control points {(Subscript[p, 0]),(Subscript[p, 1]),...,(Subscript[p, n])|(Subscript[p, i])∈(ℝ^k)} and a knot vector {(Subscript[t, 0,])(Subscript[t, 1]),...,(Subscript[t, m])}, where the degree of the B-spline is p=m-n-1. The knot vector satisfies (Subscript[t, i])∈[0,1] and (Subscript[t, i])≤(Subscript[t, i+1]). The B-spline basis functions are defined as:

(Subscript[N, i,0])(t)=(Piecewise[{{1, (Subscript[t, i])≤t<(Subscript[t, i-1])}, {0, otherwise}}])

(Subscript[N, i,p])(t)=((t-(Subscript[t, i]))/((Subscript[t, i+p])-(Subscript[t, i])))(Subscript[N, i,p-1])(t)+(((Subscript[t, i+p+1])-t)/((Subscript[t, i+p+1])-(Subscript[t, i+1])))(Subscript[N, i+1,p-1])(t),

and a B-spline curve is defined as:

C(t)=(∑_(i=0)^n)(Subscript[p, i])(Subscript[N, i,p])(t).

For nonperiodic B-splines, the first p+1 knots are equal to 0 and the last p + 1 knots are equal to 1. If k duplication happens at the other knots, the curve becomes p-k times differentiable. So, by overlapping the knots, you can generate a curve with sharp turns or even discontinuities.

When the number of control points is p-1, the basis functions are reduced to Bernstein polynomial, thus the curve becomes a Bézier curve.

THINGS TO TRY

MouseOver ▪ MouseOver

DETAILS

Red points indicate the knot points C((Subscript[t, i])) on the curve. Hold down the Alt key and click to add new control points (up to 12). Changes in degree and number of control points will cause the knot vector to be recomputed.

Choose "view basis functions" to show the B-spline basis functions of a given knot vector instead of the B-spline curve.

RELATED LINKS

Contributed by: Yu-Sung Chang

© The Wolfram Demonstrations Project & Contributors   |   Terms of Use