# 9.2.5. Spline Curves¶

## 9.2.5.1. References¶

- Computer Graphics, Principle and Practice, Foley et al., Adison Wesley
- http://web.mit.edu/hyperbook/Patrikalakis-Maekawa-Cho/node15.html

## 9.2.5.2. B-spline Basis¶

A nonuniform, nonrational B-spline of order k is a piecewise polynomial function of degree \(k - 1\) in a variable t.

A set of non-descending breaking points, called knot, \(t_0 \le t_1 \le \ldots \le t_m\) defines a knot vector \(T = (t_0, \ldots, t_{m})\).

If each knot is separated by the same distance h (where \(h = t_{i+1} - t_i\)) from its predecessor, the knot vector and the corresponding B-splines are called “uniform”.

Given a knot vector T, the associated B-spline basis functions, \(B_i^k(t)\) are defined as:

where

These equations have the following properties, for \(k > 1\) and \(i = 0, 1, \ldots, n\) :

- Positivity: \(B_i^k(t) > 0\), for \(t_i < t < t_{i+k}\)
- Local Support: \(B_i^k(t) = 0\), for \(t_0 \le t \le t_i\) and \(t_{i+k} \le t \le t_{n+k}\)
- Partition of unity: \(\sum_{i=0}^n B_i^k(t)= 1\), for \(t \in [t_0, t_m]\)
- Continuity: \(B_i^k(t)\) as \(C^{k-2}\) continuity at each simple knot

## 9.2.5.3. B-spline Curve¶

A B-spline curve of order k is defined as a linear combination of control points \(p_i\) and B-spline basis functions \(B_i^k(t)\) given by

In this context the control points are called De Boor points. The basis functions \(B_i^k(t)\) is defined on a knot vector

where there are \(n+k+1\) elements, i.e. the number of control points \(n+1\) plus the order of the curve k. Each knot span \(t_i \le t \le t_{i+1}\) is mapped onto a polynomial curve between two successive joints \(S(t_i)\) and \(S(t_{i+1})\).

Unlike Bézier curves, B-spline curves do not in general pass through the two end control points. Increasing the multiplicity of a knot reduces the continuity of the curve at that knot. Specifically, the curve is \((k-p-1)\) times continuously differentiable at a knot with multiplicity \(p (\le k)\), and thus has \(C^{k-p-1}\) continuity. Therefore, the control polygon will coincide with the curve at a knot of multiplicity \(k-1\), and a knot with multiplicity k indicates \(C^{-1}\) continuity, or a discontinuous curve. Repeating the knots at the end k times will force the endpoints to coincide with the control polygon. Thus the first and the last control points of a curve with a knot vector described by

coincide with the endpoints of the curve. Such knot vectors and curves are known as *clamped*. In
other words, *clamped/unclamped* refers to whether both ends of the knot vector have multiplicity
equal to k or not.

**Local support property**: A single span of a B-spline curve is controlled only by k control
points, and any control point affects k spans. Specifically, changing \(p_i\) affects the
curve in the parameter range \(t_i < t < t_{i+k}\) and the curve at a point where \(t_r < t
< t_{r+1}\) is determined completely by the control points \(p_{r-(k-1)}, \ldots, p_r\).

**B-spline to Bézier property**: From the discussion of end points geometric property, it can be
seen that a Bézier curve of order k (degree \(k-1\)) is a B-spline curve with no internal
knots and the end knots repeated k times. The knot vector is thus

where \(n+k+1 = 2k\) or \(n = k-1\).

## 9.2.5.4. Algorithms for B-spline curves¶

### 9.2.5.4.1. Evaluation and subdivision algorithm¶

A B-spline curve can be evaluated at a specific parameter value t using the de Boor algorithm, which is a generalization of the de Casteljau algorithm. The repeated substitution of the recursive definition of the B-spline basis function into the previous definition and re-indexing leads to the following de Boor algorithm:

where

with

For \(j = k-1\), the B-spline basis function reduces to \(B_l^1\) for \(t \in [t_l, t_{l+1}]\), and \(p_l^{k-1}\) coincides with the curve \(S(t) = p_l^{k-1}\).

The de Boor algorithm is a generalization of the de Casteljau algorithm. The de Boor algorithm also permits the subdivision of the B-spline curve into two segments of the same order.

### 9.2.5.4.2. De Boor Algorithm¶

Let the index l define the knot interval that contains the position, \(t \in [t_l , t_{l+1}]\). We can see in the recursion formula that only B-splines with \(i = l-K, \dots, l\) are non-zero for this knot interval, where \(K = k - 1\) is the degree. Thus, the sum is reduced to:

The algorithm does not compute the B-spline functions \(B_i^k(t)\) directly. Instead it evaluates \(S(t)\) through an equivalent recursion formula.

Let \(d _i^r\) be new control points with \(d_i^1 = p_i\) for \(i = l-K, \dots, l\).

For \(r = 2, \dots, k\) the following recursion is applied:

Once the iterations are complete, we have \(S^k(t) = d_l^k\).

De Boor’s algorithm is more efficient than an explicit calculation of B-splines \(B_i^k(t)\) with the Cox-de Boor recursion formula, because it does not compute terms which are guaranteed to be multiplied by zero.

### 9.2.5.4.3. Knot insertion¶

A knot can be inserted into a B-spline curve without changing the geometry of the curve. The new curve is identical to

when a new knot \(\bar t\) is inserted between knots \(t_l\) and \(t_{l+1}\). The new de Boor points are given by

where

The above algorithm is also known as **Boehm’s algorithm**. A more general (but also more complex)
insertion algorithm permitting insertion of several (possibly multiple) knots into a B-spline knot
vector, known as the Oslo algorithm, was developed by Cohen et al.

A B-spline curve is \(C^{\infty}\) continuous in the interior of a span. Within exact arithmetic, inserting a knot does not change the curve, so it does not change the continuity. However, if any of the control points are moved after knot insertion, the continuity at the knot will become \(C^{k-p-1}\), where p is the multiplicity of the knot.

The B-spline curve can be subdivided into Bézier segments by knot insertion at each internal knot until the multiplicity of each internal knot is equal to k.