280
CHAP
.5 CURVE FITTING
Piecewise Cubic Splines
The ﬁtting of a polynomial curve to a set of data points has applications in CAD
(computer-assisted design), CAM (computer-assisted manufacturing), and computer
graphics systems. An operator wants to draw a smooth curve through data points that
are not subject to error. Traditionally, it was common to use a french curve or an ar-
chitect’s spline and subjectively draw a curve that looks smooth when viewed by the
eye. Mathematically, it is possible to construct cubic functions
S
k
(
x
)
on each inter-
val
[
x
k
,
x
k
+
1
]
so that the resulting piecewise curve
y
=
S
(
x
)
and its ﬁrst and second
derivatives are all continuous on the larger interval
[
x
0
,
x
N
]
. The continuity of
S
±
(
x
)
means that the graph
y
=
S
(
x
)
will not have sharp corners. The continuity of
S
±±
(
x
)
means that the
radius of curvature
is deﬁned at each point.
Deﬁnition 5.1.
Suppose that
{
(
x
k
,
y
k
)
}
N
k
=
0
are
N
+
1 points, where
a
=
x
0
<
x
1
<
···
<
x
N
=
b
. The function
S
(
x
)
is called a
cubic spline
if there exist
N
cubic
polynomials
S
k
(
x
)
with coefﬁcients
s
k
,
0
,
s
k
,
1
,
s
k
,
2
, and
s
k
,
3
that satisfy the following
properties:
I.
S
(
x
)
=
S
k
(
x
)
=
s
k
,
0
+
s
k
,
1
(
x
−
x
k
)
+
s
k
,
2
(
x
−
x
k
)
2
+
s
k
,
3
(
x
−
x
k
)
3
for
x
∈[
x
k
,
x
k
+
1
]
and
k
=
0, 1,
...
,
N
−
1.
II.
S
(
x
k
)
=
y
k
for
k
=
0, 1,
,
N
.
III.
S
k
(
x
k
+
1
)
=
S
k
+
1
(
x
k
+
1
)
for
k
=
0, 1,
,
N
−
2.
IV.
S
±
k
(
x
k
+
1
)
=
S
±
k
+
1
(
x
k
+
1
)
for
k
=
0, 1,
,
N
−
2.
V.
S
±±
k
(
x
k
+
1
)
=
S
±±
k
+
1
(
x
k
+
1
)
for
k
=
0, 1,
,
N
−
2.
±
Property I states that
S
(
x
)
consists of piecewise cubics. Property II states that the
piecewise cubics interpolate the given set of data points. Properties III and IV require