150 Chapter 9 Constructing Spline Curves
The least squares approach—identical to our development of the polynomial case
in Section 7.8—produces the normal equations
LP P
Y,
d;
J2
Nf(Wi)NliWi) =
J2 PtK(^i); fe = 0,...,
L.
(9.7)
This is a linear system of L + 1 equations for the unknowns d^, with a
coefficient matrix M whose elements my^^ are given by
p
The symmetric matrix M is often ill conditioned—special equation solvers,
such as a Cholesky decomposition, should be employed. For more details on the
numerical treatment of least squares problems, see
[376].
The matrix M is singular if and only if there is a span
[^y_i,
Uj_^^]
that contains
no Wj. This fact is known as the Schoenberg-Whitney theorem.
In cases where there are gaps in the data points, there is still a remedy: we may
employ smoothing equations in exactly the same way as was done in Section 7.9.
The addition of these equations, now applied to B-spline control vertices instead
of Bezier control vertices, will guarantee a solution. In cases where there is noise
in the data, these equations will also help in obtaining a better shape of the least
squares curve.
We have so far assumed much more than would be available in a practical
situation. First, what should the degree n ht} In most cases,
w
= 3 is a reasonable
choice. The knot sequence poses a more serious problem.
Recall that the data points are typically given without assigned data parameter
values Wi. The centripetal parametrization from Section 9.6 will give reasonable
estimates, provided that there is not too much noise in the data. But how many
knots
Uj
shall we use, and what values should they receive? A universal answer
to this question does not exist—it will invariably depend on the application at
hand. For example, if the data points come from a laser digitizer, there will be
vastly more data points p^ than knots w/.
Figures 9.1 through 9.4 give some examples. In all four figures, 1,000 points
were sampled from a spiral, and noise was added. The parameter values were as-
signed according to the centripetal parametrization; the knots were assigned uni-
formly. The best fit and shape is obtained, not surprisingly, by using a relatively
high degree and many intervals; see Figure 9.4. The corresponding curvature
plots are shown in Figure 23.1.
After the curve p(w) has been computed, we will find that many distance
vectors
p^
—
p(w//) are not perpendicular to
p(w^/).
This means that the point p(w//)