# B-splines

This is an edited section from my thesis “Solving Poisson’s equation with Dataflow computing”. It might be a bit more formal than most of my other posts.

Splines are a mathematical concept which can be used to define smooth (or less smooth) curves and surfaces.

In this article, I’ll cover some mathematical background.

## Introduction to splines

Splines (or spline functions) are also called piecewise polynomial. The reason is illustrated by the following definition:

**Definition**: *A spline or piecewise polynomial function of degree $p$ is a function $f:R→R$, such that there exist $ξ_{0}<ξ_{1}<...<ξ_{m}$ and polynomials $p_{0}$, $p_{1}$, …, $p_{m−1}$ with degree at most $p$ such that $f(x)=p_{k}(x)$ if $x∈(ξ_{k},ξ_{k+1})$, and either $f(x)=p_{k}(x)$ or $f(x)=p_{k+1}(x)$ when $x=ξ_{k+1}$. The values $ξ_{0}$, $ξ_{1}$, …, $ξ_{m}$ are called breaks.*

In order to define spline spaces, we introduce the concept of a knot vector:

**Definition**: *A knot vector $Ξ$ is a non-decreasing vector $(ξ_{0},ξ_{1},...,ξ_{m})$. The values $ξ_{0}$, $ξ_{1}$, …, $ξ_{m}$ are called knots, and the number of times that a knot $ξ_{k}$ occurs in the knot vector is called the multiplicity $μ_{k}$ of the knot.*

We can now define a space of splines, where the continuity along the breaks is defined by the multiplicities of the knots:

**Definition**: *The spline space $S_{p}(Ξ)$ of degree $p$ for a knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{m})$ is defined as the space of splines $s$ of order $p$, with breaks $ξ_{0}$, $ξ_{1}$, …, $ξ_{m}$ and support on a subset of $[ξ_{0},ξ_{m}]$. Furthermore, we require that $s$ is $C_{p−μ_{k}}$-continuous on $ξ_{k}$, for $k=0$, $1$, …, $m$.*

To ensure that $S_{p}(Ξ)$ is well-defined and continuous, we demand that $Ξ$ is a knot vector of degree $p$.

**Definition**: *A knot vector is called a knot vector of degree $p$ if all knots have a multiplicity of at most $p$.*

It should be noted that the requirement that $s$ is continuous implies that $s(ξ_{0})=0$ and $s(ξ_{m})=0$. Sometimes, this is not desirable. To remove this restriction, the concept of an open knot vector of degree $p$ is introduced:

**Definition**: *A knot vector is called an open knot vector of degree $p$ when the first and last knot have multiplicity $p+1$, and all other knots have a multiplicity of at most $p$.*

It should be noted that, according to these definitions, an open knot vector of degree $p$ is **not** a knot vector of degree $p$. We will work with knot vectors with uniformly distributed knots on the interval $[0,1]$.

**Definition**: *A knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{m})$ is called a uniform knot vector when $ξ_{k}−ξ_{k−1}=c$ for all $k=1,2,...,m$ and some constant $c>0$. A knot vector of the same form is called a uniform open knot vector of degree $p$ when $ξ_{0}$ and $ξ_{n}$ have multiplicity $p+1$, and $ξ_{k+1}−ξ_{k}=c$ for $k=p+1,p+2,...,m−p$ and some constant $c>0$.*

## B-splines

The term ‘B-spline’ is an abbreviation for ‘basis spline’. B-splines were introduced as basis functions for the spline space. However, the CAD community has adopted the term to refer to splines which are represented in terms of these basis functions. This has caught on, and it has become common to call the basis functions ‘B-spline basis functions’. This is the terminology that will be used in this document as well.

The recursive definition that is commonly used to introduce B-splines was presented in [2] by de Boor.

**Definition**: *For $d≥1$, a $d$-dimensional B-spline curve $s:R→R_{d}$ is defined as a linear combination of B-spline basis functions $N_{0,p},N_{1,p},...,N_{n−1,p}:R→R$:*

*The image $s$ is a one-dimensional subset of $R_{d}$. It is common to identify $s$ with this subset and refer to both as a B-spline curve. The coefficients $c_{0},c_{1},...,c_{n−1}∈R_{d}$ are called control points, and the B-spline basis functions $N_{0,p},N_{1,p},...,N_{n−1,p}:R→R$ are defined by the Cox-de-Boor recursion formula. The following version is from [3]:*

*where*

*$p$ is called the polynomial degree, and $Ξ=(ξ_{0},ξ_{1},...,ξ_{n+p})$ is a knot vector of degree $p$*

The index $p$, denoting the polynomial degree, will often be omitted when its value is irrelevant or clear from the context, so that $N_{i}$ denotes the same basis function as $N_{i,p}$.

The next image shows the B-spline basis functions associated to the uniform knot vector $Ξ=(0,61 ,31 ,21 ,32 ,65 ,1)$ for polynomials orders $p=0,1,2,3$:

The following characterization of B-spline basis functions is due to Curry and Schoenberg in [4] and [5]:

**Theorem (Curry-Schoenberg)**: *The set of B-spline basis functions $N_{p,0},N_{p,1},...,N_{p,n}:R→R$ associated to the knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{n+p})$ is a basis for the spline space $S_{p}(Ξ)$. Moreover, the B-splines basis functions have minimal support: for any $f∈S_{p}(Ξ)$ with $f=0$ we have that there exists a basis function $N_{k}$ with $supp(N_{k})⊆supp(f)$.*

For a proof that $N_{p,0},N_{p,1},...,N_{p,n}$ is a basis of $S_{p}(Ξ)$, see [6], chapter 1, theorem 1.8 on page 8, or [4]. For a proof that the B-spline basis functions have minimal support, see [5].

In computer-aided design (CAD), it is convenient to have continuous curves that interpolate the first and last control point. This means that $s(0)=c_{0}$, and $s(1)=c_{n−1}$ if $c_{n−1}$ is the last control point. This can be achieved by using an open knot vector to define the B-spline basis functions. The effect of taking the open knot vector $Ξ=(0,0,0,51 ,52 ,53 ,54 ,1,1,1)$ of degree 2 is illustrated in the next image.

It can be seen that the first and the last B-spline basis functions $N_{0}$ and $N_{6}$ are discontinuous at the first knot $ξ_{0}=0$, and the last knot $ξ_{7}=1$, since $N_{0}(ξ)=0$ for $ξ<0$, but $N_{0}(0)=1$. Likewise, we have $lim_{ξ→1}N_{6}ξ=1$, but $N_{6}(ξ)=0$ for $ξ≥1$. However, since $s$ is only defined on $[0,1)$, $s$ is still continuous. In practice, we will extend the domain of $s$ to $[0,1]$ by the following convention.

**Convention**: *Unless indicated otherwise, the knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{n+p})$ used to define B-spline basis functions of degree $p$, is an open knot vector that satisfies $ξ_{p}=0$, $ξ_{n}=1$. Moreover, the domain of B-spline curves will be taken as $[0,1]$, with the convention*

This convention ensures that B-spline curves are continuous mappings from $[0,1]$ to $R_{d}$. In code, this is achieved by including a special check for the last basis function: If the last basis function is evaluated at the last knot of an open knot vector, it should evaluate to one (instead of zero).

**Theorem**: *Suppose that $Ξ=(ξ_{0},ξ_{1},...,ξ_{n+p})$ is a (not necessarily open) knot vector of degree $p$. Then the basis functions $N_{0},N_{1},...,N_{n−1}$ of order $p$ associated to $Ξ$, and the B-spline curve $s$ as defined in $(1)$ satisfy the following properties:*

*$N_{0,p}$, $N_{1,p}$, …, $N_{n−1,p}∈S_{p}(Ξ)$**If the derivative of a B-spline basis function $N_{i,p}$ exists at a point $ξ$, it is given by*

*The B-spline basis functions satisfy $∑_{i=0}N_{i}=1$ and $∑_{i=0}N_{i}=0$.**For a B-spline basis function $N_{i,p}$ we have $supp(N_{i,p}) =supp(N_{i,p}) =[ξ_{i},ξ_{i+p+1}]$. Moreover $ξ_{i}∈supp(N_{i,p})$ iff $p=0$ or $i=0$ and $Ξ$ is an open knot vector of degree $p$.**$∫N_{i,p}(ξ)N_{j,p}(ξ)dξ$, $∫N_{i,p}(ξ)N_{j,p}(ξ)dξ$, $∫N_{i,p}(ξ)N_{j,p}(ξ)dξ$, and $∫N_{i,p}(ξ)N_{j,p}(ξ)dξ$ are all zero whenever $∣i−j∣>p$. It follows that*

*The B-spline basis functions satisfy $0≤N_{i,p}≤1$ and $−hp ≤N_{i,p}≤hp $, where $h:=min_{i∈{1,2,...,n}}{ξ_{i}−ξ_{i−1}:ξ_{i−1}=ξ_{i}}$ is the smallest nonzero difference between two consecutive knots.**On any point in the $R$, there are at most $p+1$ nonzero basis functions. More specifically, there are $p+1$ nonzero basis functions on $ξ∈(ξ_{p},ξ_{n})$, whenever $ξ∈Ξ$ is not a knot.**If $Ξ$ is an open knot vector, $s$ interpolates the first and last control points: $s(0)=c_{0}$, $s(1)=c_{n−1}$.*

**Proof**: A sketch of the proofs is given. The interested reader can try to prove the properties more rigorously, or look at proofs given in [2], [6] or [7]. The first property follows from the Curry-Schoenberg theorem. The second property can be proved by taking the derivative of the recursive definition of the B-spline basis functions. Using the definition of a B-spline basis function, it can be proved by induction on the degree $p$ that $∑_{i=0}N_{i,p}(ξ)=1$ should be treated differently, since the value is defined by the convention that is introduced). By taking the derivative of both sides, it follows that $∑_{i=0}N_{i,p}=0$, and the third property follows. The fourth property follows from the definition of the B-spline basis functions by induction (except for the case $i=n−1$, which follows from the convention we use). The fifth property follows from the fourth. The sixth property follows from the second and third property. The seventh property follows from the fourth. For the eighth property, we can prove that $N_{p−j,j}(0)=1$ for $0≤j≤p$ by using the definition of the B-spline basis functions and induction on $j$. Likewise we have $N_{n−1,p}(1)=1$ by the used convention. From the third property we have $∑_{i=0}N_{i}=1$, so that it follows that $s(0)=c_{0}$, $s(1)=c_{n−1}$.

$□$

Now, the problem of finding an interpolating B-spline is considered. Suppose that we define a one-dimensional B-spline $f(ξ)=j=0∑n−1 f_{j}N_{j}(ξ)$ and we want to choose the control points $f_{0}$, $f_{1}$, …, $f_{n−1}$ such that $f(ξ_{0})=y_{0}$, $f(ξ_{1})=y_{1}$, …, $f(ξ_{m−1})=y_{m−1}$. This is called the *interpolation problem*. We have the following theorem:

**Theorem (Whitney-Schoenberg)**: *For basis functions $N_{i_{0}}$, $N_{i_{1}}$, …, $N_{i_{n−1}}$ with $i_{0}<i_{1}<...<i_{n−1}$ which are a subset of the B-spline basis functions $N_{0}$, $N_{1}$, … associated to a not necessarily open knot vector $Ξ$, and interpolations points $ξ_{0}<ξ_{1}<...<ξ_{m−1}$, the interpolation matrix $J$ is nonsingular if and only if $n=m$, and*

See [6], section 3.3, theorem 3.2 on page 19 for a proof.

Given a knot vector, it is not immediately obvious how we can choose interpolation points that satisfy the conditions of the Whitney-Schoenberg theorem. For this purpose, one can define the Greville abscissae:

**Definition**: *For a knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{m−1})$ of degree $p$, the Greville abscissae $x_{0},x_{1},...,x_{m−p−1}$ are defined as*

**Theorem**: *For B-spline basis functions $N_{0,p},N_{1,p},...,N_{n−1,p}$ associated to an open knot vector $Ξ=(ξ_{0},ξ_{1},...,ξ_{n+p})$ of degree $p$ we have*

**Proof**: Suppose that $ξ_{k}=x_{k}$. Then we have $ξ_{k}=ξ_{k+1}=...=ξ_{k+p}$. So, the knot $ξ_{k}$ has multiplicity $p+1$.

If $k=0,n−1$, we have that the multiplicity of $ξ_{k+1}$ is at most $p$. So, we can’t have $ξ_{k}=ξ_{k+1}=...=ξ_{k+p}$ or $ξ_{k+1}=ξ_{k+2}=...=ξ_{k+p+1}$ and both inequalities are strict, so we have $x_{k}∈(ξ_{k},ξ_{k+p+1})$. By property 4, it follows that $N_{k}(x_{k})=0$.

If $k=0$, then$ξ_{k}$ is the first knot, and has multiplicity $p+1$, so it follows that $ξ_{k}=ξ_{k+1}=...=ξ_{k+p}=0<ξ_{p+1}$. So it follows that $x_{k}=0$, and we have $N_{0}(0)=1$ by property 4.

$□$

This means that the Greville abscissae are suitable as a standard choice for interpolation points for B-splines.

### References

[1] C. De Boor. Splines as Linear Combinations of B-splines. A Survey.

[2] Carl de Boor. On calculating with B-splines.

[3] Carl de Boor. B(asic)-Spline Basics.

[4] H. B. Curry and Schoenberg I. J. On spline distributions and their limits: The Pólya distribution functions.

[5] H. B. Curry and Schoenberg I. J. On Pólya frequency functions IV: The fundamental spline functions and their limits.

[6] Tomas Sauer. Splines in Industrial Applications.

[7] Les Piegl and Wayne Tiller. The NURBS Book.