What is the relationship between cubic B-splines and cubic splines?

What is the relationship between cubic B-splines and cubic splines?


Solution 1:

A cubic spline is just a string of cubic pieces joined together so that (usually) the joins are smooth. The argument values at which the joins occur are called "knots", and the collection of knots is called a "knot sequence" or "knot vector".

Let's take the knot sequence to be fixed, for a while. Then the set of all cubic splines (with these given knots) forms a vector space, and it turns out that some things called b-spline basis functions form a basis for this vector space. If you don't know anything about vector spaces, this just means that you can write any spline uniquely as a linear combination of these basis functions. When you write a spline curve as a linear combination of b-spline basis functions in this way, it's called a "b-spline". So, b-splines are not a new type of spline, they are simply a different way of expressing any existing spline, in much the same way that "XVI" is a different way of expressing the number sixteen. And the important point is that any piecewise polynomial (i.e. any spline) can be written as a b-spline.

The functions $B_0$, $B_1$, $B_2$, $B_3$ that you described are the pieces that are used to form basis functions in the special case of cubic splines with uniform knots. The word "uniform" just means that the knots are equally spaced, so, usually, they are taken to be integers ... 0,1,2,3,4,... The nice thing about uniform knots is that all the resulting basis functions have identical shape, so any one of them can be obtained just by translating one primary one (moving it to the left or right). And, because the knot spacing is so simple, it's easy to write down explicit formulas for these uniform basis functions.

This picture shows the graphs of your four functions: enter image description here

Then, here, we focus on the interval $[0,1]$. The functions are labelled $a$, $b$, $c$, $d$, instead of $B_0$, $B_1$, $B_2$, $B_3$. \begin{align*} a(u) &= \tfrac16 u^3 \\ b(u) &= \tfrac16 \left( 1 + 3u + 3u^2 - 3u^3 \right) \\ c(u) &= \tfrac16 \left( 4 - 6u^2 + 3u^3 \right) \\ d(u) &= \tfrac16 \left( 1 - u\right)^3 \end{align*}

enter image description here

To form any basis function, you shift these pieces and glue them together, as shown here:

enter image description here

A few simple calculations, using continuity, show that in fact $h=2/3$ and $k=1/6$. This composite curve is $C_2$. As I mentioned above, you can get any other (uniform) basis function by shifting this one to the right or left.

If the knots are not uniform, then the basis functions are much more complex, and people don't usually write out closed-form formulas for them. Instead, they are generated recursively by the deBoor-Cox algorithm, starting with degree zero and working upwards to higher degrees.

For more info, look here, especially at "unit 6", or here, or here.

Solution 2:

Splines as interpolating curves of minimal curvature

For curves with moderate curvature, the second derivative is a good proxy for the real curvature (inverse of the curvature radius).

A spline is the minimizer of the variational problem to interpolate a given set of points while minimizing the second derivative: $$ y=\mathop{\arg\min}_{u\in H^2([a,b])}\int_a^b \|u''(x)\|_2^2\,dx\qquad\text{ s.t.}\qquad \begin{split} u(x_k)=x_k,\quad k=1,2,...,n\\a\le x_1<x_2<...<x_n\le b \end{split} $$ The solution is

  1. piecewise cubic on intervals $[x_i,x_{i+1}]$,
  2. linear on $[a,x_1]$ and $[x_n,b]$,
  3. continuous up to the second derivative, and
  4. has the general formula $$ y(x)=a+bx+\sum_{k=1}^n c_k\, (x-x_k)_+^3 $$

B-Splines

The cubic B-spline (basis spline) centered at $x=0$ is

$$\beta_3(x)=\frac16\left[(x+2)_+^3-4\,(x+1)_+^3+6\,(x)_+^3-4\,(x-1)_+^3+(x-2)_+^3\right]$$

(graphic has wrong scaling, too high by a factor of 6) cubic B-spline centered at 0

which obviously invalidates that the function values at integers are only 0 and 1. But still it is a compactly supported, minimally so, spline function with nodes at the integers.

Locally, every cubic spline with integer nodes can be expressed as a linear combination $\sum_{k=m}^nc_k \beta_3(x-k)$ of B-splines.


Bezier curves

Bezier curves, sometimes called Bezier splines, have the formula $$ y(x)=(1-x)^3P_0+3(1-x)^2xC_0+3(1-x)x^2C_1+x^3P_1 $$ for $x\in[0,1]$.

In the general spline context, they can be used to express one segment of a spline. Not every concatenation of such segments results in a spline, the continuity of first and second derivatives must be ensured.

The nice property of Bezier curves is that they can be evaluated as convex combinations of convex combinations of... If $[A,B]_x=(1-x)A+xB$ then $$ y(x)=\Bigl[\bigl[\,[P_0,C_0]_x,[C_0,C_1]_x\,\bigr]_x,\,\bigl[\,[C_0,C_1]_x,[C_1,P_1]_x\,\bigr]_x\Bigr]_x $$


Other parametrizations of cubic segments

Your basis functions, also over the interval $[0,1]$, take the values $$ \begin{array}{|ccc|ccc|ccc|} B_k(x)&B'_k(x)&B''_k(x)&B_k(0)&B'_k(0)&B''_k(0)&B_k(1)&B'_k(1)&B''_k(1)\\ \hline \tfrac16(1-x)^3&-\tfrac12(1-x)^2&(1-x)&\tfrac16&-\tfrac12&1&0&0&0\\ \tfrac16(3x^3-6x^2+4)&\tfrac12(3x^2-4x)&(3x-2)&\tfrac23&0&-2&\tfrac16&-\tfrac12&1\\ \tfrac16(-3x^3+3x^2+3x+1)&\tfrac12(-3x^2+2x+1)&(-3x+1)&\tfrac16&\tfrac12&1&\tfrac23&0&-2\\ \tfrac16x^3&\tfrac12x^2&x&0&0&0&\tfrac16&\tfrac12&1 \end{array} $$ where one can see that values and derivatives at the $x=0$ match with those at $x=1$ in the next line. See update below for how to interpret this further.

Useful parametrizations are, in my opinion, $$ y(x)=(1-x)\,y(0)+x\,y(1)-\tfrac16x(1-x)(2-x)\,y''(0)-\tfrac16x(1-x)(1+x)\,y''(1) $$ and $$ y(x)=(1-x)^2(1+2x)\,y(0)+x^2(3-2x)\,y(1)+x(1-x)^2y'(0)-x^2(1-x)y'(1) $$


Update: Per bubbas answer above, I now see that the $B_k$ are the pieces of the cubic basis spline $β_3(x)$. So for $x\in[0,1]$, \begin{align} d(x)=B_0(x)&=\beta_3(x+1)=\tfrac16 \beta_3(-1-x)=\tfrac16 [(1-x)^3]\\ c(x)=B_1(x)&=\beta_3(x\quad\;\,)=\tfrac16 [(x+2)^3-4(x+1)^3-6x^3]=\tfrac16 [3x^3-6x^2+4]\\ b(x)=B_2(x)&=\beta_3(x-1)=\tfrac16 [(x+1)^3-4x^3]=\tfrac16 [-3x^3+3x^2+3x+1]\\ a(x)=B_3(x)&=\beta_3(x-2)=\tfrac16 [x^3]\\ \end{align}