Вы находитесь на странице: 1из 158

Contents

1 Introduction 5
1.1 Introduction to Computer Aided Geometric Design . . . . . . 5
1.2 Summary of basic mathematical formulations . . . . . . . . . 7
1.2.1 Explicit form: y = f(x) . . . . . . . . . . . . . . . . . 7
1.2.2 Implicit form: f(x, y) = 0 . . . . . . . . . . . . . . . . 8
1.2.3 Parametric form: x = x(t) , y = y(t) . . . . . . . . . 9
1.3 Surface descriptions . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.1 Explicit form: z = f(x, y) . . . . . . . . . . . . . . . . 10
1.3.2 Implicit form: F(x, y, z) = 0 . . . . . . . . . . . . . . . 10
1.3.3 Parametric form: . . . . . . . . . . . . . . . . . . . . . 10
1.4 Curve and Surface Modelling . . . . . . . . . . . . . . . . . . . 11
1.4.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.2 Parametric curve representation . . . . . . . . . . . . . 15
1.4.3 Functional forms: . . . . . . . . . . . . . . . . . . . . . 16
1.4.4 Parametric surface representation . . . . . . . . . . . . 17
1.5 Aims of the course . . . . . . . . . . . . . . . . . . . . . . . . 18
1.5.1 Part 1. Algorithms for CAD: . . . . . . . . . . . . . . 18
1.5.2 Part 2. Curve and Surface Modelling: . . . . . . . . . . 18
2 Polynomial interpolation 27
2.1 Explicit power basis . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Lagrange basis . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2.3 Divided dierences and Newton interpolation . . . . . . . . . 30
2.3.1 Denition . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.3.2 Leibniz formula . . . . . . . . . . . . . . . . . . . . . . 32
2.3.3 The Divided Dierence Table . . . . . . . . . . . . . . 37
2.3.4 Nested Multiplication . . . . . . . . . . . . . . . . . . . 39
2.3.5 Derivative evaluation . . . . . . . . . . . . . . . . . . . 40
2.4 Hermite interpolation . . . . . . . . . . . . . . . . . . . . . . . 43
2.5 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
1
2 CONTENTS
3 Splines 49
3.1 The linear space S
k
(P
l
) . . . . . . . . . . . . . . . . . . . . . . 49
3.2 Interpolating splines . . . . . . . . . . . . . . . . . . . . . . . 51
3.3 Choosing the slopes . . . . . . . . . . . . . . . . . . . . . . . . 53
3.4 Constructing the cubic spline . . . . . . . . . . . . . . . . . . 54
3.5 The matrix form for the cubic interpolatory spline . . . . . . . 55
3.6 Specication of end conditions . . . . . . . . . . . . . . . . . . 56
3.6.1 Background to the natural cubic spline . . . . . . . . . 57
3.7 Solving the linear cubic spline equations . . . . . . . . . . . . 61
3.8 Tensioned splines: -splines . . . . . . . . . . . . . . . . . . . 63
3.9 Weighted -splines . . . . . . . . . . . . . . . . . . . . . . . . 66
3.9.1 The eect of the weights . . . . . . . . . . . . . . . . . 68
3.10 Cardinal spline basis . . . . . . . . . . . . . . . . . . . . . . . 68
3.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4 B-spline basis functions 71
4.1 Truncated power functions . . . . . . . . . . . . . . . . . . . . 72
4.1.1 A formula for M
i,k
(t): . . . . . . . . . . . . . . . . . . 74
4.2 B-spline recursion formula . . . . . . . . . . . . . . . . . . . . 79
4.3 The evaluation of B-spline functions . . . . . . . . . . . . . . . 82
4.4 Derivative evaluation for B-splines . . . . . . . . . . . . . . . . 88
4.4.1 Expressing the rth derivative of a B-spline function as
a B-spline function . . . . . . . . . . . . . . . . . . . . 91
4.5 Coincident knots in B-spline basis functions . . . . . . . . . . 92
4.6 Extending the linear space S
k
(P
l
) . . . . . . . . . . . . . . . . 96
4.7 Forming a basis using B-splines . . . . . . . . . . . . . . . . . 96
4.7.1 Construction of a knot sequence from a breakpoint se-
quence . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
5 B-spline interpolation 101
5.1 Setting up the equations . . . . . . . . . . . . . . . . . . . . . 101
5.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
5.3 Periodic B-spline interpolation . . . . . . . . . . . . . . . . . . 105
5.4 Uniqueness for B-spline interpolation . . . . . . . . . . . . . . 113
5.5 Solving the B-spline interpolation equations . . . . . . . . . . 116
5.6 Least squares approximation . . . . . . . . . . . . . . . . . . . 116
5.6.1 B-spline least squares approximation . . . . . . . . . . 119
5.6.2 Least squares approximation with weights . . . . . . . 121
5.6.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 122
CONTENTS 3
6 Bezier basis functions and approximations 123
6.1 de Casteljau recursion . . . . . . . . . . . . . . . . . . . . . . 126
6.2 Approximations and control polygons . . . . . . . . . . . . . . 127
6.2.1 Control polygons . . . . . . . . . . . . . . . . . . . . . 129
6.3 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7 Conversions between representations 133
7.1 Interpolating cubic spline to B-spline . . . . . . . . . . . . . . 133
7.1.1 Alternative method . . . . . . . . . . . . . . . . . . . . 136
7.2 Knot insertion . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
7.2.1 Single knot insertion . . . . . . . . . . . . . . . . . . . 141
7.2.2 Multiple knot insertion . . . . . . . . . . . . . . . . . . 144
7.2.3 The Manseld-Cox-de Boor recursion formula revisited 147
7.2.4 Subdivision . . . . . . . . . . . . . . . . . . . . . . . . 149
7.3 B-spline to Bezier conversion . . . . . . . . . . . . . . . . . . . 150
7.4 Appendix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
7.5 Matrix representations . . . . . . . . . . . . . . . . . . . . . . 153
7.6 Conversions in matrix form . . . . . . . . . . . . . . . . . . . 155
7.6.1 Interval conversion for explicit polynomial forms . . . . 156
7.6.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . 158
4 CONTENTS
Chapter 1
Introduction
1.1 Introduction to Computer Aided Geo-
metric Design
Computer Aided Geometric Design (CAGD) is concerned with the rep-
resentation of curves and surfaces that arise when these objects have
to be processed by a computer.
Designing curves and surfaces plays an important role in the construc-
tion of a variety of products such as:
car bodies, ship hulls, airplane fuselages and wings, propeller
blades, shoe insoles, bottles
Also used in the description of geological, physical and medical phe-
nomena.
Before the advent of computers, these design problems were dealt with
by means of descriptive geometry.
A surface was dened by a set of curves, usually plane sections plus
some characteristic feature lines. This information was sucient
to manufacture templates, and the templates were used to produce
wooden master models.
The nal stamps and dies were obtained from the master models by
means of copymilling.
In the late fties it became possible to drive these milling machines by
numerical control, that is so that the machining instructions could be
generated by a computer program.
5
6 CHAPTER 1. INTRODUCTION
In order to fully exploit this capability, it was necessary to store the
surface denition in a computer-compatible form. The problem thus
arose how to translate existing surface denitions into a computerized
format, i.e how to design a mathematical model.
As an initial step a surface is digitized, i.e broken down into a large
number of point coordinates. This information can be obtained from a
physical model or from a drawing board.
There are many techniques available for extracting a mathematical
model from this discrete point information (these will be the subject of
the curve and surface modelling module).
It was also realised that the classical surface descriptions (model,
drawing board) could be abolished altogether, since already the con-
ceptual design phases could be carried out by computer, i.e by CAD.
Both CAD philosophies: (a) starting from existing forms, and (b) using
CAD for conceptual design (styling), require their own CAGD methods.
Generally speaking it is possible to associate the name of Coons with
(a) and that of Bezier with (b).
A dierent area requiring the use of CAGD methods comes from the
natural sciences. Here a common problem is to t a surface to data
that are obtained from measurements to experiments.
A typical example is geography: temperatures are measured at certain
locations and one wants a temperature distribution for the whole region.
In this class of problems there is clearly no design aspect, but a spe-
cial set of algorithms has been devised for these so called scattered
data interpolation problems. The key words here are Shepard and
triangulation methods.
1.2. SUMMARY OF BASIC MATHEMATICAL FORMULATIONS 7
1.2 Summary of basic mathematical formula-
tions
There are various ways of representing curves:
1.2.1 Explicit form: y = f(x)
Example y = mx + c, the equation of a straight line where m is the
gradient and c the intercept on the y-axis. This is an explicit equation
for y allowing us to determine y given a value for x.
Note however that vertical slopes cannot be accomodated by this type
of equation, y is a single valued function of x.
This form cannot cope with vertical or near vertical tangents.
Curves of this form are often called functional curves.
8 CHAPTER 1. INTRODUCTION
1.2.2 Implicit form: f(x, y) = 0
Example, the straight line representation, ax + by + c = 0. Here a
vertical line can be accomodated by setting b = 0.
However, now y is not given as an explicit function of x, requiring an
equation to be solved in order to compute the y value from a given x
value.
Example: the equation x
2
+y
2
r
2
= 0 is an implicit equation for the
circle. Here to obtain the explicit equation we must divide the curve
into two segments, y = +

r
2
x
2
(upper half) and y =

r
2
x
2
(lower half).
This is not a particularly desirable thing to have to do in a computer
program.
Generally it is easy to determine whether a given point lies on the
curve but not so easy to compute directly points on the curve (we must
reduce it to an explicit equation in x or y).
A particular class of plane curves that are commonly represented in
implicit form are the conic sections (ellipse, parabola and hyperbola).
1.2. SUMMARY OF BASIC MATHEMATICAL FORMULATIONS 9
1.2.3 Parametric form: x = x(t) , y = y(t)
Example, the straight line going through the points (x
1
, y
1
), (x
2
, y
2
) is
given by
x = x
1
+ t(x
2
x
1
) , y = y
1
+ t(y
2
y
1
).
The coordinates x and y are treated symmetrically. Each one is de-
scribed as functions of a parameter t, so that x = x(t) , y = y(t).
Example: the circle x
2
+y
2
1 = 0 can be expressed parametrically by
the equations
x = cos t , y = sint , t [0, 2]
We can plot points on the curve by evaluating x(t) and y(t) for succes-
sive values of t.
Portions of the curve can be plotted simply by restricting the parameter
to vary over a particular range within the original limits.
Tangents and normals can be computed without diculty.
10 CHAPTER 1. INTRODUCTION
1.3 Surface descriptions
1.3.1 Explicit form: z = f(x, y)
Example: z = a
1
+a
2
x +a
3
y represents a plane. If a
2
= 0, the plane is
parallel to the x-axis and if a
3
= 0, the plane is parallel to the y-axis.
Example: the equations z = xy+x
2
and z = 1+2x
2
+2y
2
x
2
y
1
3
y
3
represent polynomial surfaces, (g 1.1).
1.3.2 Implicit form: F(x, y, z) = 0
Example: x
2
+ y
2
+ z
2
1 = 0 represents the unit sphere about the
origin.
Note the ease with which one can tell whether a given point is on
(F(x, y, z) = 0) inside (F(x, y, z) < 0) or outside (F(x, y, z) > 0) the
sphere in this representation.
However, to compute points we must obtain z as an explicit function
of x and y, z = f(x, y). For the sphere we have the upper and lower
hemispheres:
z =
_
1 x
2
y
2
1.3.3 Parametric form:
x = x(u, v) , y = y(u, v) , z = z(u, v), where u and v are independent variables
(or parameters).
Example: the unit sphere has parametric representation
x = x(, ) = sin cos ,
y = y(, ) = sin sin,
z = z(, ) = cos ,
where 0 and 0 < 2.
Points on a parametric surface are easy to compute as are tangents and
normals.
A section of a given parametric surface can be easily dened by choosing
a range for u and v.
It is not easy to determine whether a given point lies on the surface,
or, when the surface is closed, whether a point is inside or outside.
1.4. CURVE AND SURFACE MODELLING 11
1.4 Curve and Surface Modelling
There are requirements of the designer who must use these methods to
build and modify models of shapes.
The modelling system must support a class of shapes that is matched
to the designers application.
To design a mechanical part for a typewriter, shapes limited to plane-
faced polyhedra and sections of cylinders may be adequate. On the
other hand, to design a car body, we need a more versatile selection of
shapes and techniques to keep the surface smooth.
For interactive shape-modelling system, more requirements appear.
The design process is almost always iterative: the designer carefully
observes the shape he (for he read he/she) has specied to see what
it looks like, to see how it performs and to formulate changes that
may be required. Then he expresses the modications he wants to an
interactive program.
The rst step of this process requires us to generate images of shapes
that have sucient realism to communicate to the designer the shape
information needed to evaluate the design.
The second step is more dicult, because the designer must express
the required changes in a limited vocabulary of modications that the
mathematical shape representations support.
Ideally, the designer need change only a small number of parameters of
the shape model to achieve the desired result.
He should be suciently familiar with the shape representation to be
able to estimate which parameters need changing by how much and to
anticipate the shape changes that will result.
Problem for selecting a shape representation:
If only a small set of parameters is provided, the designers task is
simplied but the range of shapes that can be represented is likely to
be fairly limited.
If there are many parameters, the designer can achieve more varied and
accurate models of his design but may be overwhelmed by the exibility
oered.
12 CHAPTER 1. INTRODUCTION
It is the case however that some shape representations accommodate a
variable number of parameters: the designer can use as many or as few
as necessary to create an acceptable model.
In addition to the users requirements any scheme for modelling curves
and surfaces must be mathematically tractable, computationally con-
venient, and economical in storage.
Computational needs sometimes conict with those of the user.
Researchers in this area are still trying to design mathematical repre-
sentations of curves and surfaces that match a designers feel for how
shapes should behave.
The requirements of the user and the computer combine to suggest a
number of properties that our representations must have.
Some of the important properties for designing curves and surfaces are:
1./ Control points: A common way to control the shape of a curve
interactively is to locate points through which the curve must pass
(g 1.2) or points that control the curvess shape in a predictable
way. These shape parameters are often called control points.
2./ Multiple values: In general, a curve is not a graph of a single
valued function of a coordinate, irrespective of the choice of coor-
dinate system (g 1.3). We need to be able to deal with vertical
tangents, for example, in constructing closed curves.
3./ Explicit representations: It is important to be able to evaluate
easily and eciently points on curves and surfaces.
4./ Axis independence: The shape of an object must not change
when the control points are measured in a dierent coordinate
system. We need curve and surface formulations that are invariant
under the class of transformations commonly used in CAD systems
(these include translations, rotations and scalings).
1.4. CURVE AND SURFACE MODELLING 13
5./ Global or local control: As a designer manipulates a control point,
a curve may change shape only in the region near the control
point, or it may change shape throughout (g 1.4). This latter
behaviour, called global control may be annoying to the designer
trying to make ne adjustments to just one portion of the curve.
6./ Variation-diminishing property: Some mathematical representa-
tions have an annoying tendency to amplify, rather than smooth,
any small irregularities in the shape outlined by the control points
(g 1.5a).
Others, possessing a variation-diminishing property, always
smooth the designers control points (g 1.5b). In this case the
curve will never cross an arbitrarily chosen straight line more of-
ten than the control polygon.
7./ Versatility: A curve representation that allows only a limited
variety shapes is likely to frustrate a designer.
A framework that provides only arcs of circles, for example, lacks
sucient versatility to model most designs. More exible tech-
niques allow the designer to control the versatility of a curve rep-
resentation, often by adding or removing control points.
8./ Order of continuity: A complex shape is usually not modelled by
a single curve, but by several curves pieced together end-to-end.
A shape that cannot be described by a single curve can often be de-
scribed by several curves joined together.
When creating joints, the designer often wants to control the order of
continuity at the joint. (g 1.6).
Zero-order continuity means simply that the two curves meet; rst order
continuity requires the curves to be tangent at the point of intersection;
second order continuity requires that curvatures be the same.
14 CHAPTER 1. INTRODUCTION
1.4.1 Conclusion
It is with consideration of all these requirements (and others) that
has lead to the very wide usage of parametric form for the rep-
resentation of curves and surfaces in CAD systems.
This formulation is particularly suited to the construction or syn-
thesis of geometry to meet constraints imposed by the user or
designer.
These constraints may be either quantative or aesthetic. They are
presented to the user in terms of what are sometimes called han-
dles, that is those entities which the user has at his/her disposal
for manipulation leading to the desired geometric result.
1.4. CURVE AND SURFACE MODELLING 15
1.4.2 Parametric curve representation
p(t) =
n

i=1
a
i

i
(t) , ()
The curve is expressed as a linear combination of scalar functions of
the parameter t, with point valued coecients.
One can think of the parameter as a kind of time variable, as t varies
between two limits t
0
and t
1
say, a point moves along the curve from
p(t
0
) to p(t
1
).
The
i
are called basis functions and it is by varying the choice of these
functions that we are able to generate curve representations with vary-
ing characteristics.
For computational convenience these functions are usually simple poly-
nomial functions of t. The degree of the polynomials used controls the
degree of the curve.
The handles in this representation are the coecients a
i
. Since a
computer aided design system is intended for use by designers rather
than mathematicians it is important that these coecients have some
signicance which is intuitively clear to the user.
16 CHAPTER 1. INTRODUCTION
1.4.3 Functional forms:
We can think of () as dening three independent functional curve forms
obtained by concentrating on the x, y and z components of p (g 1.7,
just x and y here):
p(t) = (p
x
(t), p
y
(t), p
z
(t)),
where
p
x
(t) =
n

i=1
a
i
x

i
(t),
p
y
(t) =
n

i=1
a
i
y

i
(t),
p
z
(t) =
n

i=1
a
i
z

i
(t).
Interpreting p in these terms is important for our purposes as we shall
begin by developing the mathematics and the algorithms with respect
to the functional curve case.
These can then be extended to deal with the parametric case (essen-
tially simply by calling our functional algorithm three times, for the
x, y and z components of the curve).
1.4. CURVE AND SURFACE MODELLING 17
1.4.4 Parametric surface representation
x(s, t) =
m

i=1
n

j=1
a
ij

i
(s)
j
(t)
Here there are two independent parameters s and t dening the surface.
Also have a matrix of coecients a
ij
controlling the shape of the surface
(the surface handles).
The basis functions in this case,
i
(s)
j
(t), are simply products of the
curve basis functions. The degree of these functions in s and t determine
the degree of the surface in the two parameters.
It is possible to generate surfaces satisfying certain constraints by form-
ing appropriate equations for the a
ij
. Complex surfaces can be formed
by piecing together many of these simple surfaces (g 1.8).
18 CHAPTER 1. INTRODUCTION
1.5 Aims of the course
To develop the mathematical basis and numerical algorithms that are
at the heart of a good curve and surface modelling system.
The course is split into two parts:
1.5.1 Part 1. Algorithms for CAD:
Concentrates on the various types of basis functions used and the functional
forms of the corresponding curve representations, as well as developing many
of the core algorithms needed for the manipulation of the parametric curves
and surfaces used in CAD.
1.5.2 Part 2. Curve and Surface Modelling:
Extends the methods and algorithms from part 1 to deal with the para-
metric case and introduces the techniques for constructing a wide variety of
curve and surface forms currently used in CAGD.
1.5. AIMS OF THE COURSE 19
(a)
20 CHAPTER 1. INTRODUCTION
(b) Two polynomial surfaces:(a)z = xy
2
+x
2
, z = 1+2x
2
+
2y
2
x
2
y
1
3
y
3
Figure 1.1:
1.5. AIMS OF THE COURSE 21
Figure 1.2: Curve through interpolated points
Figure 1.3: Multi-valued function with respect to any coordinate system
22 CHAPTER 1. INTRODUCTION
Figure 1.4: Local and global control
Figure 1.5: Variation diminishing property, (a) no (b) yes
1.5. AIMS OF THE COURSE 23
Figure 1.6: Order of continuity (a) zero=point (b) rst=tangent (c) sec-
ond=curvature
Figure 1.7: Multi-segment curve
24 CHAPTER 1. INTRODUCTION
Figure 1.8: Two parametric functions x(u) and y(u) with the cross plot y vs
x
1.5. AIMS OF THE COURSE 25
Figure 1.9: Multi-patch surface
26 CHAPTER 1. INTRODUCTION
Chapter 2
Polynomial interpolation
Notation:

n
will denote the linear space of polynomials of order n (i.e degree n 1).
_
n
i
_
=
n!
i! (ni)!
is the combinatorial coecient.
For a given function g(x), g
(r)
(x) will denote the r-th derivative of g at x.
We begin by asking if
1
, . . . ,
n
are distinct points (called the abscissa) and
y
1
, . . . , y
n
given data (also called the ordinates), does there exist a polynomial
p
n
(x)
n
for which p
n
(
i
) = y
i
, i = 1, . . . , n? The answer is yes there does,
and moreover the polynomial is unique.
2.1 Explicit power basis
We can write down a system of equations for the interpolation problem using
the explicit power basis, that is we assume that the solution is written in the
form
p
n
(x) = a
0
+ a
1
x + . . . + a
n1
x
n1
.
Then the conditions p
n
(
i
) = y
i
for i = 1, . . . , n are equivalent to the n
equations
a
0
+ a
1

1
+ . . . + a
n1

n1
1
= y
1
,
a
0
+ a
1

2
+ . . . + a
n1

n1
2
= y
2
,
.
.
.
a
0
+ a
1

n
+ . . . + a
n1

n1
n
= y
n
,
27
28 CHAPTER 2. POLYNOMIAL INTERPOLATION
or in matrix form
V a = y ,
where
V =
_
_
_
_
_
_
1
1

2
1
. . .
n1
1
1
2

2
2
. . .
n1
2
.
.
.
1
n

2
n
. . .
n1
n
_
_
_
_
_
_
, a =
_
_
_
_
_
a
0
a
1
.
.
.
a
n1
_
_
_
_
_
, y =
_
_
_
_
_
_
y
1
y
2
.
.
.
y
n
_
_
_
_
_
_
.
The fact that the abscissa are distinct implies that V has an inverse (implying
uniqueness), leading to the solution a = V
1
y. Although it is quite possible
to solve the interpolation problem by solving this system of equations it is
not to be recommended. The coecient matrix V , called the Vandermonde
matrix, is known to be ill-conditioned (in particular its determinant is very
small) and hence solutions can be subject to severe roundo error. The fault
can be pinned on the particular basis used and hence we look for another
basis to solve the problem. For example, the Lagrange basis.
2.2 Lagrange basis
To show more easily that p
n
(x) exists we construct a polynomial of order n
satisfying the conditions using the so called Lagrange basis functions. These
are dened as follows:

i,n
(x) =
n

j=1,j=i
(x
j
)
(
i

j
)

n
i = 1, . . . , n.
Each
i,n
(x) is a polynomial of order n and together they form a basis for
n
.
In addition they have the important property that

i,n
(
k
) =
ik
=
_
1 i = k
0 i = k
.
Figure 2.1 illustrates the nature of these basis functions.
2.2. LAGRANGE BASIS 29
Figure 2.1: General form of Lagrange basis function
Using these basis functions we can write down immediately the polynomial
p
n
(x) interpolating the points y
i
at the values
i
for i = 1, . . . , n, it is
p
n
(x) =
n

i=1
y
i

i,n
(x).
Clearly p
n
(x) satises the conditions of the problem,
p
n
(
j
) =
n

i=1
y
i

i,n
(
j
) = y
j
, j = 1, . . . , n.
as required. To show that p
n
(x) so constructed is unique we note that if
q
n
(x)
n
is another polynomial such that q
n
(
i
) = p
n
(
i
) for all i, then
r
n
(x) = p
n
(x) q
n
(x) is also a polynomial of order n which vanishes at
the n distinct points
1
, . . . ,
n
. Hence it must vanish everywhere, i.e it is
identically zero and so p = q.
Example:
The Lagrange basis functions for interpolation at
1
= 0,
2
= 1,
3
= 3 are
as follows:

1,3
(x) =
(x 1)(x 3)
(0 1)(0 3)
=
1
3
(x
2
4x + 3),

2,3
(x) =
(x 0)(x 3)
(1 0)(1 3)
=
1
2
(x
2
3x),

3,3
(x) =
(x 0)(x 1)
(3 0)(3 1)
=
1
6
(x
2
x).
30 CHAPTER 2. POLYNOMIAL INTERPOLATION
Figure 2.2 shows these basis functions.
Figure 2.2: Lagrange basis functions on (0, 1, 3)
Given values y
1
, y
2
, y
3
at 0, 1, 3 the interpolating polynomial is then given by
p
3
(x) = y
1
1
3
(x
2
4x + 3) y
2
1
2
(x
2
3x) + y
3
1
6
(x
2
x).
Although the Lagrange form of the interpolating polynomial is quite elegant
and easy to write down it is not a very ecient form for evaluation purposes.
Another and more useful representation, computationally speaking, is given
by the so called Newton form.
2.3 Divided dierences and Newton interpo-
lation
To construct the Newton form of the interpolating polynomial we rst dene
what are called divided dierences.
2.3.1 Denition
The k-th divided dierence of a function g at the points
i
, . . . ,
i+k
is the
leading coecient (i.e the coecient of x
k
) of the polynomial of order k + 1
which agrees with g at the points
i
, . . . ,
i+k
. It is denoted by
g[
i
, . . . ,
i+k
].
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 31
Note: We will sometimes use the notation y[
i
, . . . , y
i+k
] for the divided
dierence. It does not matter too much, we use the g notation if the data is
considered to have come from a known function g, whereas, if it is just data
we are trying to t the y notation seems more appropriate. In this chapter
we stick to g.
The above denition of the divided dierence gives us the following result:
If p
i

i
agrees with g at
1
, . . . ,
i
for i = k and k + 1, then
p
k+1
(x) = p
k
(x) + (x
1
) . . . (x
k
)g[
1
, . . . ,
i+k
].
To show this, note that p
k+1
p
k
is a polynomial of order k+1 which vanishes
at
1
, . . . ,
k
and has g[
1
, . . . ,
k+1
] as its leading coecient, hence must be
of the form
p
k+1
(x) p
k
(x) = C(x
1
) . . . (x
k
),
with C = g[
1
, . . . ,
k+1
].
This property shows us how to build up the interpolating polynomial using
divided dierences by adding interpolation points one at a time. We obtain
p
n
(x) = p
1
(x) + (p
2
(x) p
1
(x)) + (p
3
(x) p
2
(x)) + . . . + (p
n
(x) p
n1
(x))
= g[
1
] + (x
1
)g[
1
,
2
] + . . . + (x
1
) . . . (x
n1
)g[
1
, . . . ,
n
].
This representation for the polynomial p
n
(x) of order n which agrees with g
at
1
, . . . ,
n
is the so called Newton form:
p
n
(x) =
n

i=1
(x
1
) . . . (x
i1
)g[
1
, . . . ,
i
].
(Here, (x
i
) . . . (x
j
) = 1 if i > j.)
Notice that g[
i
, . . . ,
i+k
] is independent of the order in which the arguments

i
, . . . ,
i+k
appear in the list. This must be so as the interpolating polynomial
depends only on the points of interpolation and not on the order in which
they are written down.
32 CHAPTER 2. POLYNOMIAL INTERPOLATION
There is a useful result, called Leibniz formula, connected with divided dif-
ferences which will be needed when we come to talk about B-splines.
2.3.2 Leibniz formula
If f(x) = g(x)h(x) for all x i.e f is the product of two functions, then
f[
i
, . . . ,
i+k
] =
i+k

r=i
g[
i
, . . . ,
r
]h[
r
, . . . ,
i+k
].
To show this we dene
F(x) =
i+k

r=i
(x
i
) . . . (x
r1
)g[
i
, . . . ,
r
]
i+k

s=i
(x
s+1
) . . . (x
i+k
)
h[
s
, . . . ,
i+k
].
Then F agrees with f at
i
, . . . ,
i+k
since the rst factor agrees with g and
the second factor with h. If we multiply out and write
F =
i+k

r,s=i
=

rs
+

r>s
then

r>s
vanishes at
i
, . . . ,
i+k
. Therefore,

rs
must also agree with f at

i
, . . . ,
i+k
. But

rs
is a polynomial of order k+1. Hence its leading coecient
which is

r=s
g[
i
, . . . ,
r
]h[
s
, . . . ,
i+k
]
must equal f[
i
, . . . ,
i+k
].
Another useful result is the following:
If g is a polynomial of degree k, then g[
i
, . . . ,
i+k
] is constant as a function of

i
, . . . ,
i+k
. In particular,
g[
i
, . . . ,
i+k
] = 0 for all g
k
.
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 33
This is clear since in this case the polynomial of order k + 1 which agrees
with g at
i
, . . . ,
i+k
(or at any k +1 points) must be g itself, by uniqueness
of the interpolating polynomial. In particular, every polynomial of order k
has leading coecient 0 when it is considered as a polynomial of order k +1.
We can explicitly compute the rst two values for the divided dierence:
g[
1
] = g(
1
),
which comes directly from the denition, and
g[
1
,
2
] =
g(
2
) g(
1
)

1
if
1
=
2
,
which we get from the well known formula for the linear polynomial p agreeing
with g at
1
,
2
:
p
2
(x) = g(
1
) + (x
1
)
g(
2
) g(
1
)

1
,
see gure 2.3.
Figure 2.3: Linear approximation to a function
34 CHAPTER 2. POLYNOMIAL INTERPOLATION
Notice that if g has a continuous derivative, then for
2

1
lim

1
g(
2
) g(
1
)

1
= g

(
1
),
and we get the familiar result
p
2
(x) = g(
1
) + (x
1
)g

(
1
)
for the function that agrees with g in value and slope at
1
. We can state this
in another way by saying that in this case p agrees with g at the points
1
and
1
i.e two-fold at
1
. Using this interpretation we have
g[
1
,
2
] = g

(
1
) if
1
=
2
.
This form of repeated interpolation at a point is called osculatory interpolation
since it produces higher than rst order contact between the function and its
interpolant.
We would like to extend the formulae for calculating the divided dierences
to all cases where the points may or may not be repeated. The following are
the general results (which can be proved from the denition though we omit
the proofs here).
If g has k continuous derivatives, then there exists a point in the smallest interval
containing
i
, . . . ,
i+k
such that
g[
i
, . . . ,
i+k
] = g
(k)
()/k!.
For computations we have
g[
i
, . . . ,
i+k
] =
_

_
g
(k)
(
i
)/k!
g[
i
,...,
r1
,
r+1
,...,
i+k
]g[
i
,...,
s1
,
s+1
,...,
i+k
]

r
(1)
where the respective conditions on the
i
are
_

i
= . . . =
i+k

r
,
s
any two distinct points in
i
, . . . ,
i+k
.
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 35
Note that for the second case, the fact that
r
,
s
can be arbitrary within
the list, subject to the condition that they are distinct, is due the symmetry
property of the divided dierence. Its value is independent of the order of
the

s.
For the case when all the
i
are distinct, corresponding to just point inter-
polation, the divided dierence recursion (1) can be written non-recursively
as
g[
i
, . . . ,
i+k
] =
i+k

j=i
g(
j
)
w

(
j
)
, (2)
where
w

(
j
) =
i+k

l=i,l=j
(
j

l
).
For example,
g[
1
,
2
,
3
] =
g[
2
,
3
] g[
1
,
2
]

1
=
(g(
3
) g(
2
))/(
3

2
) (g(
2
) g(
1
))/(
2

1
)

1
=
g(
1
)
(
1

2
)(
1

3
)
+
g(
2
)
(
2

1
)(
2

3
)
+
g(
3
)
(
3

1
)(
3

2
)
.
We will use this non-recursive representation for the divided dierence later
on to construct a formula for B-spline basis functions.
For the general case of osculatory interpolation we also have the following
result:
If g has n continuous derivatives and (
i
)
n
1
is a sequence of n arbitrary points (not
necessarily distinct), then for all x,
g(x) = p
n
(x) + (x
1
) . . . (x
n
)g[
1
, . . . ,
n
, x],
36 CHAPTER 2. POLYNOMIAL INTERPOLATION
with
p
n
(x) =
n

i=1
(x
i
) . . . (x
i1
)g[
1
, . . . ,
i
].
In particular, p
n
is the unique polynomial of order n which agrees with g at

1
, . . . ,
n
. If we let all the points
1
, . . . ,
n
coalesce,

1
= . . . =
n
= ,
we obtain the formula
g(x) = p
n
(x) + (x )
n
g
(n)
(
x
)/n!,
where
x
is some number between and x and
p
n
(x) =
n

i=1
(x )
i1
g
(i1)
()
(i 1)!
.
Here p
n
(x) is the standard truncated Taylor series with dierential remainder
term. Note that the truncated Taylor series does agree with g n-fold at , i.e
p
(i1)
n
() = g
(i1)
() for i = 1, . . . , n.
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 37
2.3.3 The Divided Dierence Table
The divided dierence coecients can be eciently and conveniently com-
puted in a divided dierence table set out as follows:

1
g(
1
)
g[
1
,
2
]

2
g(
2
) g[
1
,
2
,
3
]
g[
2
,
3
] g[
1
,
2
,
3
,
4
]

3
g(
3
) g[
2
,
3
,
4
]
.
.
.
g[
3
,
4
] g[
1
, . . . ,
n1
]

4
g(
4
) g[
1
, . . . ,
n
]
g[
2
, . . . ,
n
]
.
.
.
.
.
.
.
.
.
g[
n3
,
n2
,
n1
,
n
]

n1
g(
n1
) g[
n2
,
n1
,
n
]
g[
n1
,
n
]

n
g(
n
)
38 CHAPTER 2. POLYNOMIAL INTERPOLATION
If we assume that the interpolation points are so ordered that repeated
points occur together, i.e so that if
i
=
i+r
then
i
=
i+1
=
. . .
i+r1
=
i+r
, for example if = (1, 1, 2, 3, 3, 3, 3) then g

=
(g(1), g

(1), g(2), g(3), g

(3), g

(3), g

(3)), then on computing g[


i
, . . . ,
i+r
]
either
i
=
i+r
, in which case g[
i
, . . . ,
i+r
] = g
(r)
(
i
)/r! must be given,
or else
i
=
i+r
, in which case
g[
i
, . . . ,
i+r
] =
g[
i+1
, . . . ,
i+r
] g[
i
, . . . ,
i+r1
]

i+r

i
, (3)
and hence can be computed from the two entries next to it in the preceding
column. The entries of the divided dierence table are therefore calculated
column by column from the given data. On completing the table the desired
coecients occur along the top diagonal.
Example:
Find p
4
(x)
4
that interpolates to the data
p
4
(0) = 1, p
4
(1) = 2, p

4
(1) = 3, p
4
(2) = 1.
We form a Newton table as follows:

1
= 0 p
4
(
1
) = 1
p
4
[
1
,
2
] = 1

2
= 1 p
4
(
2
) = 2 p
4
[
1
,
2
,
3
] = 2
p
4
[
2
,
3
] = 3 p
4
[
1
,
2
,
3
,
4
] = 3

3
= 1 p
4
(
3
) = 2 p
4
[
2
,
3
,
4
] = 4
p
4
[
3
,
4
] = 1

4
= 2 p
4
(
4
) = 1
The cubic polynomial tting the data is given by
p
4
(x) = p
4
[
1
] + p
4
[
1
,
2
](x
1
) + p
4
[
1
,
2
,
3
](x
1
)(x
2
)+
p
4
[
1
,
2
,
3
,
4
](x
1
)(x
2
)(x
3
)
= 1 + x + 2x(x 1) 3x(x 1)
2
.
Notice that in all Newton interpolates the last
i
value does not appear as a
factor in the polynomial (e.g in this example there is no (x 2) factor).
For the case of non-repeated points (
1
, . . . ,
n
) and data (g(
1
), . . . , g(
n
)),
the divided dierence table can be computed from the following algorithm:
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 39
Algorithm 1: Divided dierence table
for i = 1, . . . , n, do:
TEMP(i) = g(
i
)
TAU(i) =
i
D(1) = TEMP(1) for k = 1, . . . , n 1, do:
for i = 1, . . . , n k, do:
TEMP(i) = (TEMP(i + 1) TEMP(i))/(TAU(i + k) TAU(i)).
D(k + 1) = TEMP(1)
Then D(i) = g[
1
, . . . ,
i
] for i = 1, . . . , n.
2.3.4 Nested Multiplication
There is a very ecient way to evaluate a polynomial in Newton form based
on the idea of nesting the factors. If a
i
= g[
1
, . . . ,
i
] and p
n
(x) is the Newton
polynomial of order n interpolating the data (
i
, g(
i
))
n
i=1
we can write
p
n
(x) =
n

i=1
a
i
(x
1
) . . . (x
i1
)
= a
1
+(x
1
)
_
a
2
+(x
2
)
_
a
3
+. . .+(x
n2
)
_
a
n1
+a
n
(x
n1
)
_
. . .
_
. . .
_
.
This is the so called nested multiplication method for polynomial evaluation.
We begin by evaluating the innermost term and work our way outwards.
Example:
From the previous example
p
4
(x) = 1 + x + 2x(x 1) 3x(x 1)
2
= 1 + x
_
1 + (x 1)
_
2 3(x 1)
__
The process can be formalized in an algorithm.
40 CHAPTER 2. POLYNOMIAL INTERPOLATION
Algorithm 2: Nested multiplication
Given points
1
, . . . ,
n1
and corresponding coecients a
1
, . . . , a
n
,
and also another point
0
(the evaluation point):
b
n
= a
n
for k = n 1, 1, 1, do:
b
k
= a
k
+ (
0

k
)b
k+1
.
Then
b
1
= p
n
(
0
) =
n

i=1
a
i
(
0

1
) . . . (
0

i1
).
2.3.5 Derivative evaluation
We note from this algorithm that all the numbers b
k
carry useful information
about p
n
. In particular, we have the property that
p
n
(x) = b
1
+(x
0
)b
2
+(x
0
)(x
1
)b
3
+. . . +(x
0
) . . . (x
n2
)b
n
. ()
This tells us that the nested multiplication algorithm, based on the inter-
polation points
1
, . . . ,
n1
, provides us with the Newton form for the same
polynomial but now based on the points
0
, . . . ,
n2
.
To show this, note that from the algorithm we have b
k+1
= (b
k
a
k
)/(
0

k
).
Since b
1
= p
n
(
0
) and a
k
= p
n
[
1
, . . . ,
k
], by induction b
k+1
= p
n
[
0
, . . . ,
k1
].
Therefore () is the polynomial of order n which agrees with p
n
at
0
, . . . ,
n1
and hence must be p
n
itself.
The nested multiplication algorithm may therefore be visualized as a scheme
for lling in an additional diagonal on top of the original divided dierence
table for p
n
, but this time working from right to left. We can repeat the
process starting with points
0
, . . . ,
n2
and the coecients b
1
, . . . , b
n
and an
additional point
1
(a new evaluation point), obtaining coecients c
1
, . . . , c
n
which t into a diagonal on top of the b
k
s, and for which,
p
n
(x) = c
1
+(x
1
)c
2
+(x
1
)(x
0
)c
3
+. . . +(x
1
) . . . (x
n3
)c
n
.
2.3. DIVIDED DIFFERENCES AND NEWTON INTERPOLATION 41
By carrying out this process a set number of times we can eciently evaluate
all the derivatives of p
n
at a point. This is because p
(j)
n
()/j! appears as the
(j + 1)st coecient in any Newton form for p
n
in which the rst j interpo-
lation points all equal . Example Suppose we wanted to evaluate all the
derivatives at x = 3 of the Newton polynomial calculated in the previous
example. The original table can be written as:

1
= 0 1
1

2
= 1 2 2
3 3

3
= 1 2 4
1

4
= 2 1
Here a
1
= 1, a
2
= 1, a
3
= 2, a
4
= 3.
We now ll in three diagonals above the top diagonal using the nested mul-
tiplication algorithm and the evaluation points
0
= 3,
1
= 3,
2
= 3. The
computations go as follows:
diagonal 1
b
4
= a
4
= 3, b
3
= a
3
+ (3 1)b
4
= 4, b
2
= a
2
+ (3 1)b
3
= 7
b
1
= a
1
+ (3 0)b
2
= 20
diagonal 2
c
4
= b
4
= 3, c
3
= b
3
+ (3 1)c
4
= 10, c
2
= b
2
+ (3 0)c
3
= 37
c
1
= b
1
+ (3 3)c
2
= 20
diagonal 3
d
4
= c
4
= 3, d
3
= c
3
+ (3 0)d
4
= 19, d
2
= c
2
+ (3 3)d
3
= 37
d
1
= c
1
+ (3 3)d
2
= 20
42 CHAPTER 2. POLYNOMIAL INTERPOLATION
The divided dierence table now looks like the following:

2
= 3 20
37

1
= 3 20 19
37 3

0
= 3 20 10
7 3

1
= 0 1 4
1 3

2
= 1 2 2
3 3

3
= 1 2 4
1

4
= 2 1
The leading diagonal then gives us the Newton polynomial for p
4
based on
the points
2
, . . . ,
0
:
p
4
(x) = 20 + (x 3)(37) + (x 3)
2
(19) + (x 3)
3
(3).
Finally, the derivatives at x = 3 of p
4
are given by
p
(0)
4
(3) = 20, p
(1)
4
(3) = 37, p
(2)
4
(3)/2! = 19, p
(3)
4
(3)/3! = 3.
Note that if we had been required to evaluate all the derivatives at x = 0
of p
4
(x) for the above example we would have only had to add two extra
diagonals to the original table as we already have
1
= 0. Also note that the
polynomial p
4
constructed above is the same polynomial as the original one.
All we have really done is shift the origin, expressing it now in explicit power
form centered at x = 3. This method is an ecient way to shift the origin
for polynomials expressed in explicit power form.
The following algorithm will compute the Taylor coecients of the polyno-
mial p
n
(x) centered about a point x
0
given the divided dierence coecients
D(i) from algorithm 1.
2.4. HERMITE INTERPOLATION 43
Algorithm 3: Origin shift for Newton form
for k = 1, . . . , n 1, do:
for i = 1, . . . , n k, do:
D(n i) = D(n i) + D(n i + 1) (x
0
TAU(n i k + 1)).
Then
D(i) = p
(i1)
n
(x
0
)/(i 1)! , i = 1, . . . , n.
(Note that D(n) remains the same)
2.4 Hermite interpolation
Just as the Lagrange basis enabled us to write down immediately the poly-
nomial of a given order interpolating to a set of points, it is possible to
construct a similar basis that enables us to write down immediately the
polynomial interpolating to data supplying point and derivative information
at each abscissa.
For example, suppose we have two points
1
,
2
at which we require the cubic
polynomial p
4
(x) satisfying the conditions:
p
4
(
1
) = y
1
, p
4
(
2
) = y
2
, p

(
1
) = m
1
p

(
2
) = m
2
.
We would like to construct a basis (H
0
(x), . . . , H
3
(x)) such that
p
4
(x) = y
1
H
0
(x) + y
2
H
1
(x) + m
1
H
2
(x) + m
2
H
3
(x). ()
Here the cubic polynomials H
0
, H
1
will be constructed for point interpolation
at
1
,
2
and H
2
, H
3
for derivative interpolation at these points. For () to
hold the H
i
(x) must satisfy the following conditions:
44 CHAPTER 2. POLYNOMIAL INTERPOLATION
H
0
(
1
) = 1 , H
0
(
2
) = 0 , H

0
(
1
) = 0 , H

0
(
2
) = 0,
H
1
(
1
) = 0 , H
1
(
2
) = 1 , H

1
(
1
) = 0 , H

1
(
2
) = 0,
H
2
(
1
) = 0 , H
2
(
2
) = 0 , H

2
(
1
) = 1 , H

2
(
2
) = 0,
H
3
(
1
) = 0 , H
3
(
2
) = 0 , H

3
(
1
) = 0 , H

3
(
2
) = 1.
The Newton table provides us with a convenient way to determine the H
i
(x)
satisfying these conditions. To take H
0
(x) as an example, the corresponding
Newton table is

1
1
0

1
1
1
(h)
2
1
h
2
h
3

2
0
1
h
2
0

2
0
with h =
2

1
, from which we get
H
0
(x) = 1 (1/h
2
)(x
1
)
2
+ (2/h
3
)(x
1
)
2
(x
2
).
In a similar fashion we obtain the following expressions for H
1
(x), H
2
(x) and
H
3
(x):
H
1
(x) = (1/h
2
)(x
1
)
2
(2/h
3
)(x
1
)
2
(x
2
),
H
2
(x) = (x
1
) (1/h)(x
1
)
2
+ (1/h
2
)(x
1
)
2
(x
2
),
H
3
(x) = (1/h
2
)(x
1
)
2
(x
2
).
2.4. HERMITE INTERPOLATION 45
These four cubic polynomials form the cubic Hermite basis for
4
. In an anal-
ogous fashion it is possible to construct the quintic Hermite basis for
6
cor-
responding to point, 1st and 2nd derivative interpolation at
1
,
2
, and so
on.
Finally, it will be useful later on to have each H
i
(x) expressed as a Taylor
series about
1
, so that the derivatives can be read o easily. We can do this
by adding one more diagonal to each of the Newton tables used to construct
the H
i
(x). For example, for the H
1
table above we add the extra point
0
=
1
and compute:
b
4
= a
4
= 2/h
3
,
b
3
= a
3
+ (
0

3
)b
4
= 1/h
2
2/h
2
= 3/h
2
,
b
2
= a
2
+ (
0

2
)b
3
= 0,
b
1
= a
1
+ (
0

1
)b
2
= 1.
This gives the following Newton table:

1
1
0

1
1
3
h
2
0
2
h
3

1
1
1
h
2
1
h
2
h
3

2
0
1
h
2
0

2
0
from which we get
H
0
(x) = 1 (3/h
2
)(x
1
)
2
+ (2/h
3
)(x
1
)
3
.
46 CHAPTER 2. POLYNOMIAL INTERPOLATION
In a similar fashion we obtain the following expressions for H
1
(x), H
2
(x) and
H
3
(x):
H
1
(x) = (3/h
2
)(x
1
)
2
(2/h
3
)(x
1
)
3
,
H
2
(x) = (x
1
) (2/h)(x
1
)
2
+ (1/h
2
)(x
1
)
3
,
H
3
(x) = (1/h)(x
1
)
2
+ (1/h
2
)(x
1
)
3
.
2.5. SUMMARY 47
2.5 Summary
Problem: Polynomial interpolation to n data points
Solution:
i/ Explicit power (ill conditioned for high degrees),
ii/ Lagrange (computationally involved),
iii/ Newton (ecient) - divided dierences as coecients.
Newton table for divided dierences
Nested multiplication for evaluation
Extended Newton table for derivatives
Hermite basis for interpolation to point and derivative information at
two abscissa points. Newton form used for computation.
48 CHAPTER 2. POLYNOMIAL INTERPOLATION
Chapter 3
Splines
There is a problem associated with interpolating to a set of points with a
single polynomial function. The more constraints there are to satisfy the
higher the degree the polynomial must be. This clearly has its limitations as
both the behaviour of the function between the data points becomes less easy
to predict and the instabilities inherent in computing the solution become
more pronounced.
One way of overcoming these drawbacks is, instead of using a single poly-
nomial of high degree, to attempt to meet the conditions of the problem by
piecing together many segments of low degree. This general approach has
proved very successful in many areas where curve tting or curve approxi-
mation are required. In particular, it is the most common method used for
free-form curve and surface construction in computer aided design systems.
The piecewise functions employed are called splines.
3.1 The linear space S
k
(P
l
)
A spline function is a piecewise polynomial function with certain continuity
conditions enforced at the segment boundaries. In particular s(x) is a spline
function of order k on the partition
P
l
=
_

i
: a =
1
<
2
< . . . <
l+1
= b
_
of the interval [a, b], if it satises the following two properties:
i/ s(x) is a polynomial of order k on each [
i
,
i+1
] , i = 1, 2, . . . , l
49
50 CHAPTER 3. SPLINES
ii/ s(x) has continuous derivatives up to level k2 (s(x) is said to have C
k2
continuity)
on [
1
,
l+1
], that is the k 1 derivative functions, s
(0)
(x), s
(1)
(x), . . . , s
(k2)
(x), are
all continuous functions of x.
The
i
are called segment breakpoints or knots. Note that ii/ imposes k 1
continuity conditions for the spline at each internal breakpoint. Forcing
s(x) to have continuous derivatives up to level k 1 would over constrain
the problem leaving us with no degrees of freedom and returning us to the
earlier situation of having a single polynomial function. It is precisely by
relaxing the number of continuity conditions that we are able to construct a
piecewise polynomial function with the maximum continuity available. For
the cubic case that we will be dealing with most often, a spline is a piecewise
cubic polynomial function with up to and including second derivative (k
2 = 2) continuity at the internal breakpoints. Note there are no continuity
conditions specied at the two ends a =
1
, b =
l+1
.
We denote the set of all splines of order k on the partition P
l
by S
k
(P
l
). It
is a linear space because
s(x), t(x) S
k
(P
l
) s(x) + t(x) S
k
(P
l
), , real numbers
i.e the function s(x) + t(x) satises both i/ and ii/.
Since S
k
(P
l
) is a linear space we can ask the question what is its dimension?
The dimension is equal to the number of free variables we must tie down in
order to uniquely dene an element of S
k
(P
l
). We can calculate this as
follows:
a) the number of free variables given the fact that it is a polynomial of order
k on each sub-interval [
i
,
i+1
], i = 1, . . . , l is given by kl (i.e k per span and
l spans).
b) the number of free variables tied down by the continuity conditions at
each internal breakpoint is given by (k 1)(l 1) (i.e k 1 conditions at
each internal breakpoint and (l 1) of these breakpoints).
Hence dim S
k
(P
l
) = kl (k 1)(l 1) = k + l 1. Another way of stating
this result is to say that we need k +l 1 basis functions in order to express
any element of S
k
(P
l
) uniquely as a linear combination of these functions.
Equivalently, we must supply k+l 1 independent constraints (i.e equations)
3.2. INTERPOLATING SPLINES 51
in order to uniquely dene s(x) S
k
(P
l
). One of the main tasks is to nd a
computationally nice set of basis functions for this linear space.
3.2 Interpolating splines
If we wish to construct an interpolating spline, that is a spline s(x) such that
s(
i
) = y
i
, for a given set of data points (
i
, y
i
)
l+1
i=1
, then we impose l + 1
constraints on s(x). As stated above, in order to uniquely specify an element
of S
k
(P
l
) we must impose k + l 1 independent constraints and so for an
interpolatory spline we need to supply k + l 1 (l + 1) = k 2 extra
conditions in order to solve uniquely for s(x). These extra constraints are
often called side conditions as it is common practice to specify the needed
information at either end of the interval of interest [
1
,
l+1
]. For the cubic
case (i.e k = 4), two side conditions must be supplied.
Note: We distinguish between the breakpoints that we have labelled
i
and
the interpolation abscissa, labelled
i
. The reason for doing this is that it is
by no means necessary that these two sets of points should coincide. We shall
meet cases later on where it is useful to interpolate at points other than the
breakpoints; for example, we may wish to interpolate at the mid-points of
the breakpoints. This practice is more common with B-spline interpolation.
For the case of cubic spline interpolation we do assume that the breakpoint
sequence (
i
)
l+1
i=1
coincides with the interpolation abscissa sequence (
i
)
l+1
i=1
.
C
1
Interpolation
As a method of constructing an interpolatory spline function we begin by
constructing a piecewise cubic interpolatory function that will gives us rst
derivative continuity (C
1
) at each internal breakpoint. Using this we will
then be able to construct the cubic spline.
Problem: Construct a piecewise cubic function, t(x), interpolating the points (y
i
)
l+1
i=1
and derivative values (m
i
)
l+1
i=1
at the abscissa (
i
)
l+1
i=1
.
To solve this problem we construct 2l +2 basis functions (since the dimension
of the linear space when only C
1
continuity is required is 4l 2(l 1) = 2l +2)
that we will denote by (
i
)
l+1
i=1
, (
i
)
l+1
i=1
. They will enable us to write the
solution in the form
52 CHAPTER 3. SPLINES
t(x) =
l+1

i=1

i
(x)y
i
+
l+1

i=1

i
(x)m
i
. (4)
The (
i
), (
i
) are constructed using the four cubic Hermite basis functions
H
0
(x), . . . , H
3
(x). To recall, these basis functions enable us to write down
the cubic polynomial interpolating two point values y
i
, y
i+1
and two slope
values m
i
, m
i+1
at the abscissa
i
,
i+1
. The solution is
p(x) = y
i
H
0
(x) + y
i+1
H
1
(x) + m
i
H
2
(x) + m
i+1
H
3
(x).
The interpolant we require is obtained by piecing together these cubic Her-
mite polynomial segments. The resulting function is called a cubic Hermite
interpolant. Formally, we dene

i
(x) =
_

_
0 x <
i1
H
1
(x)
i1
x <
i
H
0
(x)
i
x <
i+1
0 x
i+1
and

i
(x) =
_

_
0 x <
i1
H
3
(x)
i1
x <
i
H
2
(x)
i
x <
i+1
0 x
i+1
,
where the H
i
(x) take the following form (over [
i
,
i+1
], this time factored in
a slightly dierent way to chapter 1):
H
0
(x) = (2/h
3
i
)(x
i
+ (1/2)h
i
)(x
i+1
)
2
,
H
1
(x) = (2/h
3
i
)(x
i
)
2
(x
i+1
(1/2)h
i
),
H
2
(x) = (h
2
i
)
1
(x
i
)(x
i+1
)
2
,
H
3
(x) = (h
2
i
)
1
(x
i
)
2
(x
i+1
),
with h
i
=
i+1

i
.
3.3. CHOOSING THE SLOPES 53
Note that in the cases i = 1, i = l + 1, for
1
,
1
only the last two parts of
the denition apply and for
l+1
,
l+1
only the rst two apply. Figure 3.1
illustrates some of these basis functions.
Figure 3.1: C
1
Hermite type interpolation basis functions
It is clear that t(x) as dened satises the conditions of the problem and is
C
1
continuous (since the basis functions are C
1
continuous).
3.3 Choosing the slopes
Commonly in practical applications one is not provided with the slope values
to interpolate. In such cases it is necessary to choose sensible values for the
m
i
. A simple way of doing this is to set m
i
to be the slope of the unique
parabola that interpolates y
i1
, y
i
, y
i+1
at
i1
,
i
,
i+1
. This is found to be
(e.g by computing it using the Newton form)
m
i
=
[(y
i+1
y
i
)/h
i
]h
i1
+ [(y
i
y
i1
)/h
i1
]h
i
h
i
+ h
i1
, i = 2, . . . , l,
where h
i
=
i+1

i
. For the end slopes m
1
, m
l+1
we can apply the same
process to compute the slopes at
1
,
l+1
from the parabola interpolating
y
1
, y
2
, y
3
and y
l1
, y
l
, y
l+1
respectively. This gives
m
1
= 2
(y
2
y
1
)
h
1
m
2
,
54 CHAPTER 3. SPLINES
and
m
l+1
= 2
(y
l+1
y
l
)
h
l
m
l
.
This method for choosing the slopes is a linear scheme, i.e all the slopes
are determined as linear functions of the (y
i
)
l+1
i=1
(and hence the interpolant
to the sum of two functions using this method is equal to the sum of the
corresponding interpolants). In contrast, a non-linear method due to Akima
sets the slope values as
m
i
=
w
i1
(y
i
y
i1
) + w
i+1
(y
i+1
y
i
)
w
i+1
w
i1
, i = 2, . . . , l,
where
w
i
= |(y
i+1
y
i
) (y
i
y
i1
)| .
Note that when i = 1 or l + 1, this method requires the specication of
an extra point outside the interval. Alternatively, we could use the previous
method for these points. Although rather involved this method does produce
good results when it is required to produce curves that oscillate minimally
(i.e it combats wiggles in the interpolant).
It is possible to construct a linear scheme for determining the unknown slope
values that will ensure the function has a continuous second derivative ev-
erywhere. This will be the cubic interpolatory spline we are after.
3.4 Constructing the cubic spline
To construct a cubic spline, s(x), interpolating the given data we use the
Hermite type basis functions, (
i
)
l+1
i=1
, (
i
)
l+1
i=1
. The condition that s(x) have
second derivative continuity allows us to express the (as yet undetermined)
slope values (m
i
)
l+1
i=1
explicitly in terms of the function values (y
i
)
l+1
i=1
. Once
this is done, the spline is determined for all x [a, b] by means of equation
(4).
For s(x) written in the form of (4) we rst calculate the jumps in the second
derivative at the interior breakpoints
2
, . . . ,
l
and equate these to zero.
This is done by calculating the dierence in values between s

(
k
) computed
3.5. THE MATRIXFORMFOR THE CUBIC INTERPOLATORYSPLINE55
from the right hand end of the left segment of the cubic at
k
(denoted by
s

k
)), and the similar quantity s

(
+
k
) obtained from the left hand end of
the segment to the right of
k
(note that here k is an index for counting, not
the order of the spline). Thus,
s

(
+
k
) s

k
)
=
l+1

i=1
y
i
[

i
(
+
k
)

i
(

k
)] +
l+1

i=1
m
i
[

i
(
+
k
)

i
(

k
)]
=
k+1

i=k1
y
i
[

i
(
+
k
)

i
(

k
)] +
k+1

i=k1
m
i
[

i
(
+
k
)

i
(

k
)] = 0.
The sums have only three terms each because of the local non-zero nature of
the basis functions (see gure 3.1). Working out the derivatives in the above
equation we nd that the l + 1 slopes (m
i
)
l+1
i=1
satisfy the l 1 equations
1
h
k1
m
k1
+ 2(
1
h
k1
+
1
h
k
)m
k
+
1
h
k
m
k+1
= 3
y
k
y
k1
h
2
k1
+ 3
y
k+1
y
k
h
2
k
(5)
for k = 2, . . . , l. There remain two degrees of freedom, equivalent to two
independent equations, that we are left to specify.
3.5 The matrix form for the cubic interpola-
tory spline
In order to express the above equations in matrix form we rst multiply
through by h
k1
h
k
and then divide by h
k
+ h
k1
. This gives the equivalent
system
h
k
h
k
+ h
k1
m
k1
+ 2 m
k
+
h
k1
h
k
+ h
k1
m
k+1
= 3
h
k
(y
k
y
k1
)
h
k1
(h
k
+ h
k1
)
+
3
h
k1
(y
k+1
y
k
)
h
k
(h
k
+ h
k1
)
(6)
for k = 2, . . . , l. Now dene

k
= h
k
/(h
k
+ h
k1
),
k
= 1
k
,
56 CHAPTER 3. SPLINES
c
k
= 3
k
[(y
k
y
k1
)/h
k1
] + 3
k
[(y
k+1
y
k
)/h
k
], k = 2, . . . , l.
If we now write down the two side conditions as equations involving at the
left end m
1
, m
2
, and at the right end m
l
, m
l+1
, in the form
2m
1
+
1
m
2
= c
1
,
l+1
m
l
+ 2m
l+1
= c
l+1
, (7)
we can combine (6) and (7) into the single matrix equation
_
_
_
_
_
_
_
_
_
_
_
_
_
2
1

2
2
2

3
2
3
.
.
.

l1
2
l1

l
2
l

l+1
2
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
m
1
m
2
m
3
.
.
.
m
l1
m
l
m
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
_
c
1
c
2
c
3
.
.
.
c
l1
c
l
c
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
. (8)
Here
1
,
l+1
, c
1
, c
l+1
are parameters we are free to choose, corresponding to
the required end conditions. There are various methods for specifying these
parameters.
3.6 Specication of end conditions
a) end slopes specied: if values s

(
1
), s

(
l+1
) are given, for example by com-
puting the slope of the parabola at
1
,
l+1
interpolating the rst three and
last three points respectively, then set
1
= 0 and c
1
= 2s

(
1
),
l+1
= 0 and
c
l+1
= 2s

(
l+1
).
b) end second derivatives specied: if values s

(
1
), s

(
l+1
) are supplied, in order
to obtain the end equations we expand s(x) as a Taylor series about x =
1
to obtain
s(x) = s(
1
) + (x
1
)s

(
1
) +
(x
1
)
2
2
s

(
1
) +
(x
1
)
3
6
s

(
1
).
The derivative is given by
s

(x) = s

(
1
) + (x
1
)s

(
1
) +
(x
1
)
2
2
s

(
1
).
3.6. SPECIFICATION OF END CONDITIONS 57
If we let x =
2
in these we get
y
2
= y
1
+ h
1
m
1
+ (h
2
1
/2)s

(
1
) + (h
3
1
/6)s

(
1
)
and
m
2
= m
1
+ h
1
s

(
1
) + (h
2
1
/2)s

(
1
),
and from these we get the equation
2m
1
+ m
2
= 3[(y
2
y
1
)/h
1
] (h
1
/2)s

(
1
).
In an analogous fashion we get at the right hand end
m
l
+ 2m
l+1
= 3[(y
l+1
y
l
)/h
l
] + (h
l
/2)s

(
l+1
).
From these two equations we see that the choices for the parameters are

1
=
l+1
= 1,
and
c
1
= 3[(y
2
y
1
)/h
1
] (h
1
/2)s

(
1
) , c
l+1
= 3[(y
l+1
y
l
)/h
l
] +(h
l
/2)s

(
l+1
).
By setting the second derivatives s

(
1
), s

(
l+1
) to zero, the so called natural
end conditions, we obtain the what is called the natural cubic spline. This par-
ticular spline has connections with a process used for constructing curves in
the days before high speed computers. We expand a little on the background
to this.
3.6.1 Background to the natural cubic spline
A mechanical means of producing smooth interpolating curves, heavily used
in the past in the shipbuilding and aircraft industries, consists in the use
of a thin, exible batten or spline, held in place by weights. This spline
bends in such a way that its internal energy due to bending is minimal,
consistent with the interpolation constraints imposed on it. At any point of
the spline, the bending energy depends on the curvature there. If the form of
58 CHAPTER 3. SPLINES
the interpolating spline is viewed as a graph of a function s(x) with x [a, b],
a and b being two of the points of interpolation, then it can be shown that
the energy is proportional to the integral
b
_
a
[s

(x)]
2
dx
[1 + (s

(x))
2
]
5/2
,
which can be rewritten as
b
_
a
[(x)]
2
[1 + (s

(x))
2
]
1/2
dx,
where (x) is the curvature of the curve s(x) and equal to
|s

(x)| /[1 + (s

(x))
2
]
3/2
.
The following problem now poses itself: Find the function s(x) which inter-
polates at the abscissa a =
1
<
2
< . . . <
l+1
= b, and for which the above
integral exists and is least in value. It turns out that this is quite a dicult
problem but a simplication results if we ignore the contribution of the slope
s

(x) to the integral and set it to zero (i.e we are assuming that the slope
is small so that |s

(x)| is a reasonable approximation to (x)). The integral


then collapses to
b
_
a
[s

(x)]
2
dx. (9)
The solution to this minimization problem, i.e the function s(x) interpolating
at the
i
and minimizing (9), turns out to be the cubic spline with natural end
conditions.
The term natural used here refers to the fact that a mechanical spline that
interpolates but is not subject to torques at the data points will atten out to
zero curvatures at its extremities. This corresponds to zero second derivative
end conditions.
c) quadratic end spans
3.6. SPECIFICATION OF END CONDITIONS 59
In this case we specify that s

(
1
) = s

(
2
) and s

(
l
) = s

(
l+1
). This
implies that the third derivative vanish for the rst and last segments of the
spline. To obtain the two end equations for this case we look at the Taylor
expansions of the rst and last segments centered at
1
and
2
,
l
and
l+1
respectively. For the rst segment these are
s(x) = s(
1
) + (x
1
)s

(
1
) +
(x
1
)
2
2
s

(
1
),
and
s(x) = s(
2
) + (x
2
)s

(
2
) +
(x
2
)
2
2
s

(
2
).
These give us the equations
y
1
= y
2
h
1
m
2
+ (h
2
1
/2)s

(
2
) , y
2
= y
1
+ h
1
m
1
+ (h
2
1
/2)s

(
1
),
from which we obtain the equation
2m
1
+ 2m
2
= 4
y
2
y
1
h
1
.
Similarly for the right hand end we get
2m
l
+ 2m
l+1
= 4
y
l+1
y
l
h
l
.
Hence in this case the choices for the parameters are

1
=
l+1
= 2 , c
1
= 4(y
2
y
1
)/h
1
, c
l+1
= 4(y
l+1
y
l
)/h
l
.
d) periodic end conditions: A cubic spline is said to be periodic of period (b a)
if the following condition holds:
s
(p)
(a) = s
(p)
(b) (p = 0, 1, 2)
i.e
y
1
= y
l+1
= s(
1
) = s(
l+1
), s

(
1
) = s

(
l+1
), s

(
1
) = s

(
l+1
).
60 CHAPTER 3. SPLINES
Such a spline would be needed if we were, for example, trying to t a function
to periodic data.
For the periodic spline, equations (6) (k = 2, . . . , l) give l 1 simultaneous
equations in the quantities m
2
, . . . , m
l
. We require in the periodic case that
(6) be valid for k = l +1 as well. Here y
l+1
= y
1
, m
l+1
= m
1
, and we prescribe
that y
l+2
= y
2
, m
l+2
= m
2
, h
l+1
= h
1
. The dening equations are then
_
_
_
_
_
_
_
_
_
_
_
_
_
2
2

2

3
2
3

4
2
4
.
.
.

l1
2
l1

l
2
l

l+1

l+1
2
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
m
2
m
3
m
4
.
.
.
m
l1
m
l
m
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
_
c
2
c
3
c
4
.
.
.
c
l1
c
l
c
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
with
l+1
= h
1
/(h
l+1
+ h
l
),
l+1
= 1
l+1
.
e) no end conditions: Rather than impose conditions at either end of the spline
they can be replaced by the so called not-a-knot condition at
2
or
l
. We
choose the corresponding derivatives m
2
, m
l
so that the rst two cubic seg-
ments of s(x) are part of just one cubic polynomial and similarly for the last
two segments. In this way the rst and last internal segment breakpoints
eectively vanish, requiring that the third derivative be continuous across
y
2
and y
l
. The appropriate equations relating the slopes are obtained by
matching third rather than second derivatives, and then using the second
and next to last equation from the matrix (8) to eliminate m
2
and m
l2
,
respectively. Without going through the calculations, the resulting choice for
the parameters
1
, c
1
,
l+1
, c
l+1
is then

1
=
2(h
1
+ h
2
)
h
2
, c
1
=
2(3h
1
+ 2h
2
)(y
2
y
1
)
(h
1
+ h
2
)h
1
+
2h
2
1
(y
3
y
2
)
h
2
(h
1
+ h
2
)
,
for third derivative continuity at
2
, and

l+1
=
2(h
l1
+ h
l
)
h
l1
, c
l+1
=
2h
2
l
(y
l
y
l1
)
h
l1
(h
l1
+ h
l
)
+
2(2h
l1
+ 3h
l
)(y
l+1
y
l
)
(h
l1
+ h
l
)h
l
,
for third derivative continuity at
l
.
3.7. SOLVING THE LINEAR CUBIC SPLINE EQUATIONS 61
We can interpret this not-a-knot condition as requiring both the rst and
last polynomial segments interpolate at an additional point which is not a
breakpoint. This means that we have l 2 segments rather than l, with the
rst piece s
1
(x) now dened over [
1
,
3
] and such that s
1
(
i
) = y
i
, i = 1, 2, 3,
and s

1
(
3
) = m
3
. Similarly for the last piece, s
l2
(x), on [
l1
,
l+1
] is such
that s
l2
(
i
) = y
i
, i = l 1, l, l +1 and s

l2
(
l1
) = m
l1
. This interpretation
illustrates the point made earlier that breakpoints and interpolation abscissa
need not coincide.
3.7 Solving the linear cubic spline equations
Given data (
k
, y
k
)
l+1
k=1
, if we dene Y (k) = y
k
, TAU(k) =
k
for k =
1, . . . , l + 1 and supply the values MU(1), LDA(l + 1), C(1), C(l + 1) cor-
responding to the appropriate end condition parameters
1
,
l+1
, c
1
, c
l+1
, the
following algorithm will compute the unknown slopes m
k
:
Algorithm 4: Cubic spline interpolation
for k = 1, . . . , l, do:
H(k) = TAU(k + 1) TAU(k)
for k = 2, . . . , l, do:
LDA(k) = H(k)/(H(k) + H(k 1))
MU(k) = 1 LDA(k)
C(k) = 3 LDA(k)[
(Y (k)Y (k1))
H(k1)
] + 3 MU(k)[
(Y (k+1)Y (k))
H(k)
]
U(0) = 0 , Q(0) = 0, MU(1) = 0, LDA(1) = 0
for k = 1, . . . , l + 1, do:
P(k) = LDA(k) Q(k 1) + 2
Q(k) = MU(k)/P(k)
U(k) = (C(k) LDA(k) U(k 1))/P(k)
M(l + 1) = U(l + 1)
for k = l, . . . , 1, 1, do:
M(k) = Q(k) M(k + 1) + U(k).
62 CHAPTER 3. SPLINES
Periodic spline case
For the periodic spline case an extension of this procedure can be used. For
the equations
b
1
x
1
+ c
1
x
2
+ a
1
x
n
= d
1
,
a
2
x
1
+ b
2
x
2
+ c
2
x
3
= d
2
,
.
.
.
a
n1
x
n2
+ b
n1
x
n1
+ c
n1
x
n
= d
n1
,
c
n
x
1
+ a
n
x
n1
+ b
n
x
n
= d
n
,
we eectively solve for x
1
, . . . , x
n1
in terms of x
n
by means of the rst n1
equations and then determine x
n
from the last equation.
3.8. TENSIONED SPLINES: -SPLINES 63
Algorithm 5: Periodic cubic spline interpolation
for k = 1, . . . , l, do:
H(k) = TAU(k + 1) TAU(k)
H(l + 1) = H(1) , Y (l + 2) = Y (2)
for k = 2, . . . , l + 1, do:
LDA(k) = H(k)/(H(k) + H(k 1))
MU(k) = 1 LDA(k)
C(k) = 3 LDA(k)[
(Y (k)Y (k1))
H(k1)
] + 3 MU(k)[
(Y (k+1)Y (k))
H(k)
]
U(1) = 0 , Q(1) = 0 , S(1) = 1
for k = 2, . . . , l + 1, do:
P(k) = LDA(k) Q(k 1) + 2
Q(k) = MU(k)/P(k)
U(k) = (C(k) LDA(k) U(k 1))/P(k)
S(k) = LDA(k) S(k 1)/P(k)
T(l + 1) = 1 , V (l + 1) = 0
for k = l, . . . , 2, 1, do:
T(k) = Q(k) T(k + 1) + S(k)
V (k) = Q(k)V (k + 1) + U(k)
M(l + 1) = C(l + 1) MU(l + 1) V (2) LDA(l + 1) V (l)
M(l + 1) = M(l + 1)/(MU(l + 1) T(2) + LDA(l + 1) T(l) + 2)
M(1) = M(l + 1)
for k = l, . . . , 2, do:
M(k) = T(k) M(l + 1) + V (k).
3.8 Tensioned splines: -splines
Let s be the smooth spline interpolant to our data set (
i
, y
i
)
l+1
i=1
. We know
from equation (1) on page 8 that, for each i, there is a point
i
in the open
interval (
i
,
i+1
) so that
y[
i1
,
i
,
i+1
] = s

(
i
)/2.
Therefore, corresponding to each sign change in the sequence (
i
)
l
i=2
, with
64 CHAPTER 3. SPLINES

i
= y[
i
,
i+1
] y[
i
,
i1
],
there must be a sign change in the second derivative of s, i.e an inection
point of s. We call all other inection points extraneous. More precisely, we
call an inection point of the interpolant s in the open interval (
i
,
i+1
)
extraneous if
i

i+1
> 0. In a sense these inection points are unwanted and
tensioned splines are a class of functions that can be used to minimize their
eects.
The equations for a tensioned spline are generated in a similar fashion to the
cubic spline equations (5) on page 32. The dierence is that the C
2
condition
s

(
+
k
) s

k
) = 0 , k = 2, . . . , l
is replaced by the condition
s

(
+
k
) s

k
) =
k
m
k
, k = 2, . . . , l. (12)
Here the
i
are the tension parameters we must specify. If they are all set
to zero we return to cubic spline interpolation. The rationale behind this
modication is best explained in a parametric setting so we will leave it until
we come to look at the extension to parametric splines. However, we can
generate the appropriate matrix equation to solve for the unknown slope
values m
i
.
Equation (5) becomes
1
h
k1
m
k1
+ 2(
1
h
k1
+
1
h
k
+
1
2

k
)m
k
+
1
h
k
m
k+1
= 3
y
k
y
k1
h
2
k1
+ 3
y
k+1
y
k
h
2
k
for k = 2, . . . , l. Again there remain two degrees of freedom that we are left
to specify.
If, as before, we multiply through by h
k1
h
k
and divide through by h
k
+h
k1
we end up with the system
h
k
h
k
+ h
k1
m
k1
+ 2
_
1 +
(1/2)
k
h
k
h
k1
h
k
+ h
k1
_
m
k
+
h
k1
h
k
+ h
k1
m
k+1
3.8. TENSIONED SPLINES: -SPLINES 65
= 3
h
k
(y
k
y
k1
)
h
k1
(h
k
+ h
k1
)
+ 3
h
k1
(y
k+1
y
k
)
h
k
(h
k
+ h
k1
)
, k = 2, . . . , l.
Using the same abbreviations as before (i.e
k
,
k
, c
k
) we end up with the
matrix equation
_
_
_
_
_
_
_
_
_
_
_
_
_

1

1

2

2

2

3

3

3
.
.
.

l1

l1

l1

l

l

l

l+1

l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
m
1
m
2
m
3
.
.
.
m
l1
m
l
m
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
_
c
1
c
2
c
3
.
.
.
c
l1
c
l
c
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
,
(13)
where the
i
are such that

i
=
_
_
_
2 i = 1
2 +
i

i
h
i1
i = 2, . . . , l
2 i = l + 1
.
The rst and last equation correspond to the two end conditions and any of
the methods used for their specication in cubic spline interpolation can be
used here. Note that for non-zero
i
the function generated is now only C
1
continuous. In order to guarantee a unique solution to the above equations
we need all the
i
0.
The eect of the
i
on the shape of the interpolant is best seen by considering
a limiting case. Suppose we let the jth of the
i
tend to innity. Then the
jth equation in (13) reduces to m
j
= 0. The eect of increasing the value
of
j
is therefore a reduction in the magnitude of the slope which has the
eect of attening the curve at the data point. This eect of the
i
leads to
their description as tension parameters. The higher the values of the tension
parameters, the tighter the curve and the more the extraneous kinks become
straightened out.
Recall that the cubic spline interpolant with natural end conditions can be
viewed as the smooth piecewise function minimizing the quantity
66 CHAPTER 3. SPLINES
b
_
a
[s

(x)]
2
dx.
Tensioned splines can be thought of as functions that minimize the more
general expression
b
_
a
[s

(x)]
2
+
l

i=2

i
m
2
i
.
If several of the
i
are chosen to be very large, the minimization of this
expression forces the corresponding slopes m
i
to become small.
3.9 Weighted -splines
Given point tension factors (
i
)
l
i=1
and interval weights (w
i
)
l
i=1
, the weighted
-spline interpolant is the C
1
piecewise cubic curve s(x) that minimizes
l

i=1
_
w
i

i+1
_

i
|s

(x)|
2
dx
_
+
l

i=2

i
|s

(
i
)|
2
,
over all C
1
piecewise cubics s(x) subject to s(
i
) = y
i
for i = 1, . . . , l + 1.
The equations for these splines are similar to the tensioned spline equations
above. The matrix system is
_
_
_
_
_
_
_
_
_
_
_
_
_

1

1
w
1

2

2
w
2

2
w
2

3

3
w
3

3
.
.
.
w
l2

l1

l1
w
l1

l1
w
l1

l

l
w
l

l+1

l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
m
1
m
2
m
3
.
.
.
m
l1
m
l
m
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
_
c
1
c
2
c
3
.
.
.
c
l1
c
l
c
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
,
where the
i
are such that
3.9. WEIGHTED -SPLINES 67

i
=
_
_
_
2 i = 1
2w
i1

i
+ 2w
i

i
+
i

i
h
i1
i = 2, . . . , l
2 i = l + 1
,
and the c
i
are
c
i
= 3w
i1

i
_
(y
i
y
i1
)/h
i1
_
+ 3w
i

i
_
(y
i+1
y
i
)/h
i
_
, i = 2, . . . , l.
Again the rst and last equation in the system correspond to the two end
conditions. If we let all the w
i
= 1 in this tridiagonal system we return to
the tensioned spline, while if we let all the
i
= 0 we obtain a weighted spline
which minimizes the expression
l

i=1
_
w
i

i+1
_

i
|s

(x)|
2
dx
_
.
If all the weights are set to a constant w
i
= c say, then s is the -spline
interpolant with tension factors
i
/c for i = 2, . . . , l. If both w
i
= 1 and

i
= 0 for all i we return to the standard cubic interpolating spline. In fact
at a breakpoint of the spline the relevant continuity equation (cf equation
12) for the weighted -spline is
w
k
s

(
+
k
) w
k1
s

k
) =
k
m
k
, k = 2, . . . , l.
From this it is clear that if w
k
= w
k1
and
k
= 0, then the weighted -spline
is C
2
at
k
. Collecting these results together we have
conventional spline: s

(
+
k
) s

k
) = 0
-spline: s

(
+
k
) s

k
) =
k
m
k
weighted spline: w
k
s

(
+
k
) w
k1
s

k
) = 0
weighted -spline: w
k
s

(
+
k
) w
k1
s

k
) =
k
m
k
Note that whereas the conventional spline is C
2
continuous the others are in
general only C
1
continuous.
68 CHAPTER 3. SPLINES
3.9.1 The eect of the weights
The weights (w
i
)
l
i=1
attached to the intervals ([
i
,
i+1
])
l
i=1
have the eect of
making the spline tighter on an interval when a given w
i
is large on one
interval relative to bordering intervals. It can be shown that if the interval
weight w
j
, then s

(u) 0 on the interval [


j
,
j+1
]. Since s is piecewise
cubic, s approaches the linear interpolant on this interval. It is apparent that
the parameters
i
control point tension whereas the w
i
control interval tension.
Figure 3.2 shows a functional natural weighted -spline.
Considering the parametric case, if
k
then the magnitude of the tangent
vector approaches zero at the data point and the shape of the curve at the
k-th data point will give the appearance of a corner. In this case it is clear
why the
i
are referred to as point tension parameters.
3.10 Cardinal spline basis
turning to our problem of constructing a basis for S
4
(P
l
), we now have a
method for producing one. It is obtained by computing cubic interpolating
splines, s
i
(x), where the s
i
(x) satisfy the following conditions:
s
i
(
j
) =
ij
, i, j = 1, . . . , l + 1, s

i
(
1
) = 0, s

i
(
l+1
) = 0,
s
l+2
(
j
) = 0, j = 1, 2, . . . , l + 1, s

l+2
(
1
) = 1, s

l+2
(
l+1
) = 0,
s
l+3
(
j
) = 0, j = 1, 2, . . . , l + 1, s

l+3
(
1
) = 0, s

l+3
(
l+1
) = 1.
Figure 3.3 shows the nature of these functions.
Figure 3.2: Cardinal spline basis function
This basis is called a cardinal spline basis. Note there are l+3 functions, agreeing
with our formula for the dimension of S
4
(P
l
). In terms of these functions we
can write down the solution to a given cubic spline interpolation problem,
with end derivatives specied, immediately. In particular, if we wish to nd
3.10. CARDINAL SPLINE BASIS 69
the cubic spline that takes on values (y
i
)
l+1
i=1
at (
i
)
l+1
i=1
and has end slopes
m
1
, m
l+1
, the solution is
s(x) =
l+1

i=1
y
i
s
i
(x) + m
1
s
l+2
(x) + m
l+1
s
l+3
(x).
Clearly s(x) satises all the conditions of the problem. The cardinal basis
functions behave in a similar fashion to the Lagrange basis functions.
To take another example, suppose we wish to compute a cubic interpolating
spline with specied end second derivatives and say. Using the matrix
method we compute splines (s
i
(x))
l+3
i=1
such that
s
i
(
j
) =
ij
, i, j = 1, . . . , l + 1, s

i
(
1
) = 0, s

i
(
l+1
) = 0,
s
l+2
(
j
) = 0, j = 1, . . . , l + 1, s

l+2
(
1
) = 1, s

l+2
(
l+1
) = 0,
s
l+3
(
j
) = 0, j = 1, . . . , l + 1, s

l+3
(
1
) = 0, s

l+3
(
l+1
) = 1.
In terms of these basis functions the solution to the problem is given by the
spline s(x), where
s(x) =
l+1

i=1
y
i
s
i
(x) + s
l+2
(x) + s
l+3
(x).
The cardinal spline representation for the natural cubic spline can be obtained
by setting = 0 and = 0.
One drawback of the above type of basis functions is their almost global non-
zero nature (see gure 3.3). To compute a spline written in terms of these
functions at some point not equal to one of the segment breakpoints requires
the computation of all the s
i
(x) at that point (since they are all non-zero
there). It is possible to construct a basis for S
4
(P
l
) and in general S
k
(P
l
)
consisting of functions that are zero over much of the range [
1
,
l+1
]. These
basis functions are called B-splines (B for basis). (It is also true that the

i
,
i
have this desirable local non-zero property, but since they are only C
1
continuous they are not basis functions for S
4
(P
l
)).
70 CHAPTER 3. SPLINES
3.11 Summary
Piecewise interpolation with cubic polynomial functions with C
1
or C
2
continuity at the breakpoints. Hermite form for representation.
C
1
case: choose slope values at the data points.
C
2
case: solution in the linear spline space S
k
(P
l
) with dim equal to
k + l 1. Tridiagonal matrix equation for the slopes. End conditions
required for solution.
Tensioned splines (-splines): apply tension parameters at data points
to minimize unwanted inection points.
Weighted -splines: apply weights to the intervals to tighten the curve.
Cardinal spline basis for C
2
interpolation with given end conditions.
Chapter 4
B-spline basis functions
Assume that we are given some partition of the interval [a, b], call it (t
i
),
where for the moment we dont x any limits on i but assume that the (t
i
)
are distinct and form a subset of our partition:
P
l
=
_

i
: a =
1
< . . . <
l+1
= b
_
.
The t
i
are called knots and they correspond to segment breakpoints.
We wish to nd the smallest sub-interval of the partition over which a spline,
B(t) say, can be non-zero. To do this we consider the sub-interval [t
i
, t
i+j
] and
ask how large must j be? For the cubic case B(t) must satisfy the following:
B(t
i
) = B

(t
i
) = B

(t
i
) = 0
and
B(t
i+j
) = B

(t
i+j
) = B

(t
i+j
) = 0.
The dimension of S
4
(P
j
) is 3 + j and this must be 6 from the number
of conditions we have prescribed above. If j = 3 then a possible solution is
B(t) 0, but by uniqueness this is the only solution. If j = 4 there is one
degree of freedom and hence one extra condition can be prescribed (hence
j = k the order). This condition is generally taken to be
t
i+4
_
t
i
B(t)dt = 1/k.
Note that zero is not the solution here.
71
72 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
Notation
The standardized B-spline basis function of order k is denoted by M
i,k
(t). It is
an element of S
k
(P
l
), dened over the knot set t
i
, . . . , t
i+k
, and satises
M
i,k
(t) 0 on [t
i
, t
i+k
],
t
i+k
_
t
i
M
i,k
(t)dt = 1/k.
The normalized B-spline basis function, denoted N
i,k
(t), is dened as
N
i,k
(t) = (t
i+k
t
i
)M
i,k
(t).
4.1 Truncated power functions
To nd a formula for M
i,k
(t) we look rst at constructing another basis for
S
k
(P
l
) consisting of what are called, truncated power functions. These are dened
as follows:
(t a)
k
+
=
_
(t a)
k
t a 0
0 t a < 0
.
Figure 4.1 shows what these functions look like.
Figure 4.1: Truncated power functions: constant, linear, quadratic, and cubic
They are like the ordinary power function when the argument is positive
and zero when the argument is negative. They also have (k 1) continuous
derivatives at t = a,
4.1. TRUNCATED POWER FUNCTIONS 73
d
dt
(t a)
k
+
, . . . ,
d
k1
dt
k1
(t a)
k
+
,
where
d
dt
(t a)
k
+
= k(t a)
k1
+
=
_
k(t a)
k1
t a 0
0 t a < 0
.
There is however a jump discontinuity in the kth derivative at a (it has the
value 0 to the left of a and k! to the right of a). They do have the required
continuity level in order to be splines and using them we can form a basis for
S
k
(P
l
). In particular, the set of functions
_
1, (t t
1
), (t t
1
)
2
, . . . , (t t
1
)
k1
, (t t
2
)
k1
+
, . . . , (t t
l
)
k1
+
_
forms a basis for S
k
(P
l
). There are k + l 1 functions here, so we have the
correct number for a basis. Each element of the set certainly belongs to S
k
(P
l
)
(i.e can be viewed as a piecewise polynomial of order k on [
1
,
l+1
] with k1
continuous derivatives), so the only thing to show is that they are linearly
independent. Suppose then that there are constants a
1
, . . . , a
k
, b
2
, . . . , b
l
such
that
f(t) =
k

i=1
a
i
(t t
1
)
i1
+
l

i=2
b
i
(t t
i
)
k1
+
0.
We must show that in this case all the a
i
, b
i
are zero. Evaluating f and its
derivatives at t
1
gives
f(t
1
) = a
0
= 0, f

(t
1
) = a
1
= 0, . . . , f
(k2)
(t
1
) = (k2)!a
k2
= 0, f
(k1)
(t
1
) =
(k 1)!a
k1
= 0,
while for the b
i
s we have
f(t
3
) = b
2
(t
3
t
2
)
k1
= 0 b
2
= 0, . . . , f(t
l+1
) = b
l
(t
l+1
t
l
)
k1
= 0 b
l
=
0.
Hence they are linearly independent and so form a basis for S
k
(P
l
).
74 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
4.1.1 A formula for M
i,k
(t):
Recall the non-recursive divided dierence formula (2) on page 8:
y[t
i
, t
i+1
, . . . , t
i+k
] =
i+k

j=i
y
j
w

(t
j
)
,
where
w

(t
j
) =
i+k

l=i,l=j
(t
j
t
l
).
Consider the function

k
(s; t) = (s t)
k1
+
,
and form the kth divided dierence of
k
(s; t) in s based on t
i
, . . . , t
i+k
(i.e
we x a value of t and by considering
k
as a function of s, form the kth
divided dierence on the points t
i
, . . . , t
i+k
. The result depends on the value
of t we use and hence can be considered a function of t):

k
[t
i
, . . . , t
i+k
; t] =
i+k

j=i
(t
j
t)
k1
+
w

(t
j
)
. (14)
If we call this function (t), the following properties hold:
i/ (t) S
k
(P
l
),
ii/ (t) 0 for t < t
i
,
iii/ (t) 0 for t > t
i+k
,
iv/
t
i+k
_
t
i
(t)dt = 1/k.
These are precisely the conditions required for our B-spline basis function.
To show i/, ii/, iii/ and iv/ are true note that:
4.1. TRUNCATED POWER FUNCTIONS 75
i/ (t) S
k
(P
l
) since (14) is a linear combination of truncated power func-
tions. We have already shown above that these are basis functions for S
k
(P
l
),
ii/ if t < t
i
, then
(t) =
i+k

j=i
(t
j
t)
k1
w

(t
j
)

k
,
but (t) is the kth divided dierence of a polynomial function of degree k1
and hence must be identically zero (see page 6).
iii/ if t > t
i
, then all the truncated power functions in (14) are zero by
denition,
iv/ we have
t
i+k
_
t
i
(t)dt =
i+k

j=i
t
j
_
t
i
(t
j
t)
k1
w

(t
j
)
= (1/k)
i+k

j=i
(t
j
t)
k
w

(t
j
)
|
t
j
t
i
= (1/k)
_
i+k

j=i
1
w

(t
j
)
(t
j
t
i
)
k
_
.
The expression within the large brackets is equal to one since it is the kth
divided dierence of
k+1
(s; t
i
)
k
, based on t
i
, . . . , t
i+k
. This must equal
one as it is by denition the coecient of s
k
in
k+1
(s; t
i
) = (s t
i
)
k
.
Therefore (t) satises the conditions to be a B-spline basis function and we
have the formula
M
i,k
(t) = (t) =
k
[t
i
, . . . , t
i+k
; t] =
i+k

j=i
(t
j
t)
k1
+
w

(t
j
)
.
Example:
76 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
Find the quadratic B-spline basis function M
1,3
(t) on the knot set (0, 1, 2, 3).
M
1,3
(t) =
4

j=1
(t
j
t)
2
+
w

(t
j
)
, w

(t
j
) =
4

l=1,l=j
(t
j
t
l
),
w

(0) = (0 1)(0 2)(0 3) = 6,


w

(1) = (1 0)(1 2)(1 3) = 2,


w

(2) = (2 0)(2 1)(2 3) = 2,


w

(3) = (3 0)(3 1)(3 2) = 6.


Hence
M
1,3
(t) =
(t)
2
+
6
+
(1 t)
2
+
2
+
(2 t)
2
+
2
+
(3 t)
2
+
6
.
Splitting this up into the separate intervals we obtain
M
1,3
(t) =
_

_
0 t < 0
(1t)
2
2
+
(2t)
2
2
+
(3t)
2
6
0 t < 1
(2t)
2
2
+
(3t)
2
6
1 t < 2
(3t)
2
6
2 t < 3
0 t 3
.
Then e.g M
1,3
(1) = 1/6. The function M
1,3
(t) is a piecewise quadratic poly-
nomial with rst derivative continuity at the knots (0, 1, 2, 3). Figure 4.2
shows N
1,3
(t).
4.1. TRUNCATED POWER FUNCTIONS 77
Figure 4.2: N
1,3
(t) on knot set (0, 1, 2, 3)
Example:
Find the cubic B-spline basis function N
1,4
(t) on the knot set
(3, 2, 1, 0, 1).
M
1,4
(t) =
5

j=1
(t
j
t)
3
+
w

(t
j
)
, w

(t
j
) =
5

l=1,l=j
(t
j
t
l
),
w

(3) = (3 + 2)(3 + 1)(3 + 0)(3 1) = 24,


w

(2) = (2 + 3)(2 + 1)(2 + 0)(2 1) = 6,


w

(1) = (1 + 3)(1 + 2)(1 + 0)(1 1) = 4,


w

(0) = (0 + 3)(0 + 2)(0 + 1)(0 1) = 6,


w

(1) = (1 + 3)(1 + 2)(1 + 1)(1 0) = 24,


so
N
1,4
(t) = 4
_
(3 t)
3
+
24
+
(2 t)
3
+
6
+
(1 t)
3
+
4
+
(t)
2
+
6
+
(1 t)
2
+
24
_
.
Splitting this up into the separate intervals we obtain
78 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
N
1,4
(t) =
_

_
0 t < 3
(2t)
3
6
+
2(1t)
3
3
+
2(t)
3
3
+
(1t)
3
6
3 t < 2
2(1t)
3
3
+
2(t)
3
3
+
(1t)
3
6
2 t < 1
2(t)
3
3
+
(1t)
3
6
1 t < 0
(1t)
3
6
0 t < 1
0 t 1
.
Expressing these in explicit polynomial form we get
N
1,4
(t) =
_

_
0 t < 3
(t
3
+ 3t
2
3t + 1)/6 3 t < 2
(3t
3
6t
2
+ 4)/6 2 t < 1
(3t
3
+ 3t
2
+ 3t + 1)/6 1 t < 0
t
3
/6 0 t < 1
0 t 1
.
Figure 4.3 shows N
1,4
(t).
Figure 4.3: N
1,4
(t) on knot set (0, 1, 2, 3, 4)
The two basis functions M
1,3
, N
1,4
constructed are examples of what are called
uniform B-spline basis functions, that is they are dened over a knot set with
constant interval width. A basis consisting of such functions is computationally
good to work with as it has the advantage that all the functions are simply
translates of one another.
Figure 4.4 shows the uniform constant, linear, quadratic, cubic and quartic
B-spline basis functions.
4.2. B-SPLINE RECURSION FORMULA 79
Figure 4.4: Constant, linear, quadratic, cubic basis functions (uniform knot
set)
Note the change in the continuity level as the order increases.
4.2 B-spline recursion formula
The formula we have derived above for a B-spline basis function of order k
based on truncated power functions is a useful theoretical result. It gives
us an immediate description of a basis function as a piecewise polynomial.
For the numerical computation of B-splines however, there is a much more
stable method available. This is called the Manseld-Cox-de Boor formula after
the three people who discovered it (independently). In this method the basis
functions are evaluated via the following recursive formula:
M
i,1
(t) =
_
1
t
i+1
t
i
t
i
t < t
i+1
0 otherwise
M
i,k
(t) =
t t
i
t
i+k
t
i
M
i,k1
(t) +
t
i+k
t
t
i+k
t
i
M
i+1,k1
(t), k 2.
The corresponding denition for the normalized B-spline N
i,k
(t) is
N
i,1
(t) =
_
1 t
i
t < t
i+1
0 otherwise
80 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
N
i,k
(t) =
t t
i
t
i+k1
t
i
N
i,k1
(t) +
t
i+k
t
t
i+k
t
i+1
N
i+1,k1
(t), k 2. (15)
The proof of this recursive formula is quite straightforward. Recall Leibniz
formula on page 5:
h[s
0
, . . . , s
k
] =
k

r=0
f[s
0
, . . . , s
r
]g[s
r
, . . . , s
k
],
for the kth divided dierence of the function h(s) = f(s)g(s) in terms of the
divided dierences of f(s) and g(s). If we apply this formula to the function
h(s) =
k
(s; t) =
k1
(s; t)(s t)
we get

k
[t
i
, . . . , t
i+k
; t] =
k1
[t
i
, . . . , t
i+k1
; t].1 +
k1
[t
i
, . . . , t
i+k
; t].(t
i+k
t),
where all divided dierences of (s t) of order 2 and higher vanish. Hence,
using the previous denition (14) of M
i,k
(t) and the recursive formula (3) for
the divided dierence, we have
M
i,k
(t) = M
i,k1
(t) +
t
i+k
t
t
i+k
t
i
(M
i+1,k1
(t) M
i,k1
(t)),
=
t t
i
t
i+k
t
i
M
i,k1
(t) +
t
i+k
t
t
i+k
t
i
M
i+1,k1
(t).
This identity states that for t
i
< t < t
i+k
, M
i,k
(t) is strictly a convex combination
of the numbers M
i,k1
(t) and M
i+1,k1
(t) (similarly for the N
i,k
(t)). Since
M
i,1
(t) is positive for t
i
t < t
i+1
and zero otherwise, it follows by induction
that, for k > 1, M
i,k
(t) is positive for t
i
< t < t
i+k
and zero otherwise. It
is these properties that make the recursion formula so nice for calculation
purposes.
From now on we will always use the normalized B-spline functions N
i,k
(t),
rather than the M
i,k
(t), as a basis. The main reason for this is that in addition
to the properties cited above, a basis consisting of the N
i,k
(t) functions also
satises the condition
4.2. B-SPLINE RECURSION FORMULA 81

i
N
i,k
(t) 1. (16)
This property, as we shall see later, is very useful in a CAD environment. To
show that (16) holds we use the recursive formula (15) for the N
i,k
(t) and
induction.
It clearly holds for k = 1 by denition of the N
i,1
(t). Assume that it holds
for k 1 and consider a B-spline basis of order k. For t (t
j
, t
j+1
), the local
non-zero nature of the N
i,k
(t) implies that there are only k functions that
contribute to the summation (16) and these occur over the range j k +
1, . . . , j (the left most basis function being non-zero on [t
jk+1
, t
j+1
] and the
right most one over [t
j
, t
j+k
]). Hence

i
N
i,k
(t) =
j

i=jk+1
t t
i
t
i+k1
t
i
N
i,k1
(t) +
j

i=jk+1
t
i+k
t
t
i+k
t
i+1
N
i+1,k1
(t)
for t (t
j
, t
j+1
).
If we now change the index of summation (i i 1) in the second sum on
the right it becomes
j+1

i=jk+2
t
i+k1
t
t
i+k1
t
i
N
i,k1
(t) =
j

i=jk+2
t
i+k1
t
t
i+k1
t
i
N
i,k1
(t),
there being no contribution when i = j + 1 because there is no contribution
from N
i,k1
(t) in (t
j
, t
j+1
). For the same reason there is no contribution from
the rst sum when i = j k + 1 and hence we have

i
N
i,k
(t) =
j

i=jk+2
t t
i
t
i+k1
t
i
N
i,k1
(t) +
j

i=jk+2
t
i+k1
t
t
i+k1
t
i
N
i,k1
(t)
=
j

i=jk+2
N
i,k1
(t) 1. (by the induction hypothesis)
The recursive formula provides us with a neat and ecient way to evaluate
a B-spline function.
82 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
4.3 The evaluation of B-spline functions
To evaluate the function
f(t) =

j
d
j
N
j,k
(t)
at a point t [t
i
, t
i+1
), it is only necessary to calculate the k non-zero numbers
N
j,k
(t) , j = i k + 1, . . . , i;
Then f(t) is given by
f(t) =
i

j=ik+1
d
j
N
j,k
(t).
An ecient method for organising the calculation comes from the following:
f(t) =

i
d
i
N
i,k
(t)
=

i
d
i
_
(t t
i
)M
i,k1
(t) + (t
i+k
t)M
i+1,k1
(t)
_
=

i
_
d
i
(t t
i
) + d
i1
(t
i+k1
t)
_
M
i,k1
(t)
=

i
d
1
i
(t)N
i,k1
(t) ,
where
d
1
i
(t) =
t t
i
t
i+k1
t
i
d
i
+
t
i+k1
t
t
i+k1
t
i
d
i1
.
If we set
d
j
i
(t) =
_
d
i
, j = 0
tt
i
t
i+kj
t
i
d
j1
i
(t) +
t
i+kj
t
t
i+kj
t
i
d
j1
i1
(t) , j > 0
(17)
we obtain
4.3. THE EVALUATION OF B-SPLINE FUNCTIONS 83
f(t) =

i
d
j
i
(t)N
i,kj
(t).
Now f(t) is written in terms of normalized B-splines of lower order. Since
N
i,1
(t) = 1 for t
i
t < t
i+1
and zero otherwise, it follows that
f(t) = d
k1
i
(t) , t
i
t < t
i+1
.
Hence if t [t
i
, t
i+1
), f(t) can be found from d
ik+1
, . . . , d
i
by forming convex
combinations according to (17). The convexity of the calculation, i.e
d
j
i
= d
j1
i
+ (1 )d
j1
i1
,
where = (t t
i
)/(t
i+kj
t
i
), assures the numerical stability of the process.
Utilising the above formula for f(t) in terms of the d
j
i
we need rst to nd i
such that t
i
t < t
i+1
. Having found the correct i we generate all the entries
in the following triangular table using (17):
d
0
ik+1
(t)
d
0
ik+2
(t) d
1
ik+2
(t)
.
.
.
.
.
.
.
.
.
d
0
i1
(t) d
1
i1
(t) . . . d
k2
i1
(t)
d
0
i
(t) d
1
i
(t) . . . d
k2
i
(t) d
k1
i
(t)
The right most entry d
k1
i
(t) is then the desired f(t). By specialising to the
case d
i
=
ij
the algorithm can be used to evaluate the single basis function
N
j,k
(t).
Example:
Suppose we wish to nd the value f(1.5) where the cubic B-spline function
f(t) is
f(t) =
7

i=1
d
i
N
i,4
(t),
84 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
on the knot set (t
i
)
11
i=1
= (0, 0, 0, 0, 1, 1, 2, 3, 3, 4, 5) (the repeated values ap-
pearing here are explained a little later on).
First, we have t
6
1.5 < t
7
and so i = 6. The corresponding triangular table
is
d
0
3
(1.5)
d
0
4
(1.5) d
1
4
(1.5) =
3
4
d
0
4
+
1
4
d
0
3
d
0
5
(1.5) d
1
5
(1.5) =
1
4
d
0
5
+
3
4
d
0
4
d
2
5
(1.5) =
1
2
d
1
5
+
1
2
d
1
4
d
0
6
(1.5) d
1
6
(1.5) =
1
4
d
0
6
+
3
4
d
0
5
d
2
6
(1.5) =
1
4
d
1
6
+
3
4
d
1
5
d
3
6
(1.5) =
1
2
d
2
6
+
1
2
d
2
5
Then f(1.5) = d
3
6
(1.5).
Example: Suppose we wish to evaluate the B-spline basis function N
4,4
(t)
on the knot set (0, 1, 1, 2, 3) from the previous example at t = 2.
Here d
i
= 0 for i = 4 and d
4
= 1. We also have t
7
2 < t
8
and so i = 7.
The only non-zero contributions from the triangular array come from the top
diagonal
d
0
4
(2) d
1
5
(2) d
2
6
(2) d
3
7
(2).
The calculations are
d
0
4
(2) = 1
d
1
5
(t) =
t t
5
t
8
t
5
d
0
5
(t) +
t
8
t
t
8
t
5
d
0
4
(t) =
2 1
3 1
0 +
3 2
3 1
1 =
1
2
d
2
6
(t) =
t t
6
t
8
t
6
d
1
6
(t) +
t
8
t
t
8
t
6
d
1
5
(t) =
2 1
3 1
0 +
3 2
3 1
1
2
=
1
4
d
3
7
(t) =
t t
7
t
8
t
7
d
2
7
(t) +
t
8
t
t
8
t
7
d
2
6
(t) =
2 2
3 2
0 +
3 2
3 2
1
4
=
1
4
Then N
4,4
(2) = d
3
7
(2) =
1
4
.
4.3. THE EVALUATION OF B-SPLINE FUNCTIONS 85
If we dene
A(r, s) = d
s1
ik+r
(t) , r = s, . . . , k ; s = 1, . . . , k,
DP(r) = t
i+r
t , DM(r) = t t
ik+r
, r = 1, . . . , k,
the generation of the triangular table reduces to the following algorithm.
Algorithm 6: Point evaluation of B-splines (1)
for r = 1, . . . , k, do:
A(r, 1) = d
ik+r
DP(r) = t
i+r
t
DM(r) = t t
ik+r
for s = 1, . . . , k 1, do:
for r = s + 1, . . . , k, do:
A(r, s + 1) =
DM(r)A(r,s)+DP(rs)A(r1,s)
(DM(r)+DP(rs))
.
Then f(t) = A(k, k).
The calculation of the A(r, s) can be carried out column by column i.e with
r = s, . . . , k ; s = 2, . . . , k.
This requires just one 1-D array with k entries for the storage of the succes-
sively calculated numbers A(r, s).
If one wishes to evaluate a given B-spline basis function in isolation, i.e
not considering it as being part of a B-spline function, then it is possible
to use simply the recursion formula (15). To nd the value of the basis
function N
j,k
(t) dened on the knot set t
j
, . . . , t
j+k
we rst nd i such that
t
i
t < t
i+1
(so as to isolate the single non-zero constant B-spline function
that contributes). Then we generate the following triangular array using
(15):
86 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
N
j,1
(t)
N
j+1,1
(t) N
j,2
(t)
.
.
.
.
.
.
.
.
.
N
j+k2,1
(t) N
j+k3,2
(t) . . . N
j,k1
(t)
N
j+k1,1
(t) N
j+k2,2
(t) . . . N
j+1,k1
(t) N
j,k
(t)
Example: Find the value of the basis function N
4,4
(t) on (0, 1, 1, 2, 3) at
t = 2.
(Note that if we are considering the basis function in isolation it does not
matter what index we attach to it; we could equally well call this one N
1,4
(t).
However, note that the knot index range changes from t
4
, . . . , t
8
to t
1
, . . . , t
5
.)
For this example the value of i is 7 and the corresponding triangular array is
N
4,1
(2)
N
5,1
(2) N
4,2
(2)
N
6,1
(2) N
5,2
(2) N
4,3
(2)
N
7,1
(2) N
6,2
(2) N
5,3
(2) N
4,4
(2)
The only row that contributes is the bottom one and, using (15), this gives
us numbers
1 1 1/2 1/4.
If the value of f(t) and some of its derivatives (see below) are required at
the same time, it is better to use an algorithm that generates at the same
time all the B-spline basis functions N
i,j
(t) that are non-zero for the given t.
Assuming again that the index i has been found such that
t
i
t < t
i+1
,
we generate all entries in the following table:
N
i,1
(t) N
i1,2
(t) . . . N
ik+2,k1
(t) N
ik+1,k
(t)
N
i,2
(t) . . . N
ik+3,k1
(t) N
ik+2,k
(t)
.
.
.
.
.
.
.
.
.
N
i,k1
(t) N
i1,k
(t)
4.3. THE EVALUATION OF B-SPLINE FUNCTIONS 87
N
i,k
(t)
Example:
Suppose we wish to nd the value at t = 1.5 of all the non-zero basis functions
from the previous example. The corresponding triangular table is:
N
6,1
(1.5) N
5,2
(1.5) N
4,3
(1.5) N
3,4
(1.5)
N
6,2
(1.5) N
5,3
(1.5) N
4,4
(1.5)
N
6,3
(1.5) N
5,4
(1.5)
N
6,4
(1.5)
Using the recursive formula (15) gives the followinglatex part1.te values:
1 1/2 1/4 1/16
1/2 5/8 21/32
1/8 1/4
1/32
Note that as a check each column should add up to 1.
We can generate the above general triangular table column by column as
follows:
Set
N(r, s) = N
i+rs,s
(t) ,
DP(r) = t
i+r
t , DM(r) = t t
i+1r
, r = 1, . . . , k,
then the required entries in the table are
N(r, s) , r = 1, . . . , s ; s = 1, . . . , k.
Here
N(r, s) = 0 , for r > s or r < 1.
88 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
Using the recursive formula (15) for the N
i,k
(t) and the above abbreviations
we get
N(r, s + 1) = DM(s + 1 r + 1)
N(r 1, s)
DP(r 1) + DM(s + 1 r + 1)
+DP(r)
N(r, s)
DP(r) + DM(s + 1 r)
.
The algorithm for the generation of the N(r, s) is then:
Algorithm 7: Point evaluation of B-splines (2)
N(1, 1) = 1;
for s = 1, . . . , k 1, do:
DP(s) = t
i+s
t ,
DM(s) = t t
i+1s
,
N(1, s + 1) = 0;
for r = 1, . . . , s, do:
M = N(r, s)/((DP(r) + DM(s + 1 r)) ,
N(r, s + 1) = N(r, s + 1) + DP(r) M ,
N(r + 1, s + 1) = DM(s + 1 r) M.
It is possible to use a 1-D array of k entries for the N(r, s) by overwriting
successive columns.
4.4 Derivative evaluation for B-splines
To dierentiate f(t) we note that from the divided dierence recursion for-
mula (3) we have,
N
(1)
i,k
(t) = (d/dt)
_
(t
i+k
t
i
)
k
[t
i
, . . . , t
i+k
; t]
_
= (d/dt)
_

k
[t
i+1
, . . . , t
i+k
; t]
k
[t
i
, . . . , t
i+k1
; t]
_
4.4. DERIVATIVE EVALUATION FOR B-SPLINES 89
= (k 1)
_
M
i+1,k1
(t) M
i,k1
(t)
_
.
Hence
f
(1)
(t) = (k 1)

i
d
i
_
M
i,k1
(t) M
i+1,k1
(t)
_
= (k 1)

i
d
(1)
i
N
i,k1
(t) ,
where
d
(1)
i
= (d
i
d
i1
)/(t
i+k1
t
i
).
Generally, with
d
(0)
i
= d
i
,
d
(j)
i
= (d
(j1)
i
d
(j1)
i1
)/(t
i+kj
t
i
) j > 0 ,
we have
f
(j)
(t) = (k 1) . . . (k j)

i
d
(j)
i
N
i,kj
(t).
It is possible to calculate f
(j)
(t) by using algorithm 7, noting that the (k
j)th column of this table contains the numbers needed for the derivative
evaluation. The coecients d
(j)
i
can also be arranged in a triangular table as
follows:
d
(0)
ik+1
d
(0)
ik+2
d
(1)
ik+2
.
.
.
.
.
.
.
.
.
d
(0)
i1
d
(1)
i1
. . . d
(k2)
i1
d
(0)
i
d
(1)
i
. . . d
(k2)
i
d
(k1)
i
90 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
Having calculated the array N(r, s) from algorithm 7, using the appropriate
value of i so that t
i
t < t
i+1
, we dene
A(r, s) = d
(s1)
ik+r
, r = s, . . . , k; s = 1, . . . k,
DP(r) = t
i+r
t , DM(r) = t t
ik+r
, r = 1, . . . , k.
The generation of the above table then reduces to the following algorithm:
Algorithm 8: Derivative evaluation of B-splines
for r = 1, . . . , k, do:
A(r, 1) = d
ik+r
DP(r) = t
i+r
t
DM(r) = t t
ik+r
for s = 1, . . . , k 1, do:
for r = s + 1, . . . , k, do:
A(r, s + 1) = (A(r, s) A(r 1, s))/(DM(r) + DP(r s)).
Finally, for the evaluation of the jth derivative of f at t we take the (kj)th
column of the N(r, s) array, that is
N(r, s) for r = 1, . . . , s; s = k j,
and perform the summation:
FJ(1) = 0
for l = 1, . . . , k j, do:
FJ(l + 1) = FJ(l) + N(l, k j) A(l + j, j)
for l = 1, . . . , j, do:
FJ(k j + 1) = (k l) FJ(k j + 1).
Then f
(j)
(t) = FJ(k j + 1).
4.4. DERIVATIVE EVALUATION FOR B-SPLINES 91
4.4.1 Expressing the rth derivative of a B-spline func-
tion as a B-spline function
We can use the formula for the derivative of a B-spline function to express the
rth derivative directly as a B-spline function itself. An example illustrates
how this is done.
Example: express the second derivative of the following B-spline function
as a B-spline.
f(t) =
12

i=1
d
i
N
i,4
(t) ,
on the knot set (u
i
)
16
i=1
= (0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 5, 5).
We know that the second derivative of this function is given by
f
(2)
(t) =

i
d
(2)
i
N
i,2
(t).
We need to determine a knot set and the control points.
Step 1: Compute the control points d
(2)
i
using the triangular array for each
segment of the B-spline.
In this example we have four segments, and the four triangular arrays (cor-
responding to the indices 4, 6, 9, 10, 12) gives us the following control points
(d
(2)
3
, d
(2)
4
, d
(2)
5
, d
(2)
6
, d
(2)
8
, d
(2)
9
, d
(2)
9
, d
(2)
10
, d
(2)
11
, d
(2)
12
)
We need to delete any repetitions in the control point list. This can be
conveniently be done by forming an overlap list indicating the overlap of
control points from one segment to the next. For the original function this
list is (2, 1, 3, 2) and for the rth derivative function it will be (2 r, 1 r, 3
r, 2 r). For r = 2 this gives (0,-1,1,0). This indicates an overlap of one
control point from the 3rd to the 4th segment (i.e d
(2)
9
, and hence this one
can be left out on computing the control points for the 4th segment.
Step 2: From the list of control points in step 1 with indices
(3,4,6,8,9,10,11,12), form the knot set by selecting the knots with these in-
92 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
dices from the original set. In addition take the r knots following the last
one selected. This gives us the list
(t
3
, t
4
, t
6
, t
8
, t
9
, t
10
, t
11
, t
12
, t
13
, t
14
) = (0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5)
We now have the control points (d

i
)
8
i=1
and knot set (u

i
)
10
i=1
for the B-spline
representation for f
(2)
(t):
f
(2)
(t) =
8

i=1
d

i
N
i,2
(t).
4.5 Coincident knots in B-spline basis func-
tions
It is useful to consider what happens to a B-spline basis function when some
of the knots are allowed to coalesce. This is best seen with an example. We
construct the quadratic B-spline M
1,3
(t) on the knot set
t
1
= 0 , t
2
= 1 , t
3
= 1 + d , t
4
= 2 + d,
where d, for the moment, is a small positive constant. Working out the
components of M
1,3
(t) we nd that
s(t) =
_

_
0 t < 0
t
2
0 t < 1
(2t(t d 2) + d + 2)/d 1 t < 1 + d
(2 + d t)
2
1 + d t < 2 + d
0 2 + d t
.
The spline is shown in gure 4.5a for d = 0.5.
4.5. COINCIDENT KNOTS IN B-SPLINE BASIS FUNCTIONS 93
(a) M
1,3
(t) on knot set (0, 1, 1.5, 2)
The value of the spline at the midpoint 1 +d/2 is s(1 +d/2) = (d +2)/2. If
we take the limit of this function as d goes to zero, the result is
s(t) =
_

_
0 t < 0
t
2
0 t < 1
(2 t)
2
1 t < 2
0 2 t
.
Figure 4.5b, c and d show s(t) for d = 0.3, 0.1 and 0.0.
(b) M
1,3
(t) on knot set (0, 1, 1.3, 2)
94 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
(c) M
1,3
(t) on knot set (0, 1, 1.1, 2)
(d) M
1,3
(t) on knot set (0, 1, 1, 2)
Figure 4.5:
What has happened is that the continuity level at the knot t
2
= 1 has been
reduced by one. We have only a C
0
join here, where previously there had
been a C
1
join. As two distinct knots coalesce the continuity level at that
knot drops by one. This process can be repeated, each time the multiplicity
of the knot increases by one the continuity level drops by one. The eect is
common to all B-spline basis functions, not just quadratic ones. The general
rule at a breakpoint for a B-spline of order k is:
number of continuity conditions at + number of knots at = k.
4.5. COINCIDENT KNOTS IN B-SPLINE BASIS FUNCTIONS 95
Suppose t
3
in the above example were pushed together with t
2
, t
3
. The re-
sulting B-spline, now on the knot set (0, 1, 1, 1) looks like gure 4.6.
Figure 4.6: N
(
1, 3)(t) on knot set (0, 1, 1, 1)
All continuity is now lost at = 1 though there is still C1 continuity at
= 0. If allow all the knots to coalesce, giving the knot set (0, 0, 0, 0), the
basis function disappears altogether and so for a B-spline of order k it is only
useful to have a multiplicity of at most k for any particular knot.
Example:
The quartic basis function N
1,5
(t) on the knot set (0, 0, 0, 1, 2, 2) is C
1
at
= 0, C
3
at = 1 and C
2
at = 2, see gure 4.7.
Figure 4.7: N
(
1, 5)(t) on knot set (0, 0, 0, 1, 2, 2)
The recursion algorithms (6) and (7) for computing B-splines on these more
general non-uniform knot sets can still be utilised (our earlier examples included
multiple knots). In fact for algorithm 6 we note that the factor DM(r) +
DP(r s) which occurs as the denominator in the algorithm is such that
96 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
DM(r) +DP(r s) = t t
ik+r
+t
i+rs
t = t
i+rs
t
i+rk
t
i+1
t
i
> 0,
so that coincident points cause no diculty if, as we assume, i is chosen so
that t
i
t < t
i+1
. For algorithm 7 the corresponding expression is
DP(r) + DM(s + 1 r) = t
i+r
t
i+rs
t
i+1
t
i
> 0,
so again there is no problem.
4.6 Extending the linear space S
k
(P
l
)
Having extended the scope of the B-spline basis function through the use
of multiple knots, we would like to extend the denition of the linear space
S
k
(P
l
) in order to include the concept of a variable continuity level. Given
our partition P
l
:
P
l
=
_

i
:
1
<
2
< . . . <
l+1
_
,
we attach an integer sequence (
i
)
l
i=2
, where
i
k (not to be confused
with the tension parameters from chapter 3), which tells us the number of
continuity conditions at each of the internal breakpoints (i.e 1 for C
0
, 2
for C
1
etc). Now consider the space of all piecewise polynomial functions
dened on P
l
with a continuity level at each internal breakpoint dened by
the corresponding
i
. We shall call this space S
k
(P
l
) as before (all we have
done is enlarge the previous S
k
(P
l
)). It is linear space in the same way as
before and has dimension equal to
dim S
k
(P
l
) = kl
l

i=2

i
.
In the case where each internal breakpoint occurs once in the knot sequence
so that each
i
= k1, this reduces to the previous formula kl(k1)(l1) =
k + l 1.
4.7 Forming a basis using B-splines
Given this extended denition for the space S
k
(P
l
) we examine the process
of forming a basis for this space using B-splines. As an example we look
4.7. FORMING A BASIS USING B-SPLINES 97
at the cubic case and take the partition to be P
5
= (
1
, . . . ,
6
), and as-
sume that each breakpoint
2
, . . . ,
5
occurs just once in the knot sequence.
Then dim S
4
(P
5
) = 8, but it is clear from gure 4.8 that we can only t
two cubic B-spline basis functions into the original interval [
1
,
6
]. In order
to form a basis we need to nd six more B-splines. This is done this by
extending the knot set and adding what are sometimes called ctitious, or
more simply extra, knots at either end of the interval until we have the re-
quired eight basis functions. These extra knots can be chosen at will, subject
to the condition that they are not in the open interval (
1
,
l+1
). They are
most commonly chosen to be either a uniform extension of the end knots,

1
,
l+1
, with spacing one, or, by making them coalesce with
1
,
l+1
with the
appropriate multiplicity. For example, if we start with P
5
= (0, 1, 2, 3, 4, 5),
these two methods lead to the knot sets (3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8) and
(0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5) respectively. Figures 4.9a and b show the basis
functions for these two cases.
(a) Cubic bais function on (0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5)
Figure 4.8:
Note that in the rst case the basis functions are dened over a uniform knot
set and so are simply translates of one another.
We look now at the general case of constructing a knot sequence from a given
breakpoint sequence and corresponding sequence (
i
)
l+1
i=1
.
98 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
4.7.1 Construction of a knot sequence from a break-
point sequence
For a given partition
P
l
=
_

i
:
1
<
2
< . . . <
l+1
_
and integer sequence (
i
)
l+1
i=1
(we can set
1
=
l+1
= 0 indicating no continuity
conditions at the ends) the construction of the appropriate knot sequence is
displayed in the following table.
breakpoints
1

2

3
. . .
l

l+1
no. of continuity
1
= 0
2

3
. . .
l

l+1
= 0
conditions
correspond. knot k
1
k
2
k
3
. . . k
l
k
l+1
multiplicity (= k) (= k)
t
1
t
k+1
t
2k
2
+1
. . . . t
n+1
resulting knots
.
.
.
.
.
.
.
.
.
.
.
.
t
k
t
2k
2
t
3k
2

3
. . . t
n
t
n+k
We simply translate the information concerning the number of continuity
conditions, (
i
)
l
i=2
, into knots of the appropriate multiplicity.
4.7. FORMING A BASIS USING B-SPLINES 99
Example:
Suppose we start with the breakpoint sequence as (
i
)
5
i=1
= (0, 1, 2, 3, 4), and
the integer sequence as (
i
)
5
i=1
= (0, 2, 3, 1, 0). This gives, in the cubic case,
the knot set (t
i
)
14
i=1
= (0, 0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 4, 4). This basis set is shown
in gure 4.10.
Figure 4.9: Cubic bais function on (0, 0, 0, 0, 1, 1, 2, 3, 3, 3, 4, 4, 4, 4)
A B-spline function f(t) on this knot set would have the representation
f(t) =
10

i=1
d
i
N
i,k
(t).
Note that whereas the breakpoint sequence (
i
)
l+1
i=1
must be distinct and
strictly increasing this is not necessarily so for the knot sequence (t
i
)
n+k
i=1
.
Also note that by convention the knot sequence for a basis set of B-splines
starts at t
1
and ends at t
n+k
where n is the dimension of the corresponding lin-
ear space S
k
(P
l
). The ctitious or extra knots t
1
, . . . , t
k1
and t
n+2
, . . . , t
n+k
are generally (though not always) chosen to be of the repeated kind.
100 CHAPTER 4. B-SPLINE BASIS FUNCTIONS
4.8 Summary
B-spline basis function: locally non-zero basis for S
k
(P
l
).
Truncated power formula or recursive formula for denition.
Recursive formula:
1. Evaluation of B-spline function (including basis function).
2. Evaluation of all non-zero basis functions at a point.
3. Evaluation of the derivatives of a B-spline function.
Coincident knots. Extending S
k
(P
l
) to include a variable contuity level.
Dim=kl
l

i=2

i
.
Forming a basis of B-splines. Extending the knot set (usually uniform
or coalesced extension).
Constructing a knot set from a breakpoint set and continuity level set.
Chapter 5
B-spline interpolation
To construct the B-spline representation of order k of the spline function,
s(x), that interpolates the points (y
i
)
l+1
i=1
at the values (
i
)
l+1
i=1
, we assume
that the resulting function is to be C
k2
continuous so that the internal
knots occur just once in the knot sequence and n = dim S
k
(P
l
) = k + l 1.
5.1 Setting up the equations
The interpolation conditions give the equations
n

j=1
d
j
N
j,k
(
i
) = y
i
for i = 1, . . . , l + 1,
or in matrix form
_
_
_
_
_
_
N
1,k
(
1
) . . . N
n,k
(
1
)
.
.
. . . .
.
.
.
.
.
. . . .
.
.
.
N
1,k
(
l+1
) . . . N
n,k
(
l+1
)
_
_
_
_
_
_
_
_
_
_
_
_
d
1
.
.
.
.
.
.
d
n
_
_
_
_
_
_
=
_
_
_
_
_
_
y
1
.
.
.
.
.
.
y
l+1
_
_
_
_
_
_
.
There are l + 1 equations in the n = k + l 1 unknowns d
i
, which leaves
us with k 2 extra equations to supply. For the cubic case these may be
determined in a variety of ways. For example, the two extra equations
n

j=1
d
j
N

j,k
(
1
) = m
1
,
n

j=1
d
j
N

j,k
(
l+1
) = m
l+1
101
102 CHAPTER 5. B-SPLINE INTERPOLATION
may be added to provide a system of equations giving the B-spline represen-
tation for the cubic spline with specied end derivatives.
If we assume the knot set is such that the end knots are repeated with
multiplicity k then the extra equations involving derivative conditions are
easy to specify. With the knot set (t
i
)
n+k
i=1
and B-spline function f(t), the
rst derivatives at t
k
=
l
, t
n+1
=
l+1
are given by
f

(t
k
) = (k 1)(d
2
d
1
)/(t
k+1
t
k
),
f

(t
n+1
) = (k 1)(d
n
d
n1
)/(t
n+1
t
n
).
(see chapter 5, Bezier basis functions).
5.2 Examples
Example:
Assume that the interpolation abscissa (
i
)
l+1
i=1
are (0, 1, . . . , l). We wish to
compute the B-spline function f(t) interpolating (
i
, y
i
)
l+1
i=1
and satisfying the
derivative end conditions f

(0) = m
1
, f

(n 3) = m
l+1
:
f(t) =
n

i=1
d
i
N
i,4
(t).
The dimension is n = k + l 1 = l + 3, and we take the knot set to be
(0, 0, 0, 0, 1, 2, . . . , l 1, l, l, l, l). The function f(t) will consist of l cubic
segments.
The end derivatives are
f

(0) = 3(d
2
d
1
) , f

(n 3) = 3(d
n
d
n1
),
and together with the interpolation conditions, f(
i
) = y
i
, i = 1, . . . , l + 1,
this gives l +3 = n equations in n unknowns d
1
, d
2
, . . . , d
n1
, d
n
. The matrix
form is as follows:
5.2. EXAMPLES 103
1
6
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
18 18
6
3/2 7/2 1
1 4 1
.
.
.
1 4 1
1 7/2 3/2
6
18 18
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
d
1
d
2
d
3
d
4
.
.
.
d
n3
d
n2
d
n1
d
n
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
m
1
y
1
y
2
y
3
.
.
.
y
l1
y
l
y
l+1
m
l+1
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
.
The values within this matrix come from evaluating the basis functions at
the breakpoints. Figure 5.1 shows the basis functions for this knot set when
l = 5.
Figure 5.1: Cubic bais function on (0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5)
We nd, using the recursion formula (i.e algorithm 7),
f(0) = d
1
,
f(1) = (3d
2
+ 7d
3
+ 2d
4
)/12,
f(2) = (d
3
+ 4d
4
+ d
5
)/6 . . . f(l 1) = (d
n4
+ 4d
n3
+ d
n2
)/6,
f(l) = (2d
n3
+ 7d
n2
+ 3d
n1
)/12,
104 CHAPTER 5. B-SPLINE INTERPOLATION
f(5) = d
n
.
Note that by a suitable row operation on the second and next to last row to
eliminate the zeros in the diagonal position (e.g row2row2+row1, row(n
1) row(n 1)+row(n)), we can use algorithm 4 to solve for the unknown
B-spline coecients.
Another way of specifying the end conditions for B-spline interpolation is by
choosing extra points to interpolate in order to ll out the matrix system. For
example, in the cubic case we could select values y
0
, y
l+2
say, to interpolate
at points
0
= t
k1
,
l+2
= t
n+2
respectively (see below for restrictions on the
choices for these values of ). This leads to the matrix equation
_
_
_
_
_
_
_
_
_
_
_
N
1,k
(
0
) . . . . . . N
n,k
(
0
)
N
1,k
(
1
) . . . . . . N
n,k
(
1
)
.
.
. . . .
.
.
.
.
.
. . . .
.
.
.
N
1,k
(
l+1
) . . . . . . N
n,k
(
l+1
)
N
1,k
(
l+2
) . . . . . . N
n,k
(
l+2
)
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
d
1
d
2
.
.
.
.
.
.
d
n1
d
n
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
y
0
y
1
.
.
.
.
.
.
y
l+1
y
l+2
_
_
_
_
_
_
_
_
_
_
_
. (18)
The extra interpolation y values y
0
, y
l+2
can be chosen at will, though the
shape of the function will depend, non-locally, upon the specic values chosen.
Example: Uniform cubic B-spline interpolation
Assume that the interpolation abscissa (
i
)
l+1
i=1
are (0, 1, . . . , l). We use uni-
form cubic B-splines as a basis with corresponding knot set
(3, 2, 1, 0, 1, 2, 3, . . . , n 3, n 2, n 1, n),
The dimension is n = l + 3 and there will be n 3 = l segments making up
the B-spline.
We take as end conditions interpolation to two extra data points y
0
, y
l+1
at
the values
0
= 1 ,
l+2
= l + 1. The above full interpolation matrix (18)
then becomes
5.3. PERIODIC B-SPLINE INTERPOLATION 105
1
6
_
_
_
_
_
_
_
_
_
_
_
_
4 1
1 4 1
1 4 1
.
.
.
1 4 1
1 4 1
1 4
_
_
_
_
_
_
_
_
_
_
_
_
.
This matrix is of the same form as the one generated to solve the cubic
spline interpolation problem using the Hermite basis and hence the same
algorithm (algorithm 4) can be used to solve for the unknown coecients
d
1
, d
2
, . . . , d
n1
, d
n
here.
5.3 Periodic B-spline interpolation
As with periodic cubic spline interpolation, we wish to construct the B-spline
representation, f(t), of the spline interpolating the points (
i
, y
i
)
l+1
i=1
and in
addition satisfying the
1
extra conditions
f(
1
) = f(
l+1
), . . . , f
(
1
1)
(
1
) = f
(
1
1)
(
l+1
).
Given a breakpoint list (
i
)
l+1
i=1
we construct a knot set as follows:
the interior knots correspond to the breakpoints (
i
)
l
i=2
with the multiplicity
determined by the required continuity level at each
i
. For the end knots
we set t

1
+1
= . . . = t
k
=
1
, and determine the remaining end knots by the
periodic condition
t
i
= t
n
1
+i
(
l+1

l
) , for all i.
In this way we obtain a basis for which the (
l+1

1
)-periodicity is mirrored
by the n
1
-periodicity in the B-spline coecient sequence:
f(t) =
n

i=1
d
i
N
i,k
(t) , d
i
= d
n
1
+i
, i = 1, . . . ,
1
.
Example
106 CHAPTER 5. B-SPLINE INTERPOLATION
Suppose we take the (
i
)
l+1
i=1
as (0, 1, 3, 4, 7, 11), and the breakpoint list the
same. Suppose further that we require a C
2
join at the internal breakpoints
and a C
1
match at the ends. Then
1
= 2 , l + 1 = 6 and n = k + l 1 = 8.
The knots are
t
1
= t
82+1
11 = t
7
11 = 4 11 = 7
t
2
= t
82+2
11 = t
8
11 = 7 11 = 4
t
3
= t
4
= 0 , t
5
= 1 , t
6
= 3 , t
7
= 4 , t
8
= 7
t
9
= t
3
+ 11 = 11 , t
10
= t
4
+ 11 = 11 ,
t
11
= t
5
+ 11 = 1 + 11 = 12
t
12
= t
6
+ 11 = 3 + 11 = 14
The full knot set is (7, 4, 0, 0, 1, 3, 4, 7, 11, 11, 12, 14). Note that the basis
function attached to d
1
, N
1,4
(t) on (7, 4, 0, 0, 1), is a translate of the basis
function attached to d
7
, N
7,4
(t) on (4, 7, 11, 11, 12). Similarly for the basis
functions N
2,4
(t) and N
8,4
(t) attached to d
2
and d
8
respectively. A periodic
B-spline function on this knot set would be represented as
f(t) =
8

i=1
d
i
N
i,4
(t) , d
1
= d
7
, d
2
= d
8
.
The matrix equation for an interpolation problem on this knot set looks like
the following:
_
_
_
_
_
_
_
_
_
_
_
N
1,4
(
1
) N
2,4
(
1
) . . . N
7,4
(
1
) N
8,4
(
1
)
N
1,4
(
2
) N
2,4
(
2
) . . . N
7,4
(
2
) N
8,4
(
2
)
.
.
. . . .
.
.
.
N
1,4
(
6
) N
2,4
(
6
) . . . N
7,4
(
6
) N
8,4
(
6
)
1 0 . . . 1 0
0 1 . . . 0 1
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
d
1
d
2
.
.
.
d
6
d
7
d
8
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
y
1
y
2
.
.
.
y
6
0
0
_
_
_
_
_
_
_
_
_
_
.
5.3. PERIODIC B-SPLINE INTERPOLATION 107
This is no longer tridiagonal and hence a more general linear equation solver
will be required here.
In the next example we show how the system of equations for periodic inter-
polation can be set up by treating the knot set slightly dierently.
Example: periodic cubic uniform B-spline interpolation
To take an example we look at the construction of the uniform periodic cubic
B-spline interpolating (y
i
)
7
i=1
, at the points (
i
)
7
i=1
. First we note that the
dimension of the linear space of periodic splines is kl
l

i=1

i
, which for the
case of a uniform knot set is kl (k 1)l = l. In this example it is 6
and so we take the interior knots as (1, 2, 3, 4, 5) and have two end knots
0 and 6 of multiplicity 1 (here
1
= 3) which are identied. This gives us
the knot set (0, 1, 2, 3, 4, 5). We then shift the knot sequence by k div 2 + 1
=3 (div=integer division), to get the sequence (t
i
)
6
i=1
= (3, 4, 5, 0(= 6), 1, 2).
Diagramatically we can represent this situation as in gure 5.2 (think of the
two ends of the knot set joined to form a ring).
Figure 5.2: Periodic cubic B-spline bais on (4, 5, 0(= 6), 1, 2, 3)
This gives us the following basis functions
N
1,4
(t) on (3, 4, 5, 0, 1),
N
2,4
(t) on (4, 5, 0, 1, 2),
N
3,4
(t) on (5, 0, 1, 2, 3),
N
4,4
(t) on (0, 1, 2, 3, 4),
108 CHAPTER 5. B-SPLINE INTERPOLATION
N
5,4
(t) on (1, 2, 3, 4, 5),
N
6,4
(t) on (2, 3, 4, 5, 0).
If we now interpolate at the abscissa points (5, 0, 1, 2, 3, 4) to the data (y
i
)
6
i=1
ordered as (y
6
, y
1
, y
2
, y
3
, y
4
, y
5
) we obtain the following matrix equation
1
6
_
_
_
_
_
_
_
_
_
_
4 1 1
1 4 1
1 4 1
1 4 1
1 4 1
1 1 4
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
d
1
d
2
d
3
d
4
d
5
d
6
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
y
6
y
1
y
2
y
3
y
4
y
5
_
_
_
_
_
_
_
_
_
_
. (19)
(Note that we dont list twice the condition y
1
= f(
1
) = f(
7
) = y
7
.)
The matrix generated for cubic periodic B-spline interpolation is of the same
form as that of periodic cubic spline interpolation, and hence the same algo-
rithm (algorithm 5) can be used to solve for the unknown coecients here.
The function f(t) is then represented by the expression
f(t) =
6

i=1
d
i
N
i,4
(t) , t [0, 6].
Here the d
i
s utilised to obtain the six segments are
d
1
, d
2
, d
3
, d
4
on [0, 1],
d
2
, d
3
, d
4
, d
5
on [1, 2],
d
3
, d
4
, d
5
, d
6
on [2, 3],
d
4
, d
5
, d
6
, d
1
on [3, 4],
d
5
, d
6
, d
1
, d
2
on [4, 5],
d
6
, d
1
, d
2
, d
3
on [5, 6].
Note the overlap of three coecients for the rst and last segment, ensuring
the C
2
match at the ends.
To use the B-spline recursion algorithm for calculating points of f on such a
knot sequence it is necessary to treat the knots in a modulo fashion (in this
5.3. PERIODIC B-SPLINE INTERPOLATION 109
case identifying 0 with 6). For example, to nd f(4.5) we nd i such that
t
i
4.5 < t
i+1
, i.e here i = 2, and then generate the following triangular
table using algorithm 6:
d
0
5
(4.5)
d
0
6
(4.5) d
1
6
(4.5)
d
0
1
(4.5) d
1
1
(4.5) d
2
1
(4.5)
d
0
2
(4.5) d
1
2
(4.5) d
2
2
(4.5) d
3
2
(4.5).
The recursion formula used to generate this table, i.e
d
j
i
= d
j1
i
+ (1 )d
j
i
, =
t t
i
t
i+kj
t
i
,
must be modied slightly to cope with a periodic knot set. If the knot set is
uniform periodic then we replace t
i+kj
t
i
with k j > 0. Then if
f(t) =
n

i=1
d
i
N
i,k
(t) , ()
on the knot set (t
i
)
n+1
i=1
, where t
n+1
is identied with t
1
, represents a uniform
periodic B-spline, and assuming we have found i such that t
i
t < t
i+1
as
before, algorithm 6 becomes
Algorithm 9: Point evaluation of uniform periodic B-splines
for r = 1, . . . , k, do:
A(r, 1) = d
(ik+r)modn
DM(r) = t t
(ik+r)modn
for s = 1, . . . , k 1, do:
for r = s + 1, . . . , k, do:
=
DM(r)
ks
A(r, s + 1) = A(r, s) + (1 ) A(r 1, s).
Then f(t) = A(k, k).
110 CHAPTER 5. B-SPLINE INTERPOLATION
Example:
To nd f(4.5) (here i = 2) the triangular table
d
0
5
(4.5)
d
0
6
(4.5) d
1
6
(4.5)
d
0
1
(4.5) d
1
1
(4.5) d
2
1
(4.5)
d
0
2
(4.5) d
1
2
(4.5) d
2
2
(4.5) d
3
2
(4.5)
This gives
d
1
6
= (5/6)d
0
6
+ (1/6)d
0
5
d
1
1
= (1/2)d
0
1
+ (1/2)d
0
6
, d
2
1
= (3/4)d
1
1
+ (1/4)d
1
6
,
d
1
2
= (1/6)d
0
2
+ (5/6)d
0
1
, d
2
2
= (1/4)d
1
2
+ (3/4)d
1
1
, d
3
2
= (1/2)d
2
2
+ (1/2)d
2
1
.
Although all this works nicely it would be better if we could treat a peri-
odic spline in the same way as the non-periodic ones, and hence utilise the
same algorithms, without having to worry about the modulo factor (indeed
the corresponding algorithm to 9 for a non-uniform knot set is not quite so
simple). Assuming that we have set up and solved the appropriate set of
linear equations using the above periodic knot set method, we can represent
the periodic B-spline in the conventional manner by utilising the method
described to construct a conventional knot set (t
i
)
n+k
i=1
. We then set
d
n
1
+i
= d
i
, i = 1, . . . ,
1
,
to obtain the correct number of coecients. In this way we can store and
evaluate a periodic B-spline in the same way as for non-periodic B-splines.
Finally, we give an example to show how derivative constraints at interior
data points can be catered for.
Example
Construct the matrix equation for interpolation to data points (y
i
)
4
i=1
at
(
i
)
4
i=1
= (0, 1, 2, 3), with zero curvature (i.e zero second derivative) end con-
ditions and a specied derivative at y
2
.
5.3. PERIODIC B-SPLINE INTERPOLATION 111
Note rst that the dimension of S
4
(P
l
) in this case is 4*3-(2+3)=7, since there
will be C
1
continuity at
2
and C
2
continuity at
3
. Hence an appropriate
knot set is (0, 0, 0, 0, 1, 1, 2, 3, 3, 3, 3) and the solution will be a function f(t)
where
f(t) =
7

i=1
d
i
N
i,4
(t).
We have four point interpolation conditions and one derivative condition,
leaving us with two end conditions as before.
Using the formula for the derivative of a B-spline function (page 69) we have
f

(t) = 3

i
d
(1)
i
N
i,3
(t) ,
where
d
(1)
i
=
d
(0)
i
d
(0)
i1
t
i+3
t
i
.
Computing the rst column of the corresponding triangular array (here i =
6):
d
(0)
3
d
(0)
4
d
(1)
4
d
(0)
5
d
(1)
5
d
(0)
6
d
(1)
6
we have
d
(1)
4
=
d
4
d
3
t
7
t
4
=
d
4
d
3
2
,
d
(1)
5
=
d
5
d
4
t
8
t
5
=
d
5
d
4
2
,
d
(1)
6
=
d
6
d
5
t
9
t
6
=
d
6
t
5
2
.
112 CHAPTER 5. B-SPLINE INTERPOLATION
Then
f

(1) = 3(d
(1)
4
N
4,3
(1) + d
(1)
5
N
5,3
(1) + d
(1)
6
N
6,3
(1)) = d
(1)
4
= 3
(d
4
d
3
)
2
Similarly we nd for the second derivative that (with i = 1)
f

(0) = 6

i
d
(2)
i
N
i,2
(0) = 6(d
(2)
3
N
3,2
(0) + d
(2)
4
N
4,2
(0))
= 6d
(2)
3
= 6(d
3
2d
2
+ d
1
) ,
and (with i = 7)
f

(3) = 3(2d
7
3d
6
+ d
5
).
Using algorithm 6 we nd that
f(1) =
d
4
+ d
3
2
, f(2) =
d
6
+ 2d
5
+ d
4
4
Finally, collecting this information together we obtain the following matrix
equation:
_
_
_
_
_
_
_
_
_
_
_
_
1 2 1 0 0 0 0
0 0 3/2 3/2 0 0 0
1 0 0 0 0 0 0
0 0 1/2 1/2 0 0 0
0 0 0 1/4 1/2 1/4 0
0 0 0 0 0 0 1
0 0 0 0 1 3 2
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
_
d
1
d
2
d
3
d
4
d
5
d
6
d
7
_
_
_
_
_
_
_
_
_
_
_
_
=
_
_
_
_
_
_
_
_
_
_
_
_
0

y
1
y
2
y
3
y
4
0
_
_
_
_
_
_
_
_
_
_
_
_
.
Again the matrix is no longer tridiagonal and so a general linear equation
solver will need to be employed here (e.g Gaussian elimination).
5.4. UNIQUENESS FOR B-SPLINE INTERPOLATION 113
5.4 Uniqueness for B-spline interpolation
We now consider the general case for full B-spline interpolation. Assume
that we have a knot sequence (t
i
)
n+k
i=1
given so that the corresponding linear
space S
k
(P
l
) is n dimensional. Assuming we have n interpolation conditions,
f(
i
) = y
i
, i = 1, . . . , n, which provide us with the linear equations
n

j=1
d
j
N
j,k
(
i
) = y
i
for i = 1, . . . , n.
The following result tells us when this system of equations has a unique
solution:
The matrix (N
j,k
(
i
)) is invertible if and only if N
i,k
(
i
) = 0 , i = 1, . . . , n.
Given the local non-zero nature of the B-spline basis function N
i,k
(t), this is
true if and only if t
i
<
i
< t
i+k
, for all i. Returning to full cubic B-spline
interpolation matrix (18), we see that the extra points
0
,
l+2
are free to be
chosen subject to the condition t
1
<
0
< t
5
and t
n
<
l+2
< t
n+4
. It is taken
for granted that at all times the sequence of points (
i
) is strictly increasing.
Note: there seems to be an exception to this rule when the end knots occur
with multiplicity k. The conditions t
1
<
0
< t
k+1
and t
n
<
l+2
< t
n+k
implies that we cannot use t
1
or t
n
as interpolation abscissa points. However,
note that the knots t
1
, t
n+k
have no eect on the function f(t) in the interval
[t
2
, t
n+k1
] when t
2
, t
n+k1
occur with multiplicity k 1 (e.g (0,0,0,0,1,2,3,4,4,4,4)
behaves in the same way over the interval [0,4] as (-1,0,0,0,1,2,3,4,4,4,5), see
gures 5.3a and b).
114 CHAPTER 5. B-SPLINE INTERPOLATION
(a) Cubic bais function on (0, 0, 0, 0, 1, 2, 3, , 4, 4, 4, 4)
(b) Cubic bais function on (1, 0, 0, 0, 1, 2, 3, , 4, 4, 4, 5)
Figure 5.3:
Hence we can set t
1
= t
2
1 and t
n+k
= t
n+k1
+ 1 for example, and then it
becomes apparent from the above invertibility condition that t
2
, t
n+k1
are
legitimate choices for the rst and last interpolation abscissa points.
Unfortunately, there is no general result that will tell us whether the nal
system of equations has a unique solution when the k 2 extra equations
we need to supply are not the interpolation conditions prescribed above.
In this case the matrix generated should be checked for invertibility before
5.4. UNIQUENESS FOR B-SPLINE INTERPOLATION 115
attempting a solution. A sucient test can be obtained by checking for so
called diagonal dominance:
if the absolute value of any diagonal element is larger than the sum of the absolute values
of the remaining elements on the same row, then an inverse exists.
There are more sophisticated tests if this is not applicable involving the
determination of eigenvalues.
116 CHAPTER 5. B-SPLINE INTERPOLATION
5.5 Solving the B-spline interpolation equa-
tions
We have seen in the cubic case with interpolation abscissa at the distinct
knots in the sequence (t
i
)
n+1
i=4
, that the B-spline interpolation matrix equa-
tion is triangular in nature, each row having at most 3 non-zero entries. It can
be solved using the method for cubic spline interpolation (which is eectively
Gaussian elimination without pivoting). For a general order k the interpola-
tion matrix (18) generated is banded due to the local non-zero nature of the
B-spline basis functions. In particular,
N
i,k
(
j
) = 0 if and only if t
i
<
j
< t
i+k
,
and hence N
i,k
(
i
) = 0 and N
j,k
(
i
) = 0 together imply that t
j
<
i
< t
i+k
and t
i
<
i
< t
j+k
, i.e that | j i |< k. This means that the matrix (N
j,k
(
i
))
has bandwidth less than k (i.e that N
j,k
(
i
) = 0 for | j i | k).
This together with another important property that the B-spline interpola-
tion matrix possesses, called total positivity, imply that the equations can be
solved using Gaussian elimination without pivoting. In addition, the banded
nature of the equations imply that storage is only required for the 2k 1
possible non-zero bands of the matrix (N
j,k
(
i
)).
5.6 Least squares approximation
Given our linear space S
k
(P
l
) we wish to construct a function that approximates
to a set of points (y
i
)
M
i=1
say. We allow some deviation to occur between
the function and these points, but try to construct a piecewise polynomial
that minimizes the sum of the squared deviations. The resulting piecewise
polynomial will in general have a smaller number of segments than that
required to t an interpolating spline to the data points.
To set up the equations, assume that a basis, (
i
)
n
i=1
, for the linear space of
dimension n is given. Let the function we are trying to construct be f(t)
say and the data set (
i
, y
i
)
M
i=1
. We wish to minimize the sum of squared
deviations:
5.6. LEAST SQUARES APPROXIMATION 117
E(f) =
M

i=1
(f(
i
) y
i
)
2
, f(t) =
n

k=1

k
(t).
A necessary condition for the minimization of E(f) is that the partial deriva-
tives E/
j
vanish for j = 1, . . . , n. This gives equations
0 =
E

j
=
M

i=1
2[f(
i
) y
i
]
f(
i
)

j
= 2
M

i=1

j
(
i
)[f(
i
) y
i
]
for j = 1, . . . , n. Therefore
M

i=1

j
(
i
)
n

k=1

k
(
i
) =
M

i=1

j
(
i
)y
i
for j = 1, . . . , n. Writing these equations in array form we have:

1
M

i=1

1
(
i
)
1
(
i
) +
2
M

i=1

1
(
i
)
2
(
i
) +. . . +
n
M

i=1

1
(
i
)
n
(
i
) =
M

i=1

1
(
i
)y
i

1
M

i=1

2
(
i
)
1
(
i
)+
2
M

i=1

2
(
i
)
2
(
2
)+. . . +
n
M

i=1

2
(
i
)
n
(
i
) =
M

i=1

2
(
i
)y
i
.
.
.

1
M

i=1

n
(
i
)
1
(
i
)+
2
M

i=1

n
(
i
)
i
(
i
)+. . .+
n
M

i=1

n
(
i
)
n
(
i
) =
M

i=1

n
(
i
)y
i
.
These equations are called the normal equations for the least squares problem.
The system can be shown to always have a unique solution (although see
B-spline case below) and the solution does dene a minimum for E(f). The
system can be put into matrix form by dening X as the n by n matrix with
elements
_
M

i=1

j
(
i
)
k
(
i
)
_
n
j,k=1
.
If we introduce column vectors
118 CHAPTER 5. B-SPLINE INTERPOLATION
a =
_
_
_
_
_

2
.
.
.

n
_
_
_
_
_
, b =
_
_
_
_
_
_
_
_
_

1
(
i
)y
i

2
(
i
)y
i
.
.
.

n
(
i
)y
i
_
_
_
_
_
_
_
_
_
, y =
_
_
_
_
_
_
y
1
y
2
.
.
.
y
M
_
_
_
_
_
_
,
then the above system of equations can be written simply as
Xa = b.
Alternatively, if we dene the M by n matrix V as
V =
_
_
_
_
_
_

1
(
1
)
2
(
1
)
3
(
1
) . . .
n
(
1
)

1
(
2
)
2
(
2
)
3
(
2
) . . .
n
(
2
)
.
.
.
.
.
. . . .
.
.
.

1
(
M
)
1
(
M
)
3
(
M
) . . .
n
(
M
)
_
_
_
_
_
_
then X = V
T
V and b = V
T
y and hence the normal equations, Xa = b, can
also be written in the more familiar form as
V
T
V a = V
T
y.
Here the (i, j) element of the matrix V
T
V is
M

p=1

i
(
p
)
j
(
p
).
Unfortunately the numerical solution to the least squares system of equations
is quite sensitive to the particular basis (
i
) used. A good choice is one in
which the basis functions are orthogonal with respect to an inner product.
A basis that turns out to be poor, getting worse as the degree goes up, is
the standard explicit polynomial basis
i
(t) = t
i1
, i = 1, . . . , n. For our
purposes, the B-spline basis is relatively well conditioned and so can be used
to solve the problem with reasonable condence.
5.6. LEAST SQUARES APPROXIMATION 119
5.6.1 B-spline least squares approximation
For the B-spline case we are trying to determine the least squares solution
f(t) where
f(t) =
n

i=1
d
i
N
i,k
(t).
Assume for the moment that a knot set (t
i
)
n+k
i=1
has been constructed from
a given breakpoint sequence (
i
)
l+1
i=1
(the breakpoint sequence (
i
)
l+1
i=1
and the
data abscissa (
i
)
M
i=1
are two dierent sequences here). Typically this will
ensure C
k2
continuity by having the knots corresponding to the internal
breakpoints occurring with multiplicity one, then the dimension n = k+l 1.
The extra end knots can be chosen so as to coincide with the end breakpoints

1
,
l+1
with the appropriate multiplicity. In order to to guarantee a unique
solution to the normal equations in the B-spline case the following condition
needs to be satised:
for some 1 j
1
< . . . < j
n
M , t
i
<
j
i
< t
i+k
, i = 1, . . . , n.
As stated above the B-spline basis (N
i,k
(t))
n
i=1
is relatively well conditioned
and has the additional property that it is only locally non-zero. In particular,
the (i, j) element of the matrix V
T
V is in this case
M

p=1
N
i,k
(
p
)N
j,k
(
p
),
and we know that N
i,k
(t) = 0 for t [t
i
, t
i+k
], hence |i j| k implies
N
i,k
(t)N
j,k
(t) = 0 for all t. The matrix V
T
V is also symmetric so we need
only store the lower diagonal bands. It is also positive (semi) denite and so
the solution can be obtained by using Choleski factorization. Here the matrix
is factored into the form LDL
T
, with L a unit lower triangular matrix and
D a diagonal matrix. The triangular system Ly = b is then solved for y,
and, nally, the triangular system DL
T
x = y is solved for the solution x of
Ax = b.
To summarize then, the steps required to construct the B-spline least squares
approximation are,
120 CHAPTER 5. B-SPLINE INTERPOLATION
1) read in the data,
2) construct a breakpoint sequence,
3) construct the appropriate knot sequence from the given
breakpoint sequence,
4) construct the approximation using Choleski factorization,
5) calculate a measure of the error incurred by the approximation.
We make some remarks on these steps:
2) How does one choose the initial breakpoint sequence, (
i
)
l+1
i=1
, and hence the
knot sequence (t
i
)
n+k
i=1
? A simple (but generally non-optimal) way of choosing
them is to break the original interval [
1
,
M
] over which the approximation is
required into equal sub-intervals. If one is trying to keep within a tolerance
the number of breakpoints could be increased by one for each iteration, for
example, until the measure of error falls beneath the tolerance value.
3) The construction of the knot sequence form the breakpoint sequence is
described on page 75 . The sequence (
i
)
l
i=2
consists of 1s corresponding to
C
k2
continuity.
4) We need to compute the matrix V
T
V and the right hand side V
T
y. This
is best done by computing for each
i
, i = 1, . . . , M the values of all the
B-spline basis functions N
i,k
(t) that are non zero there using algorithm 7.
Once all these values have been computed and stored we can perform the
appropriate summations to generate the elements of the matrix and the right
hand vector. These components are then passed to a Choleski factorization
routine for factorization and solution.
5) There are a number of measures of error that could be used here. We
mention three useful ones.
The least squares error is the square root of the sum of the squares of the
error divided by the number of data points:
E
lsq
(f) =

_
1
M
M

i=1
(f(
i
) y
i
)
2
.
The average error is the sum of the absolute deviations divided by the number
of data points:
5.6. LEAST SQUARES APPROXIMATION 121
E
av
= (1/M)
M

i=1
| f(
i
) y
i
| .
Finally, the maximum error is simply the maximum of the absolute values of
the deviations:
E
max
= max
_
|f(
i
) y
i
|
_
M
i=1
.
5.6.2 Least squares approximation with weights
By a very simple extension we can add some extra exibility to the least
squares process. This is by adding a so called weight, w
i
where w
i
0, to
each data point. The relevant function E(f) to minimize is then
E(f) =
M

i=1
w
i
(f(
i
) y
i
)
2
.
The least squares matrix V
T
V now has (i, j) element
M

p=1
w
p

i
(
p
)
j
(
p
),
and the right hand side V
T
y becomes
_
_
_
_
_
_
_
_
_
_
_
_
M

j=1
w
j
y
j

1
(
j
)
M

j=1
w
j
y
j

2
(
j
)
.
.
.
M

j=1
w
j
y
j

n
(
j
)
_
_
_
_
_
_
_
_
_
_
_
_
.
The weights are constants that can be used to introduce bias into the ap-
proximation, forcing the function closer to one or more data points at the
expense of not getting so close to the others. For example, a large value for
w
1
relative to the other w

i
s will pull the curve closer to y
1
. If all the w
i
s have
the same value there is no net eect as any common factor the w
i
possess
cancels out from the equations.
122 CHAPTER 5. B-SPLINE INTERPOLATION
5.6.3 Summary
Matrix system for cubic B-spline interpolation to a data set.
Construction of knot set and end conditions for solution to problem.
Tridiagonal system for ecient solution.
Periodic B-spline interpolation.
Construction of knot set.
Periodic basis functions and evaluation of periodic B-splines.
Uniqueness condition for full B-spline interpolation.
B-spline least squares approximation.
Choleski factorization for solution.
Addition of weights to the data points.
Chapter 6
Bezier basis functions and
approximations
Consider the special case of B-spline basis functions of order k on the partition
P
2
= (
1
,
2
). The dimension of the corresponding linear space is k. In order
to form a basis we use the coalesced form of the knot extension, giving the
knot set (
1
, . . . ,
1
,
2
, . . . ,
2
), where
1
and
2
both occur with multiplicity
k. It is common in CAD applications to take these breakpoints to be 0
and 1 giving for the quadratic case the knot set (0, 0, 0, 1, 1, 1), and for the
cubic case (0, 0, 0, 0, 1, 1, 1, 1). Computing the quadratic basis functions using
algorithm 7 for B-spline evaluation gives us the following triangular array:
N
1,3
(t)
N
2,2
(t)
N
3,1
(t) N
2,3
(t)
N
3,2
(t)
N
3,3
(t)
The formulae obtained from the recursion (15) are
0 +
1t
10
(1 t) = (1 t)
2
0 +
1t
10
.1 = 1 t
1
t0
10
(1 t) +
1t
10
t = 2t(1 t)
t0
10
.1 + 0 = t
t0
10
t + 0 = t
2
123
124CHAPTER 6. B

EZIER BASIS FUNCTIONS ANDAPPROXIMATIONS


In an analogous fashion we obtain for the cubic case the basis functions
N
1,4
(t) = (1 t)
3
,
N
2,4
(t) = 3t(1 t)
2
,
N
3,4
(t) = 3t
2
(1 t),
N
4,4
(t) = t
3
.
For general k the B-splines on the knot set (0, . . . , 0, 1, . . . , 1) satisfy the
formula
N
i,k
(t) =
_
k 1
i 1
_
t
i1
(1 t)
ki
, i = 1, . . . , k.
On the general interval [
1
,
2
] this becomes
N
i,k
(t) =
_
k 1
i 1
_
(t
1
)
i1
(
2
t)
ki
(
2

1
)
k
, i = 1, . . . , k.
These particular functions have a history and notation of their own and are
commonly known as Bezier-Bernstein basis functions. Traditionally they
occur in approximation theory and in this respect are known as Bernstein
basis functions. P.Bezier and P. de Casteljau exploited their properties for use
in a computer aided design setting (prior to the use of B-splines for CAD) and
in this context they are known as Bezier-Bernstein basis functions, denoted
B
m
i
(t), where m = k 1 is the degree of the polynomial and i varies from 0
to m:
B
m
i
(t) =
_
m
i
_
t
i
(1 t)
mi
, i = 0, . . . , m.
Figure 6.1 illustrates the Bezier Bernstein basis functions for the linear,
quadratic and cubic cases.
125
Figure 6.1: Bezier-Bernstein basis functions, linear, quadratic, cubic
126CHAPTER 6. B

EZIER BASIS FUNCTIONS ANDAPPROXIMATIONS


6.1 de Casteljau recursion
The B-spline recursion, algorithm 6, also has a special name when the knot
set is of the Bezier-Bernstein type; it is called the de Casteljau algorithm (it
predates the general recursion formula). In the N
j,k
(t) notation and over the
interval [0, 1] it reduces to the following:
Algorithm 10: de Casteljau algorithm
for
f(t) =
k

j=1
d
j
N
j,k
(t)
for r = 1, . . . , k, do:
d
1
r
(t) = d
r
for s = 1, . . . , k 1, do:
for r = s + 1, . . . , k, do:
d
s+1
r
(t) = t d
s
r
(t) + (1 t)d
s
r1
(t).
Then d
k
k
(t) = f(t).
The B
m
i
(t) functions form a basis for
m+1
and have the following properties
(again over [0, 1]):
i/ The B-spline recursion formula (15) reduces to
B
m
i
(t) = (1 t)B
m1
i
(t) + tB
m1
i1
(t).
ii/ For a Bezier-Bernstein function f(t) =
m

i=0
b
i
B
m
i
(t), we have
f(0) = b
0
, f(1) = b
m
,
that is the endpoints are interpolated.
The rst two derivatives are
6.2. APPROXIMATIONS AND CONTROL POLYGONS 127
f

(t) = m
m1

i=0
(b
i+1
b
i
)B
m1
i
(t),
f

(t) = m(m1)
m2

i=0
(b
i+2
2 b
i+1
+ b
i
)B
m2
i
(t).
A formula for the jth derivative is
f
(j)
(t) = m(m1) . . . (mj + 1)
mj

i=0
_
b
i+j

_
j
1
_
b
i+j1
+
_
j
2
_
b
i+j2
. . . +
(1)
j1
_
j
j 1
_
b
i+1
+ (1)
j
b
i
_
B
mj
i
(t).
Over the interval [
1
,
2
] the jth derivative computed here needs to be divided
by the factor (
2

1
)
j
.
iii/ The following are some useful identities:
m

j=0
j
m
B
m
j
(t) = t,
B
m
j
(t) = B
m
mj
(1 t),
1
_
0
B
m
i
(t) dt =
1
m+1
,
B
m
i
(t)B
n
j
(t) =
(
m
i
)(
n
j
)
(
m+n
i+j
)
B
m+n
i+j
.
6.2 Approximations and control polygons
Given an arbitrary function, f(t) say, on [a, b] and a B-spline basis on a given
knot set (t
i
)
n+k
i=1
, the B-spline approximation of order k to f is dened as
S
k
(f; t) =
n

i=1
f(
i
)N
i,k
(t) ,
128CHAPTER 6. B

EZIER BASIS FUNCTIONS ANDAPPROXIMATIONS


where the
i
are the knot averages or Greville abscissa:

i
=
1
k 1
(t
i+1
+ . . . + t
i+k1
) , i = 1, . . . , n.
In the special case of the Bezier-Bernstein basis functions these knot averages
reduce to
i
= (i 1)/(k 1) , i = 1, . . . , k. Using the B
m
i
(t) notation the
approximation then becomes
S
k
(f; t) =
m

i=0
f(i/m)B
m
i
(t).
This, appropriately, is called the Bernstein approximation of degree m to the
function f.
A particularly important property of the B-spline approximation is that it
reproduces straight lines. That is if l(t) is any straight line then
S
k
(l; t) =
n

i=1
l(
i
)N
i,k
(t) = l(t).
We we will be able to show roughly why this holds a little later on. For now
we mention the fact that this property can be used to show that B-spline
approximations are so called variation diminishing:
the B-spline approximation S to a function f crosses any particular straight line at most
as many times as f does itself.
This is essentailly saying that B-spline approximation is a smoothing opera-
tion. As a special case of this fact we have that S maps non-negative functions
to non-negative functions and convex functions to convex functions. Also,
S
k
(f; t) provides a local approximation to f. The function S
k
(f; t) on the
interval [t
i
, t
i+1
] depends only on the values of f at the k nearby points

ik+1
, . . . ,
i
. In particular, if these points (t
ik+j
, f(t
ik+j
))
k
j=1
lie on a
straight line, then S
k
(f; t) on the interval [t
i
, t
i+1
] coincides with that same
straight line.
6.2. APPROXIMATIONS AND CONTROL POLYGONS 129
6.2.1 Control polygons
The main reason for including B-spline approximations is to introduce the
idea of a control polygon associated with a curve. Assume that we are given
a spline function f:
f(t) =
n

j=1
d
j
N
j,k
(t).
If we consider the B-spline coecients d
j
to be joined by straight lines, form-
ing a polygon, and if this polygon is viewed as a piecewise linear function p
say, where we view f as the B-spline approximation to p, then p is charac-
terized by the property
p(
j
) = d
j
,
j
=
1
k 1
(t
j+1
+ . . . + t
j+k1
) , j = 1, . . . , n.
In this context the set of points (
j
, d
j
)
n
j=1
is called the control polygon for the
B-spline function f. The sequence of B-spline coecients d
j
gives a fair idea
of the graph of the B-spline f in the sense that, for moderate k
d
j
f(
j
).
130CHAPTER 6. B

EZIER BASIS FUNCTIONS ANDAPPROXIMATIONS


Figure 6.2 shows a cubic polynomial over [0,10] and its B-spline coecients
illustrating this fact.
Figure 6.2: B-spline function with coecients
Thinking of the function f as a curve, we can now view the curve as an
approximation to the control polygon. Figure 6.3 shows a cubic B-spline
function with its control polygon (d
i
)
7
i=1
. The knot set, (t
i
)
11
i=1
, is such that
the end knots are of the repeated kind giving us interpolation of the points d
1
and d
7
. The knot averages (
i
)
7
i=1
are also shown. Figure 6.4 gives an example
of a cubic B-spline function that, due to the fact that the interior knots occur
with multiplicity 3, is in eect a composite (three segment) Bezier curve. The
points (b
i
)
3
i=0
dene the rst segment, (b
i
)
6
i=3
the second and (b
i
)
9
i=6
the third
6.2. APPROXIMATIONS AND CONTROL POLYGONS 131
segment. The corresponding knot averages
i
divide each interval into thirds.
Figure 6.5 illustrates the variation diminishing property for a Bezier approx-
imation (curve) of degree 5.
Figure 6.3: Variation diminishing property of Bezier-Bernstein function of
degree 5
It is the extension of these ideas to the parametric domain in 2 and 3 dimen-
sions that proves very fruitful in a computer aided design environment.
132CHAPTER 6. B

EZIER BASIS FUNCTIONS ANDAPPROXIMATIONS


6.3 Summary
Bezier-Bernstein basis functions as special case of B-splines on appro-
priate knot set.
de Casteljau recursion for Bezier evaluation.
Properties of Bezier basis functions.
B-spline approximation to a function. Knot averages.
Variation diminishing property of B-spline approximations.
Control polygon (
i
, d
i
) of B-spline function, from knot averages
i
and
B-spline coecients d
i
.
Chapter 7
Conversions between
representations
It is useful to be able to switch between the various representations we have
met upto now. We will look at methods for the following conversions:
1) Interpolating cubic spline (Hermite) to B-spline.
2) Interpolating weighted -spline (Hermite) to B-spline.
3) Interpolating cardinal spline basis to B-spline basis.
4) B-spline to Bzier-Bernstein.
5) Matrix conversions.
7.1 Interpolating cubic spline to B-spline
1) Recall that for the interpolating cubic spline, given the data (
i
, y
i
)
l+1
i=1
we
solve for the slopes (m
i
)
l+1
i=1
at the points (
i
)
l+1
i=1
. Then the required spline is
given by
s(t) =
l+1

i=1

i
(t)y
i
+
l+1

i=1

i
(t)m
i
.
We wish to compute the coecients (d
i
)
n
i=1
in the B-spline representation for
s:
133
134 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
s(t) =
n

i=1
d
i
N
i,4
(t) ,
where n = 3+l is the dimension of the corresponding linear space. The knot
set for the B-spline basis N
i,4
(x) is easily constructed. The internal knots
occur with multiplicity one (as the function is C
2
continuous) and we choose
the end knots to be of the repeated kind. This gives us the knot set (t
i
)
7+l
i=1
as
(
1
,
1
,
1
,
1
,
2
,
3
, . . . ,
l
,
l+1
,
l+1
,
l+1
,
l+1
).
(here the breakpoints
i
=
i
)
Having constructed the knot set for the B-spline representation the B-spline
coecients d
i
can be computed by utilising the following result:
Given a function f, dene
i
by its eect on f as

i
(f) =
k1

r=0
(1)
k1r

(k1r)
(a
i
)f
(r)
(a
i
),
= f(a
i
) + (1)
k2
f

(a
i
)
d
k2
dt
k2
(a
i
) +
k1

r=2
(1)
k1r
d
k1r
dt
k1r
(a
i
)
d
r
dt
r
f(a
i
) ,
(19)
where (t) = (t
i+1
t) . . . (t
i+k1
t)/(k 1)!, and a
i
is an arbitrary point in the
open interval (t
i
, t
i+k
). Then

i
_
N
j,k
(t)
_
=
ij
=
_
1 i = j
0 i = j
. (20)
We do not prove this result!. However, using this we can obtain the d
i
since
from (20),

i
_
s(t)
_
=
i
_
n

j=1
d
j
N
j,k
(t)
_
= d
i
, i = 1, . . . , n.
Of course we apply the operators
i
, i = 1, . . . , n to the (known) Hermite
form of s. To do this note that in the case where the cross segment continuity
7.1. INTERPOLATING CUBIC SPLINE TO B-SPLINE 135
level is known, the point a
i
can always be chosen to be one of the breakpoints

j
. In particular we can choose the a
i
so that for instance, a
i
= t
i+2
, i =
1, . . . , n.
Note: For multiple end knots it appears that this choice for a
1
and a
n
violates the condition that they lie in the open interval (t
1
, t
k+1
) and (t
n
, t
n+k
)
respectively. However, when the end knots t
2
, t
n+k1
occur with multiplicity
k 1 the position of the rst/last knot t
1
, t
n+k
is immaterial and so the
choices a
1
= t
3
and a
n
= t
n+2
are O.K. (see note to B-spline interpolation on
page ).
Focusing on the cubic case k = 4, (19) specializes to
d
i
= s(a
i
) + (1)
2
s

(a
i
)
d
2
dt
2
(a
i
) + (1)s

(a
i
)
d
dt
(a
i
) + s

(a
i
)(a
i
) ,
where
(t) =
(t
i+1
t)(t
i+2
t)(t
i+3
t)
6
.
This is equal to
s(a
i
) +
s

(a
i
)
3
[(t
i+1
a
i
) + (t
i+2
a
i
) + (t
i+3
a
i
)]
+
s

(a
i
)
6
[(t
i+2
a
i
)(t
i+3
a
i
) + (t
i+1
a
i
)(t
i+3
a
i
) + (t
i+1
a
i
)(t
i+2
a
i
)]
+
s

(a
i
)
6
[(t
i+1
a
i
)(t
i+2
a
i
)(t
i+3
a
i
)].
Setting a
i
= t
i+2
simplies this to
d
i
= s(a
i
) +
1
3
_
(t
i+3
a
i
) (a
i
t
i+1
)
_
s

(a
i
)
1
3
(a
i
t
i+1
)(t
i+3
a
i
)s

(a
i
)/2,
(21)
for i = 1, . . . , n. If a
i
= t
i+2
this can be rewritten as
s(t
i+2
) +
1
3
(t
i+2
t
i+1
)s

(t
i+2
)
1
3
t
i+1
t
i+2
s

(t
i+2
)/2, (22)
136 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
where t
i
= t
i+1
t
i
.
Note that the formula for the d
i
entails calculating all the derivatives of s(x)
at each point a
i
(in this case each breakpoint). We have already expressed
the Hermite basis functions H
0
, . . . , H
3
in explicit polynomial form (see page
22) and this representation can be used to compute values
i
,
i
,
i
,
i
such
that the ith segment of the spline, s
i
(t), where
s
i
(t) = y
i
H
0
(t) + y
i+1
H
1
(t) + m
i
H
2
(t) + m
i+1
H
3
(t) ,
appears as
=
i
+
i
(t
i
) +
i
(t
i
)
2
+
i
(t
i
)
3
, i = 1, . . . , l.
The required derivatives of s(t) can then be read o directly.
To summarize, the steps required to compute the B-spline representation of
a cubic interpolating spline are
Step 1: Construct the knot set (t
i
)
n+4
i=1
with each internal knot occurring once and the end
knots occurring with multiplicity 4.
Step 2: for j = 1, . . . , n
i/ compute all derivatives of s at the point t
i+2
using Taylor form for s
i
(x), for i =
1, . . . , n.
ii/ compute the B-spline coecient d
i
, i = 1, . . . , n from formula (22).
7.1.1 Alternative method
We mention an alternative (and perhaps simpler) method for converting a
given spline curve s(t) to B-spline form. Given a breakpoint set for the spline
we can construct a knot set (t
i
)
n+k
i=1
, and from these we can calculate the knot
averages

i
=
t
i+1
+ . . . + t
i+k1
k 1
, i = 1, . . . , n.
By evaluating the spline at these points we generate the following equations:
7.1. INTERPOLATING CUBIC SPLINE TO B-SPLINE 137
s(
i
) =
n

j=1
d
j
N
j,k
(
i
) , i = 1, . . . , n.
This gives us n equations in the n unknowns d
j
from which we can obtain a
solution (e.g by inverting the matrix
_
N
j,k
(
i
)
_
n
i j=1
).
2) For a given sequence of tension parameters (
i
)
l
i=2
after solving matrix
equation (13) we obtain the tensioned spline in the same representation as
the cubic interpolating spline. Hence the same process as described above
can be used to convert this spline to B-spline form. The dierence appears in
the knot set which, because a tensioned spline (or weighted -spline) is only
C
1
continuous (at the breakpoints where a nonzero tension value has been
specied that is), becomes (t
i
)
n+4
i=1
(here the dimension n = 4l 2(l 1) =
2l + 2) with the t
i
as
(
1
,
1
,
1
,
1
,
2
,
2
,
3
,
3
. . . ,
l
,
l
,
l+1
,
l+1
,
l+1
,
l+1
).
The change of knot set alters slightly the points a
i
needed to compute the
d
i
. We can choose a
i
= t
i+2
for all values of i except i = 2, i = n 1.
These values can be chosen, for example, as (t
4
+ t
5
)/2 and (t
n
+ t
n+1
)/2
respectively. The B-spline coecients d
2
and d
n1
then need to be computed
by the general formula above (21). The specialized formula (21) can then be
used to compute the remaining B-spline coecients.
3) In order to obtain the B-spline representation for a given cardinal basis
spline, s
i
(t), we simply convert the Hermite representation of s
i
(t) to B-spline
form using the method described in 1). In particular, if each cardinal basis
function s
i
(t) is expressed in the form
s
i
(t) =
l+1

j=1

j
(t)y
j
+
l+1

j=1

j
(t)m
j
, i = 1, . . . , l + 3,
the slopes m
j
can be found by solving the tridiagonal matrix equation (8) on
page 33 with the appropriate end conditions. This representation for s
i
(t) is
then converted to B-spline form,
s
i
(t) =
l+3

j=1
d
i
j
N
j,4
(t) ,
138 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
using the method(s) described in conversion 1). Note that there is a dierent
cardinal basis for each given set of end conditions for the interpolating spline.
7.2 Knot insertion
4) Recall that the Bezier-Bernstein basis functions of order k are formed by
taking the B-spline basis functions of order k on the knot set (t
i
)
2k
i=1
where
the t
i
consist of 0 and 1 each occurring with multiplicity k. If we are given a
B-spline function
f(t) =
n

i=1
d
i
N
i,k
(t)
on the knot set (t
i
)
n+k
i=1
, we must somehow convert f(t) to the representation
f(t) =
n

i=1

i
N
i,k
(t),
for some coecients

i
on the knot set (t

i
)
n

+k
i=1
, where each distinct knot
corresponding to a breakpoint now occurs with multiplicity k 1. For
example, if f(t) is a three segment B-spline function on the knot set
(0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3),
f(t) =
7

i=1
d
i
N
i,4
(t) ,
we need to nd coecients

i
such that
f(t) =
10

i=1

i
N
i,4
(t) ,
on the knot set (t
i
)
14
i=1
= (0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3). Figures 7.1a and b
illustrate the basis functions on these two knot sets.
7.2. KNOT INSERTION 139
(a) Cubic basis function on (0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3)
(b) Cubic basis function on (0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3)
Figure 7.1:
In general, to obtain the Bezier-Bernstein representation for a given B-spline
function we need to insert knots into the original set so that each dis-
tinct knot in the sequence (t
k
, . . . , t
n+1
) ends up with multiplicity k 1.
For example if we begin with the knot set (0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3) we
need to insert the knot t = 1 twice and t = 2 once to obtain the set
(0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3). Figures 7.2a and b illustrate the basis func-
tions over these two knot sets.
140 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
(a) Cubic basis function on (0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3)
(b) Cubic basis function on (0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3)
Figure 7.2:
There are two well documented algorithms for carrying out this process of
knot insertion: the Oslo algorithm and Boehms algorithm. Both of these
procedures allow one to add knots to an existing B-spline function, and so
generate a new set of coecients, in such a way that the resulting function is
identical to the original. There are many useful applications of this process
in the area of CAD. In view of its simplicity we concentrate on Boehms
algorithm.
7.2. KNOT INSERTION 141
7.2.1 Single knot insertion
Assume then that we have a B-spline function f(t) on the knot set = {t
i
}
(for ease of notation we omit the limits on i),
f(t) =

i
d
i
N
i,k
(t).
To set the scene suppose we wish to add a single knot

t say, coinciding with
the knot t
p+1
which already has multiplicity s say (if the knot does not already
occur in the sequence then take s = 0). Let the new knot set be denoted (t
1
i
)
so that
t
1
i
=
_
_
_
t
i
i p

t = t
p+1
i = p + 1
t
i1
i p + 2
.
Denoting the set of basis functions on this new knot set as (N
1
i,k
(t)) we can
express f(t) in the form
f(t) =

i
d
1
i
N
1
i,k
(t), (23)
for some yet to be determined coecients d
1
i
. To nd these new coecients
we begin by expressing N
i,k
(t) as a linear combination of N
1
i,k
(t) and N
1
i+1,k
(t)
(for derivation see end of this section):
N
i,k
(t) =
_

_
N
1
i,k
(t)
(

t t
1
i
)/(t
1
i+k
t
1
i
)N
1
i,k
(t) + (t
1
i+k+1

t)/(t
1
i+k+1
t
1
i+1
)N
1
i+1,k
(t)
N
1
i+1,k
(t)
,
(24)
where the respective index ranges are
_
_
_
i p k + s
p k + s + 1 i p
i p + 1
.
If we now sum d
i
N
i,k
(t) over the range p k +s +1 i p using the above
expression, and change the variable of summation (i i 1) for the terms
involving N
1
i+1,k
(t), we obtain (remembering that

t t
1
p+1
= 0),
142 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
p

i=pk+s+1
d
i
N
i,k
(t) =
p+1

i=pk+s+1
_

t t
1
i
t
1
i+k
t
1
i
d
i
+
t
1
i+k

t
t
1
i+k
t
1
i
d
i1
_
N
1
i,k
(t). (25)
Hence, by the uniqueness of the representation of f(t) with respect to a given
B-spline basis we have, by comparing (24) with (25), the result
d
1
i
=
i
d
i
+ (1
i
)d
i1
, (26)
where

i
=
_
_
_
1 i p k + s + 1
(

t t
1
i
)/(t
1
i+k
t
1
i
) = (

t t
i
)/(t
i+k1
t
i
) p k + s + 2 i p
0 i p + 1
.
Equation (26) has the simple interpretation of d
1
i
dividing the line joining d
i1
and d
i
in the ratio
i
: 1
i
. The calculation of the new set of coecients
involves only convex combinations of the original coecients (
i
+1
i
= 1),
important for computational stability.
Example
We take the original cubic B-spline function as
f(t) =
6

i=1
d
i
N
i,4
(t)
on the knot set (0, 0, 0, 0, 1, 2, 3, 3, 3, 3). Suppose we wish to add a knot at
t = 1.3 creating the new knot set (0, 0, 0, 0, 1, 1.3, 2, 3, 3, 3, 3). Here p = 5
and s = 0 and

i
=
_
_
_
1 i 2
(1.3 t
1
i
)/(t
1
i+4
t
1
i
) 3 i 5
0 i 6
.
Working out the numbers the new coecient sequence (d
1
i
)
7
i=1
is:
d
1
1
= d
1
d
1
2
= d
2
d
1
3
= 0.65d
3
+ 0.35d
2
d
1
4
= 0.434d
4
+ 0.566d
3
7.2. KNOT INSERTION 143
d
1
5
= 0.15d
5
+ 0.85d
4
d
1
6
= d
5
d
1
7
= d
6
This process can be formalized in an algorithm. If we start with the repre-
sentation
f(t) =
n

i=1
d
i
N
i,k
(t),
on the knot set (t
i
)
n+k
i=1
, and require the representation
f(t) =
n+1

i=1
d
1
i
N
i,k
(t)
on the knot set (t
1
i
)
n+k+1
i=1
, where

t has been inserted, the following algorithm
will produce the new coecients (d
1
i
)
n+1
i=1
:
Algorithm 11: single knot insertion
for i = 1, p k + s + 1, do:
d
0
i
= d
i
for i = p k + s + 2, p, do:

i
= (

t t
1
i
)/(t
1
i+k
t
1
i
) = (

t t
i
)/(t
i+k1
t
i
)
d
1
i
=
i
d
0
i
+ (1
i
)d
0
i1
for i = p + 1, n + 1, do:
d
1
i
= d
i1
The original B-spline points (d
j
)
p1
j=pk+2+s
are replaced by the points
(d
1
j
)
p
j=pk+2+s
.
Having found a formula for the new coecients after a single knot insertion
we note that to obtain the Bezier-Bernstein representation we will in general
have to insert a given knot more than once. We examine the process needed
to achieve this.
144 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
7.2.2 Multiple knot insertion
To insert the knot

t = t
p+1
with multiplicity r say (where r +s k 1), we
apply the above process of single knot insertion iteratively. If we denote the
resulting knot set as {t
r
i
} so that
t
r
i
=
_
_
_
t
i
i p

t = t
p+1
p + 1 i p + r
t
ir
p + r + 1 i
,
and the corresponding expression for f(t) by
f(t) =

i
d
r
i
N
r
i,k
(t) ,
then assuming that

t has been inserted r 1 times, we have, according to
(25) and (26)
d
r
i
=
r
i
d
r1
i
+ (1
r
i
)d
r1
i1
, d
0
i
= d
i
, (27)
where

r
i
=
_
_
_
1 i p k + s + r
(

t t
r
i
)/(t
r
i+k
t
r
i
) = (

t t
i
)/(t
i+kr
t
i
) p k + s + r + 1 i p
0 i p + 1
.
There are some important points to note arising from the above formulae:
(1) Because
r
i
= 1 for i pk+s+r, the points d
j
i
coincide for i =constant,
i j p k + s + 1.
(2) Because
r
i
= 0 for i p +1, the points d
j
i
coincide for i j = constant,
i p.
Example
Let f(t) =
7

i=1
d
i
N
i,4
(t) on the knot set (0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3). We illus-
trate the process of inserting

t = 1 twice (here p = 4 and s = 1).
Step 1:
7.2. KNOT INSERTION 145
f(t) =
8

i=1
d
1
i
N
1
i,4
(t) on the knot set (0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3), where
( d
1
1
. . . d
1
8
) = ( d
1
d
2
d
1
3
d
1
4
d
4
d
5
d
6
d
7
) .
and
d
1
3
=
1
2
d
3
+
1
2
d
2
, d
1
4
=
1
2
d
4
+
1
2
d
3
.
Step 2:
f(t) =
9

i=1
d
2
i
N
2
i,4
(t) on the knot set (0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3), where
( d
2
1
. . . d
2
9
) = ( d
1
d
2
d
1
3
d
2
4
d
1
4
d
4
d
5
d
6
d
7
) .
and
d
2
4
=
1
2
d
1
4
+
1
2
d
1
3
.
If we assume that we start with the representation
f(t) =
n

i=1
d
i
N
i,k
(t)
on the knot set (t
i
)
n+k
i=1
, and we require the representation
f(t) =
n+r

i=1
d
r
i
N
i,k
(t)
on the knot set (t
r
i
)
n+k+r
i=1
, the following algorithm will produce the new coef-
cients (d
r
i
)
n+r
i=1
:
146 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
Algorithm 12: multiple knot insertion
for j = 1, r, do:
for i = 1, p k + s + j, do:
d
j
i
= d
j1
i
for i = p k + s + r, p, do:

j
i
= (

t t
i
)/(t
i+kj
t
i
)
d
j
i
=
j
i
d
j1
i
+ (1
j
i
)d
j1
i1
for i = p + 1, n + j, do:
d
j
i
= d
j1
i1
Here d
0
i
= d
i
.
Note that since N
k1s
i,k
(

t) =
ip
(1 if i = p, 0 otherwise) for r = k 1 s we
have
f(

t) =

i
d
r
i
N
r
i,k
(

t) = d
k1s
p
.
7.2. KNOT INSERTION 147
Hence we can evaluate the B-spline function f(t) at a point

t by repeatedly
inserting

t in to the knot sequence until it has multiplicity k 1 (see gure
7.3).
Figure 7.3: Knot insertion process
This suggests that the process of knot insertion is closely connected with the
B-spline recursion formula (15).
7.2.3 The Manseld-Cox-de Boor recursion formula
revisited
For p k + s + r + 1 i p, (27) coincides with the B-spline recursion
formula (15) (slightly dierent notation here):
f(t) =

i
d
i
N
i,k
(t) =

i
d
r
i
N
i,kr
(t) ,
where
d
r
i
=
_
d
i
r = 0
_
(t t
i
)/(t
i+kr
t
i
)
_
d
r1
i
+
_
(t
i+kr
t)/(t
i+kr
t
i
)
_
d
r1
i1
r > 0
.
To recall, this formula expresses f(t) as a linear combination of B-splines of
order k r over the knot set with corresponding triangular scheme for the
148 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
calculation of the d
r
i
as shown in the following table:
d
0
pk+1
d
0
pk+2
d
1
pk+2
.
.
.
.
.
.
d
0
p1
d
1
p1
. . . d
k2
p1
d
0
p
d
1
p
. . . d
k2
p
d
k1
p
The B-spline recursion formula (17) for calculating the points d
j
i
can be
reduced somewhat for our purposes due to the coincidences stated in (1)
and (2) above. If t
p+1
has multiplicity s in the knot set , we only have
to insert

t k 1 s times to obtain the multiplicity k 1 we require.
Letting q = k 1 s, the reduced Cox de-Boor triangular table looks like
the following:
d
0
pq
d
0
pq+1
d
1
pq+1
.
.
.
.
.
.
d
0
p
d
1
p
. . . d
q
p
This table contains both the coecients that need replacing and their re-
placements as indicated in the following diagram:
d
0
pq
d
0
pq
d
0
pq+1
d
1
pq+1
.
.
.
.
.
.
d
0
p
d
0
p
d
1
p
. . . d
q
p
old nodes replacement nodes
Returning to the previous example 1 where we insert

t twice, the original
triangular scheme appears as:
7.2. KNOT INSERTION 149
d
1
d
2
d
1
2
d
3
d
1
3
d
2
3
d
4
d
1
4
d
2
4
d
3
4
and the reduced scheme as:
d
2
d
3
d
1
3
d
4
d
1
4
d
2
4
This gives us replacement nodes ( d
2
d
1
3
d
2
4
d
1
4
d
4
) as before.
7.2.4 Subdivision
Notice that if we insert a particular knot until it has multiplicity k 1,
we eectively split the B-spline function at that point. From the previous
example we have
f(t) =
7

i=1
d
i
N
i,4
(t)
on the knot set (0, 0, 0, 0, 1, 2, 2, 3, 3, 3, 3). Inserting the knot t = 1 twice gives
us the representations for f(t) as a B-spline over [0, 1] and [1, 3]:
f
1
(t) =
4

i=1
d
2
i
N
i,4
(t) , on (0, 0, 0, 0, 1, 1, 1, 1)
f
2
(t) =
9

i=4
d
2
i
N
i,4
(t) , on (1, 1, 1, 1, 2, 2, 3, 3, 3, 3).
This is a very important property and, as we shall see later, is used to sub-
divide B-spline curves and surfaces in the parametric domain.
150 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
7.3 B-spline to Bezier conversion
Returning to the Manseld-Cox-de Boor recursion formula we see that,
following the above analysis, the full algorithm for generating the Bezier-
Bernstein points of a B-spline function (g. 7.4)
n

i=1
d
i
N
i,k
(t),
is given in three steps:
Algorithm 13: B-spline to Bezier-Bernstein conversion
Successively for t
p
< t
p+1
= t
k
, . . . , t
p
< t
p+1
= t
n+1
. If t
p+1
is of
multiplicity s with s < k 1:
Step 1: Calculate d
q
p
(t
p+1
) using the B-spline recursion formula where
q = k 1 s.
Step 2: Increase n and for j > p the subscripts of d
j
and t
j
by q.
Step 3: For i = 1, . . . , q replace
t
p+i
by t
p+1
,
d
pq+i
by d
i
pq+i
generating the new control points d
1
pq+1
, . . . , d
q
p
,
d
p+i
by d
qi
p
generating the new control points d
q1
p
, . . . , d
0
p
.
7.4. APPENDIX 151
Figure 7.4: Cubic basis function on (0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3)
7.4 Appendix
We wish to derive the relationship (24) between the two sets of B-spline basis
functions {N
i,k
(t)} and {

N
i,k
(t)}. Recall that the second set diers from the
rst in that it has had one extra knot inserted at

t = t
p+1
.
Recall the denition of the normalized B-spline basis function N
i,k
(t):
If

k
(s; t) = (s t)
k1
+
=
_
(s t)
k1
s t
0 s < t
,
then the standardized B-spline basis function M
i,k
(t) is dened to be the kth
divided dierence of
k
(s; t) in s on t
i
, . . . , t
i+k
for xed t:
M
i,k
(t) =
k
[t
i
, . . . , t
i+k
; t]
=

k
[t
i+1
, . . . , t
i+k
; t]
k
[t
i
, . . . , t
i+k1
; t]
t
i+k
t
i
. (28)
The normalized B-spline basis function N
i,k
(t) is dened as
152 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
N
i,k
(t) = (t
i+k
t
i
)M
i,k
(t). (29)
Using (28) we have the following result,
(

t t
i
)
k
[t
i
, . . . , t
i+k1
,

t; t] + (t
i+k

t)
k
[

t, t
i+1
, . . . , t
i+k
; t]
(t
i+k
t
i
)
k
[t
i
, . . . , t
i+k
; t] = 0 for i = p k + 1, . . . , l.
Hence
(t
i+k
t
i
)M
i,k
(t) = (

t t
i
)M
1
i,k
(t) + (t
i+k

t)M
1
i+1,k
(t) ,
or, using (29),
N
i,k
(t) =

t t
1
i
t
1
i+k
t
1
i
N
1
i,k
(t) +
t
1
i+k+1

t
t
1
i+k+1
t
1
i+1
N
1
i+1,k
(t) , i = p k + 1, . . . , l
as was to be shown.
Note that if t
p+1
occurs with multiplicity s then

t = t
1
p+1
= . . . = t
1
p+s+1
and
so N
1
i,k
(t) = N
1
i,k
(t) for i p k + s and N
1
i,k
(t) = N
i+1,k
(t) for i p + 1.
Figures 5.10a and b illustrate the eect of inserting

t = 1 into the cubic
B-spline knot set (0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3).
7.5. MATRIX REPRESENTATIONS 153
(a) Cubic basis function on (0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 3, 3)
(b) Cubic basis function on (0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3)
Figure 7.5:
7.5 Matrix representations
5) It is possible to express a given set of basis functions of order k over an
interval [
i
,
i+1
] in a given partition in matrix form. Essentially this means
expressing in terms of the explicit polynomial basis (1, t, t
2
, . . . , t
k1
). In the
following we concentrate on the interval [0, 1] but include formulae at the end
154 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
for converting to a general interval.
Bzier-Bernstein basis
Expanding out the Bezier-Bernstein basis functions (B
m
i
(t))
m
i=0
we nd that
( B
m
0
(t) . . . B
m
m
(t) ) = ( 1 t t
2
. . . t
m
) B
m
,
where the elements of the conversion matrix B
m
satisfy the formula:
b
ij
=
_
(1)
ij
_
m
j
__
i
j
_
0 j i m
0 otherwise
.
For the cubic case the matrix B
3
becomes
B
3
=
_
_
_
_
_
1 0 0 0
3 3 0 0
3 6 3 0
1 3 3 1
_
_
_
_
_
.
Cubic Hermite basis
For the cubic Hermite basis we have
( H
0
(t) H
1
(t) H
2
(t) H
3
(t) ) = ( 1 t t
2
t
3
) H,
where the matrix H, obtained by expanding out the Hermite basis functions,
is:
H =
_
_
_
_
_
1 0 0 0
0 0 0 1
3 3 2 1
2 2 1 1
_
_
_
_
_
.
Uniform B-spline
Given a sequence of k uniform B-spline basis functions of order k on the knot
set (t
i
)
2k
i=1
= (k +1, k +2, . . . , k 1, k) we look at the components of each
basis function on the interval [0, 1]. Then
7.6. CONVERSIONS IN MATRIX FORM 155
( N
1,k
(t) . . . N
k,k
(t) ) = ( 1 t t
2
. . . t
k1
) N
k
,
where the general formula for the elements of the matrix N
k
is
n
ij
=
1
(k 1)!
_
k 1
i 1
_
k1

l=j1
(k 1 l)
i1
(1)
lj+1
_
k
l j + 1
_
,
where 1 i, j k.
In the cubic case the components of the 4 basis functions on the knot set
(3, 2, 1, 0, 1, 2, 3, 4) give N
4
as
N
4
=
1
6
_
_
_
_
_
1 4 1 0
3 0 3 0
3 6 3 0
1 3 3 1
_
_
_
_
_
.
In the case of a uniform knot set, (t
i
)
n+k
i=1
, the basis functions are simply
translates of one another and hence the matrix N
k
may be used to evaluate
f(t) over each sub-interval [t
k+j1
, t
k+j
] , j = 1, . . . , n k + 1 in the origi-
nal interval of interest [t
k
, t
n+1
]. In particular, for a uniform cubic B-spline
function
f(t) =
n

i=1
d
i
N
i,k
(t) , t [t
k
, t
n+1
]
we have
f(t) =
1
6
( 1 t t
2
t
3
)
_
_
_
_
_
1 4 1 0
3 0 3 0
3 6 3 0
1 3 3 1
_
_
_
_
_
_
_
_
_
_
d
j
d
j+1
d
j+2
d
j+3
_
_
_
_
_
, t [0, 1]
for j = 1, . . . , n 3.
7.6 Conversions in matrix form
To convert between the various representations using the matrix form it is
necessary to know about the corresponding inverse matrices. For example,
to convert from uniform B-spline,
156 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
f(t) = ( 1 t t
2
. . . t
k1
) N
k
( d
1
. . . d
k
)
T
to Bezier,
f(t) = ( 1 t t
2
. . . t
k1
) B
k1
( b
0
. . . b
k1
)
T
,
we have the equation
( b
0
. . . b
k1
)
T
= B
1
k1
N
4
( d
1
. . . d
k
) .
The inverse of the Bezier conversion matrix B
k1
satises the formula
b
1
ij
=
_
_
i
j
_
/
_
k1
j
_
0 j i k 1
0 otherwise
.
In the cubic case this gives
B
1
3
=
_
_
_
_
_
1 0 0 0
1 1/3 0 0
1 2/3 1/3 0
1 1 1 1
_
_
_
_
_
,
and so
_
_
_
_
_
b
0
b
1
b
2
b
3
_
_
_
_
_
=
1
6
_
_
_
_
_
1 0 0 0
1 1/3 0 0
1 2/3 1/3 0
1 1 1 1
_
_
_
_
_
_
_
_
_
_
1 4 1 0
3 0 3 0
3 6 3 0
1 3 3 1
_
_
_
_
_
_
_
_
_
_
d
1
d
2
d
3
d
4
_
_
_
_
_
=
1
6
_
_
_
_
_
1 4 1 0
0 4 2 0
0 2 4 0
0 1 4 1
_
_
_
_
_
_
_
_
_
_
d
1
d
2
d
3
d
4
_
_
_
_
_
.
7.6.1 Interval conversion for explicit polynomial forms
We list here the formulae for converting an explicit polynomial representation
to and from the [0, 1] form.
(a) Segment of degree n, [a, b] [0, 1]:
7.6. CONVERSIONS IN MATRIX FORM 157
f(u) =
n

i=0
a
i
u
i
for u [a, b].
For t = (u a)/(b a),
f(t) =
n

i=0
b
i
t
i
for t [0, 1] ,
where
b
i
= (b a)
i
ni

j=0
a
i+j
_
i + j
i
_
a
j
.
(b) Segment of degree n, [0, 1] [a, b]:
f(t) =
n

i=0
a
i
t
i
for 0 t 1.
For u = t(b a) + a,
f(u) =
n

i=0
b
i
u
i
for u [a, b] ,
where
b
i
=
ni

j=0
a
i+j
(b a)
i+j
_
i + j
i
_
(a)
j
.
158 CHAPTER 7. CONVERSIONS BETWEEN REPRESENTATIONS
7.6.2 Summary
Conversion from:
1. Interpolating cubic spline (Hermite) (including weighted -splines)
to B-spline.
2. Cardinal spline basis to B-spline.
Knot insertion for conversion from non-uniform B-spline to composite
Bezier.
B-spline recursion formula as special case of knot insertion process when
a knot is to be inserted with multiplicity k 1.
Matrix formulations for
1. Uniform B-spline functions
2. Bezier functions
3. cubic Hermite functions
Conversion using matrix forms.

Вам также может понравиться