Global B-Spline Curve Fitting by Least Squares

Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
This Demonstration shows global B-spline curve fitting by the least-squares method. B-splines are a generalization of Bezier curves. In a B-spline, each control point is associated with a particular basis function. The implementation is fully described in the Details.
Contributed by: Shutao Tang (October 2015)
(Northwestern Polytechnical University, Xi'an City, China)
Open content licensed under CC BY-NC-SA
Snapshots
Details
For definitions and details of the B-spline curve and B-spline basis function, see Related Links.
Assume that and
are given, where
. We seek a
-degree nonrational curve
,
,
satisfying
(1) ,
,
(2) the remaining are approximated in the least-squares sense; that is,
is a minimum with respect to the
variables.
Here, and
are precomputed parameter values.
Let
,
.
Then set
.
So is a scalar-valued function of the
variables
. Applying the standard technique of linear least-squares fitting to minimize
, set the derivatives with respect to the
points,
, to zero. The
of these derivatives is
,
which implies that
.
It follows that
. (1)
Equation (1) is one linear equation in the unknowns . Letting
yields the system of
equations in
unknowns,
,
where is the
matrix of scalars
, (2)
is the vector of
points
, (3)
and
.
In order to set up equations (2) and (3), a knot vector with parameters
is required.
The can be computed using the following method (with
, in each case):
(1) Equally spaced
,
,
(2) Chord length
let , then
,
,
(3) Centripetal
let , then
,
,
The placement of the knots should reflect the distribution of the . If
, denote by
the largest integer less than or equal to
. We need a total of
knots; there are
internal knots and
internal knot spans.
Let
.
Then define the internal knots by
,
,
,
. (4)
Equation (4) guarantees that every knot span contains at least one , and under this condition the matrix
is positive definite and well-conditioned.
Reference
[1] L. Piegl and W. Tiller, The NURBS Book, 2nd ed., Berlin: Springer-Verlag, 1997 pp. 410–413.
Permanent Citation