+ All Categories
Home > Documents > Curve Fitting - cse.unt.edurenka/4230/CurveFitting.pdfCurve Fitting Problems There are three types...

Curve Fitting - cse.unt.edurenka/4230/CurveFitting.pdfCurve Fitting Problems There are three types...

Date post: 23-Mar-2018
Category:
Upload: vankhanh
View: 226 times
Download: 4 times
Share this document with a friend
64
Curve Fitting R. J. Renka Department of Computer Science & Engineering University of North Texas 12/05/2016 R. J. Renka Curve Fitting
Transcript

Curve Fitting

R. J. Renka

Department of Computer Science & EngineeringUniversity of North Texas

12/05/2016

R. J. Renka Curve Fitting

Curve Representations

There are three ways to represent a planar curve.

1 Functional Form: {(x , y) ∈ R2 : y = f (x)} for some functionf : R→ R.

2 Parametric Form: {(x , y) ∈ R2 : x = f1(t), y = f2(t), t ∈ R}for a pair of functions f1, f2 : R→ R.

3 Implicit Form: {(x , y) ∈ R2 : f (x , y) = 0} for a functionf : R2 → R.

The functional form is limited to one y value for each x value.Only the parametric form extends to space curves. All three formsextend to surfaces and hypersurfaces. The implicitly defined curvesare referred to as contours or level sets.

R. J. Renka Curve Fitting

Curve Fitting Problems

There are three types of curve fitting problem.

1 Approximation: Given a function g : [a, b]→ R, find afunction f in some function space S such that f approximatesg in some sense, such as minimizing ‖f − g‖ for a suitablefunction space norm such as ‖f ‖L∞[a,b] ≡ supa≤x≤b |f (x)|.

2 Data Fitting: Given data points consisting of distinctabscissae x1 < x2 . . . < xn with corresponding data values(ordinates) {yi}ni=1 find a function f ∈ S such that ‖f − y‖ isminimized for some vector norm, where fi = f (xi ).

3 CAGD: Given control points pi = (xi , yi ) or pi = (xi , yi , zi )and basis functions Bi (t), t ∈ [a, b], construct a parametriccurve C(t) =

∑ni=0 Bi (t)pi .

R. J. Renka Curve Fitting

Curve Fitting Problems continued

In all three cases the curve may be interpolatory: f (xi ) = g(xi ) fordiscrete points xi ∈ [a, b], f (xi ) = yi , or C(ti ) = pi for someparameter values ti . In the case of approximation, the evaluationpoints for g may be chosen to control the approximation error bymaking the maximum mesh width hi = xi+1 − xi small. In the datafitting problem we cannot control the error. The data points maycome from some underlying function g , but we cannot evaluate gat arbitrary points. If there are significant errors in the data values,interpolation is not appropriate. A better method is a least squaresfit:

minf ∈S

n∑i=1

wi (yi − f (xi ))2, wi =

(1

δyi

)2

for standard deviation δyi , and a linear space S of dimension lessthan n. The dimension determines a tradeoff between smoothnessand closeness to the data. A good choice for S is polynomialsunless the data suggests something else.

R. J. Renka Curve Fitting

Curve Fitting Applications

In the case of CAGD, the goal is a user-designed curve, perhaps aboundary curve for a user-designed surface, or the centerline of aship hull. In the case of approximation or fitting data from someunderlying function g , the purpose might be to

Evaluate g at points where it is expensive or impossible toobtain data,

Save storage in a table,

Find g ′, g ′′,∫ ba g , etc.

Obtain a picture of the data by graphing y = g(x),

Remove noise and find trends.

R. J. Renka Curve Fitting

Polynomial Interpolation

A polynomial of degree n − 1 (order n > 0) is a function of theform

p(x) =n∑

j=1

cjxj−1 = c1 + c2x + . . .+ cnx

n−1

for x ∈ [a, b] or x ∈ R.

Theorem: Denote by Pn−1[a, b] the set of polynomials of degreeless than or equal to n − 1. This is an n-dimensional linear space.

proof: We first show that the monomials φj(x) = x j−1 are linearlyindependent, and hence form a basis. Supposep(x) =

∑nj=1 cjφj(x) = 0. Then p and all derivatives of p are

identically zero (zero for all x). In particular, p(0) = c1 = 0,p′(0) = c2 = 0,. . . , p(n−1)(0) =(n − 1)!cn = 0, so that allcoefficients are necessarily zero. Now suppose p =

∑j cjφj and

q =∑

j djφj are elements of Pn−1[a, b]. Then αp + βq =∑

j ejφj

for ej = αcj + βdj , so that Pn−1 is closed under linearcombinations. �

R. J. Renka Curve Fitting

Polynomial Interpolation continued

Theorem: Given n distinct abscissae x1, x2, · · · , xn withcorresponding ordinates {yi}ni=1, there is a unique polynomialp ∈ Pn−1[x1, xn] that interpolates the data points: p(xi ) = yi for1 ≤ i ≤ n.

proof: p(xi ) =∑n

j=1 cjxj−1i = yi for all i if and only if Ac = y,

where Aij = x j−1i . Thus, there is a unique polynomial interpolant if

and only if Ac = y has a unique solution; i.e., A is nonsingular.Suppose Ac = 0. Then p(x) =

∑nj=1 cjx

j−1 has n distinct zeros(x1, x2, . . . , xn), and is therefore identically zero by theFundamental Theorem of Algebra. Hence, c = 0, and A isnonsingular. �

Note that there are many good choices for basis functions otherthan the monomials. The polynomial interpolant is unique but hasdifferent coefficients for different basis functions.

R. J. Renka Curve Fitting

Polynomial Interpolation continued

Interpolation is a two-phase process. In the first phase we constructthe interpolant by solving the linear system Ac = y , where c and yare the vectors of coefficients and data values, respectively, and Ais the order-n matrix with components Aij = φj(xi ) for polynomialbasis functions φj . In the case of monomial basis functions, A isthe Vandermonde matrix. It is nonsingular for distinct abscissaebut tends to be ill-conditioned for large n. Solution by Gaussianelimination requires n3/3 + n2 − n/3 multiplies.

The second phase of interpolation involves evaluation of theinterpolant and/or derivatives or integrals of the interpolant. Thenumber of evaluation points is application-dependent. Evaluationof polynomials in the monomial or power form is efficient, butnumerically unstable for large n. (Bernstein polynomial basisfunctions are optimal for stability.) Horner’s method requires n − 1multiplies:

p(x) = c1 + x(c2 + x(c3 + . . .+ x(cn−1 + cnx) . . .)).

R. J. Renka Curve Fitting

Polynomial Interpolation continued

A choice of basis that eliminates the cost of computing coefficientsis the set of Lagrangian basis functions

lj(x) =Πk 6=j(x − xk)

Πk 6=j(xj − xk)⇒ lj(xi ) = δij ,

where δij is the Kronecker delta function. This makes A theidentity matrix, so that the coefficients are the data ordinates.Evaluation, on the other hand, is relatively expensive, requiring2n2 − 3n multiplies and n divides for each evaluation point.

The Lagrangian basis functions have a property that the monomialslack and that is crucial for interactive curve design: they add to 1at every point. To show this, let p(x) = (

∑nj=1 lj(x))− 1. Then p

is a polynomial of degree n− 1 with n zeros, hence identically zero.

R. J. Renka Curve Fitting

Polynomial Interpolation continued

Polynomial interpolation is a global data fitting method: theinterpolant at every point depends on all of the data values, sothat a perturbation of the data value at one end of the curveaffects the other end of the curve. This is an undesirable effectunless n is small. Furthermore, a polynomial of degree n − 1 canhave n − 3 inflection points, causing the curve to oscillate betweenthe data points, especially near the ends. An extreme example ofthis occurs with interpolation of values of Runge’s functionf (x) = 1/(1 + 25x2) on a uniform grid in the interval [−1, 1].Instead of the error approaching zero as the mesh width decreases,the error actually approaches ∞. This is despite the WeierstrassApproximation Theorem which states that any continuous functioncan be uniformly approximated by a polynomial. The result is nottrue if the polynomial is constrained to interpolate a set offunction values.

R. J. Renka Curve Fitting

Splines

In order to localize the effect of perturbations in data points, weemploy low-degree polynomials pieced together with some degreeof continuity and smoothness (continuity of derivatives).

Defn: C k [a, b] = {f : [a, b]→ R such that f , f ′, . . . , f (k) arecontinuous}. This is an infinite-dimensional linear space.

Defn: Give a sequence of distinct knots x1 < x2 < . . . < xn, thepolynomial spline of degree k associated with the knots is apolynomial of degree k on each subinterval [xi , xi+1] and anelement of C k−1[x1, xn].

k = 1: C 0 piecewise linear

k = 2: C 1 piecewise quadratic

k = 3: C 2 cubic spline

The cubic spline is the most popular choice for interpolation. It isglobal but the effect of perturbing a data value decreases rapidlywith distance from the data point.

R. J. Renka Curve Fitting

Degrees of Freedom and Constraints

For n knots, we have n− 1 subintervals and polynomial pieces, andn − 2 interior knots at which we must enforce continuity betweenthe C∞ polynomial pieces. The number of degrees of freedom in apiecewise polynomial is the total number of coefficients or basisfunctions — (k + 1) times the number of polynomial pieces. Eachconstraint, such as a specified value or a requirement for continuityat a point, reduces the number of degrees of freedom by 1.

The number of degrees of freedom in the piecewisepolynomial is (k + 1)(n − 1).The number of degrees of freedom in the spline is((k + 1)(n − 1))− k(n − 2) = n + k − 1.The number of degrees of freedom in the spline interpolant is(n + k − 1)− n = k − 1.The number of degrees of freedom in the piecewise polynomialinterpolant is (k + 1)(n − 1)− 2(n − 1) = kn − k − n + 1.The number of degrees of freedom in the spline interpolant is(kn − k − n + 1)− (k − 1)(n − 2) = k − 1.

R. J. Renka Curve Fitting

Cubic Splines: End Conditions

The k − 1 = 2 degrees of freedom in the cubic spline interpolantare eliminated by specifying end conditions. Choices includespecified first or second derivative values, and the not-a-knotcondition which specifies continuity of third derivative at x2 andxn−1. The reason for the term is that adjacent cubics withthird-derivative continuity across the knot comprise a single cubicfunction. This follows from the fact that fourth and higherderivatives of a cubic function are identically zero. More generally,the definition of a spline enforces the maximum degree ofcontinuity while preserving the piecewise nature of the function.

R. J. Renka Curve Fitting

Cubic Splines: Origins

The first reference to mathematical splines appeared in a 1946paper by I. J. Schoenberg. Mechanical splines were flexible stripsof elastic material (thin beams) fixed at a set of knots for use as adrafting tool. The shape y(x) naturally assumes minimumpotential energy associated with bending:

E =

∫κ2 ds =

∫ (y ′′

s ′3

)2

s ′ dx =

∫y ′′2

(1 + y ′2)5/2dx

for curvature κ. The minimizer of E is referred to as the nonlinearspline, and was first studied by Euler. Given n distinct abscissae xi

with data values yi , the solution to the problem of minimizing thelinearized curvature

∫ xn

x1f ′′2 over functions in H2,2[x1, xn] that

interpolate the data is the natural cubic spline with knots at theabscissae. With additional constraints such as specified endpointfirst or second derivative values, the solution remains the cubicspline.

R. J. Renka Curve Fitting

Hermite Cubic Interpolation

Hermite interpolation refers to interpolation of specified derivativevalues, along with data values. Suppose {di}ni=1 are specified asrequired first derivative values at the abscissae x1 < x2 < . . . < xn.A counting argument shows that a C 1 piecewise cubic function hasjust enough freedom to interpolate both the data values and knotfirst derivative values. The argument can be simplified toconsideration of a single subinterval: there are four degrees offreedom in the cubic, and four constraints associated with theendpoint values and derivatives. The C 1 continuity follows fromthe interpolation conditions. This is a local method. Perturbing adata value or knot derivative value affects the interpolant only inthe one or two subintervals that share the knot. The interpolantcan be formulated in terms of basis functions with support on onlytwo subintervals.

R. J. Renka Curve Fitting

Basis for Hermite Cubic Interpolation

For i = 1, . . . , n − 1, define si (x) = x − xi and hi = xi+1 − xi > 0for distinct abscissae. Then for x ∈ [xi , xi+1], the Hermite cubicinterpolant is

f (x) = fi (x) = H i0(x)yi + H i

1(x)di + H i2(x)di+1 + H i

3(x)yi+1,

where, omitting the subscripts and superscripts,

H0(x) = h3−3hs2+2s3

h3 , H ′0(x) = −6hs+6s2

h3 , H ′′0 (x) = −6h+12sh3 ,

H1(x) = s3−2hs2+h2sh2 , H ′1(x) = 3s2−4hs+h2

h2 , H ′′1 (x) = 6s−4hh2 ,

H2(x) = s3−hs2

h2 , H ′2(x) = 3s2−2hsh2 , H ′′2 (x) = 6s−2h

h2 ,

H3(x) = 3hs2−2s3

h3 , H ′3(x) = 6hs−6s2

h3 H ′′3 (x) = 6h−12sh3 .

R. J. Renka Curve Fitting

Shape-preserving Interpolation

Consider the following shape properties of a data set.

positivity yi > 0 for i = 1, . . . , n,

monotonicity yi < yi+1 for i = 1, . . . , n − 1,

convexity yi − yi−1 < yi+1 − yi for i = 2, . . . , n − 1.

The properties may hold globally or locally (for a contiguous subsetof the indices), analogous properties may be defined with theinequalities reversed, and the inequalities may be nonstrict. Afitting function f is said to preserve the shape of the data if it hasthe corresponding properties f (x) > 0 for all x , f ′(x) > 0 for all x ,and f ′′(x) > 0 for all x . With a relaxed definition that allows fornonexistent derivatives at the knots, the piecewise linearinterpolant of the data preserves the shape of the data. A smoothinterpolant that preserves the shape of the data can also beconstructed. Some applications require a shape-preserving fit.Probability density functions, for example, are monotonic.

R. J. Renka Curve Fitting

Monotonicity-constrained Derivative Estimates

The knot derivative values for the C 1 piecewise cubic Hermiteinterpolant H need not be prespecified. Instead, they may bechosen so that H preserves local monotonicity of the data. Themethod starts with the derivative at xi of the quadratic interpolantof the three points (xi−1, yi−1), (xi , yi ), and (xi+1, yi+1):δi ≡ (∆ihi−1 + ∆i−1hi )/(hi−1 + hi ), where ∆i = (yi+1 − yi )/hi fori = 2, . . . , n − 1 with similar formulas for the endpoints. Theseapproximations are then modified as necessary to satisfy theconstraints. For some data sets this method produces a better fitthan a cubic spline which can have extraneous inflection points.

A more powerful method involves the use of a tension factor ineach subinterval. As tension is increased, the curve segment variesfrom cubic (zero tension) to linear (infinite tension). The tensionfactors can be automatically chosen just large enough to satisfy theconstraints.

R. J. Renka Curve Fitting

Cubic Spline Interpolation

A convenient method for computing a cubic spline interpolant f isto start with the Hermite cubic form, and treat the knot derivativevalues di as a set of n free parameters. We obtain an order-n linearsystem by specifying continuity of second derivative f ′′ at the n− 2interior knots, and adding a pair of linear end conditions. Thisprovides the basis for a flexible software package in which knotderivatives may be user-specified, chosen by a local method topreserve monotonicity, or chosen by solving the system to producea cubic spline. The equations are

f ′′i−1(xi ) =−6∆i−1 + 2di−1 + 4di

hi−1=

6∆i − 4di − 2di+1

hi= f ′′i (xi )⇒

2

hi−1di−1 +

4

hi−1di +

4

hidi +

2

hidi+1 =

6

hi∆i +

6

hi−1∆i−1 ⇒

1

hi−1di−1 +

(2

hi−1+

2

hi

)di +

1

hidi+1 = 3

(∆i−1

hi−1+

∆i

hi

)for i = 2, . . . , n − 1, where ∆i = (yi+1 − yi )/hi .

R. J. Renka Curve Fitting

Cubic Spline Interpolation continued

For end conditions f ′′(x1) = y ′′1 and f ′′(xn) = y ′′n , we have

1

h1(6∆1 − 4d1 − 2d2) = y ′′1 ⇒

2

h1d1 +

1

h1d2 = 3

∆1

h1− y ′′1

2,

1

hn−1(−6∆n−1+2dn−1+4dn) = y ′′n ⇒

1

hn−1dn−1+

2

hn−1dn = 3

∆n−1

hn−1+

y ′′n2.

With n = 5 the system is

2h1

1h1

0 0 01h1

2h1

+ 2h2

1h2

0 0

0 1h2

2h2

+ 2h3

1h3

0

0 0 1h3

2h3

+ 2h4

1h4

0 0 0 1h4

2h4

d1

d2

d3

d4

d5

= 3

∆1h1− y ′′1

6∆1h1

+ ∆2h2

∆2h2

+ ∆3h3

∆3h3

+ ∆4h4

∆4h4

+ y ′′n6

.

R. J. Renka Curve Fitting

Cubic Spline Interpolation continued

For end conditions f ′(x1) = y ′1 and f ′(xn) = y ′n, we have d1 = y ′1and dn = y ′n. There is no way to scale these equations that wouldretain symmetry in the linear system. The right approach is toreduce the system to order n − 2 by moving the given values of d1

and dn to the right hand side. For n = 5 we have2h1

+ 2h2

1h2

01h2

2h2

+ 2h3

1h3

0 1h3

2h3

+ 2h4

d2

d3

d4

=

3( ∆1

h1+ ∆2

h2)− y ′1

h1

3( ∆2h2

+ ∆3h3

)

3( ∆3h3

+ ∆4h4

)− y ′nh4

.In either case, the linear system is symmetric, tridiagonal,diagonally dominant, and positive definite. Hence, no pivoting isrequired for stability, and the operation count is O(n). Thecondition number depends on the distribution of abscissae. Largevariations in hi could result in an ill-conditioned system.

R. J. Renka Curve Fitting

Cubic Spline Interpolation continued

Periodic end conditions are required to obtain a closed curve in theparametric case. We extend f with the additional cubic function fnon [xn, xn+1], where hn = xn+1 − xn > 0, f (xn+1) = y1,f ′(xn+1) = d1, and f ′′(xn+1) = f ′′(x1). Thus

1

hndn +

(2

hn+

2

h1

)d1 +

1

h1d2 = 3

(∆n

hn+

∆1

h1

)and

1

hn−1dn−1 +

(2

hn−1+

2

hn

)dn +

1

hnd1 = 3

(∆n−1

hn−1+

∆n

hn

),

where ∆n = (y1 − yn)/hn. The matrix retains symmetry, and ispositive definite, but the work space requirement increases fromn − 1 to 2(n − 1), the extra array being required to store the fill-inin the last row and last column.

R. J. Renka Curve Fitting

Cubic Spline Interpolation continued

For n = 5,

2h5

+ 2h1

1h1

0 0 1h5

1h1

2h1

+ 2h2

1h2

0 0

0 1h2

2h2

+ 2h3

1h3

0

0 0 1h3

2h3

+ 2h4

1h4

1h5

0 0 1h4

2h4

+ 2h5

d1

d2

d3

d4

d5

= 3

∆5h5

+ ∆1h1

∆1h1

+ ∆2h2

∆2h2

+ ∆3h3

∆3h3

+ ∆4h4

∆4h4

+ ∆5h5

.

R. J. Renka Curve Fitting

Evaluation

Given a point x at which f or a derivative of f is to be evaluated,the first step is to find the index i of the interval [xi , xi+1]containing x . This can be done by a binary search. In someapplications, such as displaying the graph of f , there are manyevaluation points, and they may be ordered. In that case eachsearch requires only constant time.

The evaluation time can be reduced by storing two additionalarrays containing vectors c and e of scaled second and thirdderivative values at the knots. For x ∈ [xi , xi+1]

fi (x) = yi + di (x − xi ) + ci (x − xi )2 + ei (x − xi )

3, where

fi (xi ) = yi ,

f ′i (xi ) = di ,

(1/2)f ′′i (xi ) = ci = (1/hi )(3∆i − 2di − di+1),

(1/6)f ′′′i (xi ) = ei = (1/h2i )(−2∆i + di + di+1).

R. J. Renka Curve Fitting

Evaluation on a Uniform Grid

Suppose we wish to evaluate a cubic functionf (t) = at3 + bt2 + ct + d at n + 1 points uniformly distributed in[α, β]. Let δ = (β − α)/n, ti = α + iδ, and fi = f (ti ) fori = 0, . . . , n. Then, for i = 1, . . . , n,

fi = fi−1 + ∆fi−1, where

∆fi = fi+1 − fi = f (ti + δ)− f (ti )

= a(ti + δ)3 + b(ti + δ)2 + c(ti + δ)− at3i − bt2

i − cti

= a(3t2i δ + 3tiδ

2 + δ3) + b(2δti + δ2) + cδ

= 3aδt2i + (3aδ2 + 2bδ)ti + aδ3 + bδ2 + cδ.

∆fi = ∆fi−1 + ∆2fi−1, where

∆2fi = ∆fi+1 −∆fi

= 3aδ(t2i+1 − t2

i ) + (3aδ2 + 2bδ)(ti+1 − ti )

= 3aδ2(2ti + δ) + 3aδ3 + 2bδ2 = 6aδ2ti + 6aδ3 + 2bδ2.

R. J. Renka Curve Fitting

Evaluation on a Uniform Grid continued

Finally, we have

∆2fi = ∆2fi−1 + ∆3f , where

∆3f = ∆2fi −∆2fi−1 = 6aδ3.

After initialization, the algorithm requires only 3n adds.

for i = 1 to n

fi = fi−1 + ∆f

∆f = ∆f + ∆2f

∆2f = ∆2f + ∆3f

endfor

R. J. Renka Curve Fitting

Evaluation on a Uniform Grid continued

Initialization is as follows.

δ = (β − α)/n

f0 = f (α) = [(aα + b)α + c]α + d

∆f = ∆f0 = 3aδα2 + (3aδ2 + 2bδ)α + aδ3 + bδ2 + cδ

= [aδ2 + (3aα + b)δ + (3aα2 + 2bα + c)]δ

= δ([a(3α + δ) + b]δ + α(3aα + 2b) + c)

∆2f = ∆2f0 = 2δ2(3aδ + b + 3aα)

= 2δ2[3a(α + δ) + b]

∆3f = 6aδ3

R. J. Renka Curve Fitting

Parametric Curves

A parametric space curve is the range (image) of a functionC : [a, b]→ R3. Note that the function represents more than thecurve; it associates points on the curve with parameter values. Thefunction may be thought of as defining the trajectory of a particlemoving through space, in which case the parameter is time. Aparametric curve can always be reparameterized. If, for example,t = a + b − t, then the function C defined by C(t) ≡ C(t) has thesame range as C but the path is in the reverse direction. Wegenerally require that C be differentiable, and assume that theparameterization is regular: C′(t) 6= 0 for all t ∈ [a, b], so that thecurve has a tangent direction at every point, and the particlecannot reverse direction.

When the emphasis is on the curve rather than the trajectory, therange of parameter t is irrelevant, and it is convenient to take[a, b] = [0, 1].

R. J. Renka Curve Fitting

Interpolatory Parametric Curves

Given control points pi = (xi , yi ), i = 0, . . . , n, suppose that wewish to construct an interpolatory parametric curve C such thatC(ti ) = pi for all i and some choice of discrete parameter values ti(a knot sequence in the case of a spline fit). Some reasonablechoices are

Uniform ti = i

Chord-length t0 = 0 and ti =∑i

j=1 ‖pj − pj−1‖ for i = 1, . . . , n

Centripetal t0 = 0 and ti =∑i

j=1

√‖pj − pj−1‖ for i = 1, . . . , n

Note that ti−1 < ti is required in order to preserve the order inwhich the control points are traversed. Note also that, in all threecases, the parameter values can be normalized to the interval [0, 1]by simply scaling ti by 1/tn for all i .

R. J. Renka Curve Fitting

Interpolatory Parametric Curves continued

Uniformly distributed values are not appropriate when thedistances between control points vary widely, resulting in widelyvarying speed, large acceleration, overshoot and undershoot. Thecumulative chord-length method results in constant average speedbetween control points, but does not account for changes invelocity direction. The centripetal parameterization is derived fromphysical heuristics with the goal of smoothing out variations in thecentripetal force acting on a moving particle. There are moreelaborate methods, but centripetal is a good choice. Any methodcan be defeated by a suitably chosen set of control points. Loopsare unavoidable for some data.

R. J. Renka Curve Fitting

Parametric versus Geometric Continuity

Geometric continuity of order k , denoted G k , refers to continuitywith respect to arc length, and differs from parametric continuity(component functions in C k [a, b]): G 0 and C 0 are equivalent, buta curve may be G1 and not C 1, or C 1 and not G 1, and a curvemay be G 2 and not C 2, or C 2 and not G 2. Note, however, that aG 2 curve (with continuous tangent and curvature) can bereparameterized with arc length parameterization, making it C 2.

Example: The following is G 1 but not C 1:

x(t) =

{12t if 0 ≤ t ≤ 14t + 8 if 1 ≤ t ≤ 2

y(t) =

{9t if 0 ≤ t ≤ 13t + 6 if 1 ≤ t ≤ 2

.

x ′(t) =

{12 if 0 ≤ t ≤ 14 if 1 ≤ t ≤ 2

y ′(t) =

{9 if 0 ≤ t ≤ 13 if 1 ≤ t ≤ 2

.

The unit tangent is constant — T (t) = (.8, .6) for all t, but thespeed drops from 15 to 5 at t = 1.

R. J. Renka Curve Fitting

Parametric versus Geometric Continuity continued

If speed decreases continuously to zero, and then starts increasingin a different direction, we have C 1 parametric continuity butundefined tangent direction where velocity is zero (a non-regularparameterization). Example: The following is C 1 but not G 1:

x(t) =

{2t − t2 if 0 ≤ t ≤ 1t2 − 2t + 2 if 1 ≤ t ≤ 2

y(t) =

{2t − t2 if 0 ≤ t ≤ 12t − t2 if 1 ≤ t ≤ 2

.

x ′(t) =

{2− 2t if 0 ≤ t ≤ 12t − 2 if 1 ≤ t ≤ 2

y ′(t) =

{2− 2t if 0 ≤ t ≤ 12− 2t if 1 ≤ t ≤ 2

.

The values are C(0) = (0, 0),C(1) = (1, 1), and C(2) = (2, 0), andthe velocity vectors are C′(0) = (2, 2),C′(1) = (0, 0), andC′(2) = (2,−2). The unit tangent vector is piecewise constantwith values (1/

√2)(1, 1) in [0, 1) and (1/

√2)(1,−1) in (1, 2].

R. J. Renka Curve Fitting

Computer Aided Geometric Design (CAGD)

We shift emphasis now from data fitting to curve design. Ratherthan fitting a curve to measured or computed data values, thecurve is fit to a sequence of control points which an interactiveuser manipulates with the goal of producing a smooth curveappropriate to some application such as ship hull design. Weconsider both planar curves and space curves.The standard format for a space curve is

C(u) =n∑

i=0

Bi (u)pi ,

where Bi is a basis function, and pi = (xi , yi , zi ) is a control pointfor i = 0, . . . , n. We could interpret the components of C as linearcombinations of the basis functions, but it is more instructive tothink of the curve as a weighted sum of the control points, wherethe weights are basis functions. (For each parameter value u, thebasis function values Bi (u) are weights associated with the pointC(u) on the curve.)

R. J. Renka Curve Fitting

Bernstein Polynomial Basis Functions

The degree-n Bernstein polynomials are defined by

Bi (u) =

(ni

)ui (1− u)n−i , u ∈ [0, 1] for

(ni

)=

n!

i !(n − i)!

and i = 0, . . . , n, where 0! = 1 and u0 = 1 for u = 0. Expressionsfor the polynomials on a general interval [a, b] can be obtained bya change of variable t = a + (b − a)u. For n = 3 we have

B0(u) = (1− u)3, B ′0(u) = −3(1− u)2, B ′′0 (u) = 6(1− u)B1(u) = 3u(1− u)2, B ′1(u) = 3(1− 3u)(1− u), B ′′1 (u) = −6(2− 3u)B2(u) = 3u2(1− u), B ′2(u) = 3u(2− 3u), B ′′2 (u) = 6(1− 3u)B3(u) = u3, B ′3(u) = 3u2, B ′′3 (u) = 6u

The midpoint u = (1/2) values are B0 = B3 = 1/8 andB1 = B2 = 3/8. Also, B1 has an inflection point at u = 2/3, andB ′′2 = 0 at u = 1/3.

R. J. Renka Curve Fitting

Bernstein Polynomial Properties

1 Bi ∈ Pn[0, 1] for i = 0, . . . , n.2 B0(0) = 1,Bi (0) = 0 for i 6= 0, Bn(1) = 1, and Bi (1) = 0 for

i 6= n. B ′0(0) = −n,B ′1(0) = n,B ′i (0) = 0 for i > 1, etc.3 {Bi (u)}ni=0 is a basis for Pn[0, 1]. To prove the functions are

linearly independent, suppose p(u) =∑n

i=0 αiBi (u) = 0.Then p(0) = α0 = 0 and p(1) = αn = 0. Using those results,we then get p′(0) = α1 = 0 and p′(1) = αn−1 = 0.Proceeding by finite induction, we get αi = 0 for all i .

4 Bi (u) ≥ 0 for all u ∈ [0, 1].5 Partition of unity: for every point u,∑n

i=0 Bi (u) =∑n

i=0

(ni

)ui (1− u)n−i = (u + 1− u)n = 1.

6 Bi is maximized at u = i/n, and Bi (i/n) > Bj(i/n) for j 6= i .7 Reflection symmetry about u = 1/2:

Bn−i (1− u) =

(n

n − i

)(1− u)n−iui = Bi (u).

8 spt(Bi ) = [0, 1].R. J. Renka Curve Fitting

Bernstein Polynomial Evaluation

The following theorem provides a stable evaluation algorithm usingrecursion on the polynomial degree, now included as a superscript.Theorem Bn

i (u) = (1− u)Bn−1i (u) + uBn−1

i−1 (u), (i = 0, . . . , n),

where B00 (u) = 1, and Bk

i (u) = 0 for i < 0 and i > k .

proof: First note that(n − 1

i

)+

(n − 1i − 1

)=

(n − 1)!

i !(n − 1− i)!+

(n − 1)!

(i − 1)!(n − i)!

=(n − 1)!(n − i + i)

i !(n − i)!=

n!

i !(n − i)!=

(ni

).

Hence

Bni (u) =

(n − 1

i

)ui (1− u)n−i +

(n − 1i − 1

)ui (1− u)n−i

= (1− u)Bn−1i (u) + uBn−1

i−1 (u). �

R. J. Renka Curve Fitting

Bernstein Polynomial Stability

The theorem implies an evaluation algorithm based on repeatedcomputation of convex combinations. The number of operationsrequired to compute the n + 1 basis function values at a singlepoint u is n2 + n − 2 multiplies and n(n − 1)/2 + 1 adds. This isless efficient than the n − 1 multiplies required by Horner’s methodfor monomial basis functions. The Bernstein polynomials, however,have an advantage in terms of numerical stability.

Given a set of coefficients defining a polynomial in terms of somebasis functions, the problem of computing a value, derivative, orzero of the polynomial is ill-conditioned for monomial basisfunctions, but not for Bernstein basis functions. More precisely, asmall perturbation in the coefficients has much more effect on themonomial form than on the Bezier form. The monomial form isespecially problematic for high polynomial degree.

R. J. Renka Curve Fitting

Bezier Curve Properties

Given control points pi ∈ Rd for d = 2 or d = 3, and i = 0, . . . , n,the Bezier curve associated with the control points is the range of

C(u) =n∑

i=0

Bi (u)pi ,

where {Bi : [0, 1]→ R}ni=0 are the Bernstein polynomial basisfunctions. The curve properties follow from the properties of thebasis functions (cited in square brackets).

1 Only the endpoints are interpolated: C(0) = p0 andC(1) = pn [2]. Also, C′(0) = n(p1 − p0), andC′(1) = n(pn − pn−1) so that the curve is tangent to thecontrol polygon at the endpoints [2].

2 C ∈ (C∞[0, 1])3 [1].3 The curve is globally controlled by {pi}ni=0 [8], but we have

pseudo-local control in the sense that the effect of moving pi

decreases with distance from C(i/n) [6].

R. J. Renka Curve Fitting

Bezier Curve Properties continued

4 C is coordinate-free. Let T be an affine transformation on Rd

defined by T (p) = Ap + b, A linear. Then

T (C(u)) = T

(n∑

i=0

Bi (u)pi

)= A

(n∑

i=0

Bi (u)pi

)+ b

=

(n∑

i=0

Bi (u)Api

)+ b

=n∑

i=0

Bi (u)Api + bn∑

i=0

Bi (u) [5]

=n∑

i=0

Bi (u)T (pi ),

so that the transformed curve is the Bezier curve associatedwith the transformed control points.

R. J. Renka Curve Fitting

Bezier Curve Properties continued

5 C has the convex hull property. Since the weights arenonnegative and add to 1 ([4] and [5]), C(u) is a convexcombination of the control points for every u ∈ [0, 1]; i.e., thecurve is contained in the convex hull of the control points.

6 C has the variation diminishing property. The number ofintersections of the curve with an arbitrary plane is less thanor equal to the number of intersections of the control polygonwith the plane. For example, a planar Bezier curve could beconvex (have at most two intersections with any plane otherthan its containing plane) even though its control polygon isnot convex, and a convex control polygon implies a convexcurve. In the nonparametric case (functional form), the Beziercurve preserves monotonicity of the control polygon.

R. J. Renka Curve Fitting

Degree Elevation Property

Since

(1− u)Bni (u) =

n + 1− i

n + 1Bn+1

i (u)

and

uBni (u) =

i + 1

n + 1Bn+1

i+1 (u),

C(u) = (1− u)C(u) + uC(u)

=n∑

i=0

n + 1− i

n + 1Bn+1

i (u)pi +n∑

i=0

i + 1

n + 1Bn+1

i+1 (u)pi

=n+1∑i=0

n + 1− i

n + 1Bn+1

i (u)pi +n+1∑j=0

j

n + 1Bn+1

j (u)pj−1

=n+1∑i=0

Bn+1i (u)pi for pi =

n + 1− i

n + 1pi +

i

n + 1pi−1.

R. J. Renka Curve Fitting

Hand-drawing Bezier Curves

Hand-drawing rule for cubics:

C(1/2) = (1/8)(p0+3p1+3p2+p3), C′(1/2) = (3/4)(−p0−p1+p2+p3).

Define

M1 =p0 + p1

2, M2 =

p1 + p2

2, M3 =

p2 + p3

2,

M4 =M1 + M2

2=

p0 + 2p1 + p2

4,

M5 =M2 + M3

2=

p1 + 2p2 + p3

4,

M =M4 + M5

2= C

(1

2

), M5 −M4 =

1

3C′(

1

2

).

The curve then goes through M with tangent direction M5 −M4.Note the variation diminishing property.

R. J. Renka Curve Fitting

Piecewise Bezier Curves

In the above construction, the Bezier curve associated with controlpoints p0, M1, M4, and M is {C(u) : 0 ≤ u ≤ (1/2)}, and theBezier curve associated with M, M5, M3, and p3 is{C(u) : (1/2) ≤ u ≤ 1}. If M1 or M3 is altered, we then have aG 1 piecewise cubic Bezier curve. It remains G 1 as long as M4, M,and M5 are collinear. More generally, we obtain a locally controlledG 1 curve by piecing together low-degree (2 to 4) Bezier curves insuch a way that tangents vary continuously. The pieces need notall have the same degree.

For piecewise cubics, we can take p0, p3, p6, . . . to be interpolatedcontrol points, and take p1, p2, p4, p5, p7, . . . to be auxiliarycontrol points which a user manipulates to control the shape.

The theory was started in the late 1950’s by Pierre Bezier atRenault and Paul de Casteljau at Citroen working independently ondesign of auto bodies.

R. J. Renka Curve Fitting

deCasteljau Algorithm for Bezier Curves

The hand-drawing rule is a special case (associated with u = .5) ofa more general property of Bezier curves. For u ∈ [0, 1], defineb0

i (u) = pi and

bri (u) = (1− u)br−1

i (u) + ubr−1i+1 (u) for

{r = 1, . . . , ni = 0, . . . , n − r

.

Then bn0(u) = C(u).

In the case of cubics (n=3), we have the following tableau ofcontrol points.

b00

b01 b1

0

b02 b1

1 b20

b03 b1

2 b21 b3

0

The curve is subdivided at u: {C(t) : t ∈ [0, u]} has controlpolygon b0

0, b10, b2

0, b30, while {C(t) : t ∈ [u, 1]} has control

polygon b30, b2

1, b12, b0

3.R. J. Renka Curve Fitting

Matrix Formulation for Cubic Bezier Curves

The Bernstein polynomials can be converted to monomial form forfast evaluation by Horner’s method (at a price in loss of stability).For the cubics

B0(t) = (1− t)3 = −t3 + 3t2 − 3t + 1

B1(t) = 3t(1− t)2 = 3t3 − 6t2 + 3t

B2(t) = 3t2(1− t) = −3t3 + 3t2

B3(t) = t3

Hence

C(t)T = [ t3 t2 t 1 ]

−1 3 −3 1

3 −6 3 0−3 3 0 0

1 0 0 0

pT0

pT1

pT2

pT3

.An alternative, analogous to Horner’s method, for s = 1− t:

C(t) = [(sp0 + 3tp1)s + 3t2p2]s + t3p3.R. J. Renka Curve Fitting

Hermite Cubic Parametric Curves

Given knots u0 < u1 < . . . < un, control points pi and derivativevectors di in R2 or R3 for i = 0, . . . , n, define basis functions asthe piecewise cubic polynomials φi and ψi on [u0, un] such that

φi (uj) = δij , φ′i (uj) = 0,

ψi (uj) = 0, ψ′i (uj) = δij ,

for i , j = 0, . . . , n. Then the Hermite cubic polynomial interpolantis

C(u) =n∑

i=0

φi (u)pi +n∑

i=0

ψi (u)di .

Note that g(u) =∑n

i=0 φi (u)− 1 is a piecewise cubic with doublezeros at the knots, and is therefore identically zero, so that∑n

i=0 φi (u) = 1 for all u.

R. J. Renka Curve Fitting

Hermite Cubic Parametric Curves continued

If Tp = Ap + b, where A is linear, then

T (C(u)) = A

(n∑

i=0

φi (u)pi

)+ b + A

(n∑

i=0

ψi (u)di

)

=n∑

i=0

φi (u)T (pi ) +n∑

i=0

ψ(u)(Adi );

i.e., we transform the curve by applying T to the control pointsand A to the derivative vectors.

R. J. Renka Curve Fitting

Hermite Cubic Parametric Curves continued

The Hermite cubic basis functions (restricted to their support) are

φi (u) =

{H i−1

3 for u ∈ [ui−1, ui ]H i

0 for u ∈ [ui , ui+1], ψi (u) =

{H i−1

2 for u ∈ [ui−1, ui ]H i

1 for u ∈ [ui , ui+1],

where, for u ∈ [ui , ui+1],

C(u) = H i0(u)pi + H i

1(u)di + H i2(u)di+1 + H i

3(u)pi+1.

Let t = (u − ui )/(ui+1 − ui ) ∈ [0, 1], and define

C(t) = C(u) = H0(t)C(0) + H1(t)C′(0) + H2(t)C′(1) + H3(t)C(1).

Expressions for H0, . . . , H3 are obtained by observing that C is thecubic Bezier curve defined by control points p0, p1, p2, and p3,where C(0) = p0, C′(0) = 3(p1 − p0), C′(1) = 3(p3 − p2), andC(1) = p3.

R. J. Renka Curve Fitting

Hermite Cubic Parametric Curves continued

We thus have

C(t) = H0(t)p0 + 3H1(t)(p1 − p0) + 3H2(t)(p3 − p2) + H3(t)p3.

Equating weights, we obtain B0 = H0 − 3H1, B1 = 3H1,B2 = −3H2, and B3 = 3H2 + H3. Hence

H0(t) = B0(t) + B1(t) = (1− t)3 + 3t(1− t)2 = 2t3 − 3t2 + 1,

H1(t) = (1/3)B1(t) = t(1− t)2 = t3 − 2t2 + t,

H2(t) = −(1/3)B2(t) = −t2(1− t) = t3 − t2,

H3(t) = B2(t) + B3(t) = 3t2(1− t) + t3 = −2t3 + 3t2.

Values of H i0, . . . ,H

i3 are then obtained by substituting

(u − ui )/(ui+1 − ui ) for t in the above expressions with H1(t) andH2(t) scaled by du

dt = ui+1 − ui .

R. J. Renka Curve Fitting

Uniform Cubic B-splines

Given n + 5 knots ui for i = −2,−1, . . . , n + 2, uniformlydistributed (e.g., ui = i), define the cubic B-spline Bi , sometimesdenoted Bi ,3 or B3

i , for i = 0, . . . , n, as the cubic spline withsupport [ui−2, ui+2], triple zeros at the endpoints, and the propertythat the knot values sum to 1.

To see that Bi is uniquely defined, note that it has 16 degrees offreedom (a cubic on each of four intervals), and there are 16linearly independent constraints:

Bi (ui−2) = B ′i (ui−2) = B ′′i (ui−2) = 0

Bi (ui+2) = B ′i (ui+2) = B ′′i (ui+2) = 0

Bi is continuous at ui−1, ui , and ui+1

B ′i is continuous at ui−1, ui , and ui+1

B ′′i is continuous at ui−1, ui , and ui+1

Bi (ui−1) + Bi (ui ) + Bi (ui+1) = 1

R. J. Renka Curve Fitting

Uniform Cubic B-splines continued

With uniformly distributed knots, all n + 1 B-splines are defined byfour cubic blending functions fi : [0, 1]→ R

1 f1(t) = (1/6)t3

2 f2(t) = (1/6)(−3t3 + 3t2 + 3t + 1)

3 f3(t) = (1/6)(3t3 − 6t2 + 4)

4 f4(t) = (1/6)(−t3 + 3t2 − 3t + 1)

The mappings between B-splines and blending functions aredefined by

1 f1(t) = Bi |[ui−2,ui−1] for t = (u − ui−2)/(ui−1 − ui−2)

2 f2(t) = Bi |[ui−1,ui ] for t = (u − ui−1)/(ui − ui−1)

3 f3(t) = Bi |[ui ,ui+1] for t = (u − ui )/(ui+1 − ui )

4 f4(t) = Bi |[ui+1,ui+2] for t = (u − ui+1)/(ui+2 − ui+1)

R. J. Renka Curve Fitting

Uniform Cubic B-splines continued

Table of Knot Function Values

u Bi (u) B ′i (u) B ′′i (u)

ui−1 1/6 1/2 1ui 2/3 0 -2

ui+1 1/6 -(1/2) 1

Exercise Compute the first, second, and third derivatives of theblending functions, and evaluate them at the endpoints to showthat Bi satisfies the 16 constraints and has discontinuous thirdderivative.

Note the following properties:∑ni=0 Bi (u) =

∑4i=1 fi (t) = 1 for all u and t.

Reflection symmetry about t = .5: f4(t) = f1(1− t) andf3(t) = f2(1− t).

Inflection points: f ′′2 (1/3) = f ′′3 (2/3) = 0.

R. J. Renka Curve Fitting

B-spline Curve

Given control points pi ∈ Rd for i = 0, . . . , n and B-spline basisfunctions Bi : [u0, un]→ R, the B-spline curve is{C(u) : u ∈ [u0, un]} for the function

C(u) =n∑

i=0

Bi (u)pi .

Cubic B-splines have the following properties:1 C is a C 2 parametric cubic spline; i.e., its components are

linear combinations of cubic splines, and therefore are cubicsplines.

2 The control points are not interpolated. The closest point ofthe curve to pj is

C(uj) = (1/6)pj−1 + (2/3)pj + (1/6)pj+1.

3 The curve is locally controlled. The portion of the curveaffected by a perturbation of pj is that associated with thesupport of Bj — {C(u) : uj−2 ≤ u ≤ uj+2}.

R. J. Renka Curve Fitting

B-spline Curve continued

4 The curve is coordinate-free (affine invariant).

5 The curve has the convex hull property. Not only is eachpoint C(u) of the curve contained in the convex hull of thecontrol points {pi}ni=0, but we have the stronger propertythat, for u ∈ [uj , uj+1],

C(u) = Bj−1(u)pj−1 + Bj(u)pj + Bj+1(u)pj+1 + Bj+2(u)pj+2

= f4(t)pj−1 + f3(t)pj + f2(t)pj+1 + f1(t)pj+2

for t = (u − uj)/(uj+1 − uj), where∑4

i=1 fi (t) = 1 andfi (t) ≥ 0 for all t, so that C(u) is in the convex hull of fourcontrol points.

Hand-drawing rule: C(uj) = (2/3)pj + (1/3)M forM = (pj−1 + pj+1)/2, and C′(uj) = (pj+1 − pj−1)/2.

R. J. Renka Curve Fitting

Rendering

For u ∈ [uj , uj+1], t = (u − uj)/(uj+1 − uj) ∈ [0, 1],

C(t) = f4(t)pj−1 + f3(t)pj + f2(t)pj+1 + f1(t)pj+2

and

C(t)T = (1/6)[ t3 t2 t 1 ]

−1 3 −3 1

3 −6 3 0−3 0 3 0

1 4 1 0

pTj−1

pTj

pTj+1

pTj+2

.

Partition [0, 1] into k subintervals ti = i/k (i = 0, 1, . . . , k). Foreach geometry vector [pj−1 pj pj+1 pj+2]T , (j = 0, . . . , n − 1),connect C(ti−1) to C(ti ) with a line segment for i = 1, . . . , k .Note that this requires two phantom control points p−1 and pn+1.

R. J. Renka Curve Fitting

End Conditions

The phantom control points define end conditions.

Define p−1 = 2p0 − p1 and pn+1 = 2pn − pn−1. ThenC(u0) = (1/6)p−1 + (2/3)p0 + (1/6)p1 = p0 andC(un) = (1/6)pn−1 + (2/3)pn + (1/6)pn+1 = pn. Also,C′(u0) = −(1/2)p−1 + (1/2)p1 = p1 − p0 andC′(un) = −(1/2)pn−1 + (1/2)pn+1 = pn − pn−1. Thus, thefirst and last control points are interpolated, and the endpointtangent are defined by the first two and last two controlpoints.

Periodic control points: p−1 = pn and pn+1 = p0.

Duplicate control points: p−1 = p0 and pn+1 = pn.

R. J. Renka Curve Fitting

Duplicate Control Points

Duplicate control points in the interior reduce geometric continuity.The function retains C 2 parametric continuity, but the curve losescontinuity of curvature (has only G 1 continuity) at a doubledcontrol point pj+1 = pj where

C(uj) = (1/6)pj−1 + (5/6)pj , C(uj+1) = (5/6)pj + (1/6)pj+2,

C′(uj) = (1/2)(pj − pj−1), C′(uj+1) = (1/2)(pj+2 − pj+1).

At a triple control point pj−1 = pj = pj+1 we have only G 0

continuity. C(uj) = pj so that pj is interpolated, and

C(uj−1) = (1/6)pj−2 + (5/6)pj , C(uj+1) = (5/6)pj + (1/6)pj+2.

The tangent at pj is undefined:

C′(uj−1) = (1/2)(pj−pj−2), C′(uj) = 0, C′(uj+1) = (1/2)(pj+2−pj).

R. J. Renka Curve Fitting

Nonuniform B-splines

We now consider B-splines of degree k for 1 ≤ k ≤ kmax withnonuniformly distributed knots, including duplicate knots (knotswith multiplicity greater than 1). We may either use knots outsidethe domain of the function C or take the endpoint knots to havemultiplicity k . We will use a recursive definition. Alternative meansof defining B-splines include divided differences and convolution.For n ≥ kmax, assume we have a nondecreasing sequence of knotsui for −1 ≤ i ≤ n + kmax, and define the linear functions

Lki (u) =

u − ui−1

ui+k−1 − ui−1

for i = 0, . . . , n + 1 + k − kmax. Then

B0i (u) =

{1 if ui−1 ≤ u < ui

0 otherwise

for 0 ≤ i ≤ n + kmax, and, for 0 ≤ i ≤ n + kmax − k ,

Bki (u) = Lk

i (u)Bk−1i (u) + (1− Lk

i+1(u))Bk−1i+1 (u).

R. J. Renka Curve Fitting

Nonuniform B-splines continued

The support of Bki (u) is [ui−1, ui+k ]. The linear B-spline is

B1i (u) =

u − ui−1

ui − ui−1B0

i (u) +

(1− u − ui

ui+1 − ui

)B0

i+1(u).

The terms that are undefined due to duplicate knots are taken tobe zeros. Just as duplicate control points reduce geometriccontinuity and move the curve closer to the control polygon in thecase of uniform B-splines, duplication of interior knots results inloss of parametric continuity and moves the curve closer to thecontrol polygon in the nonuniform case. The continuity class of adegree-k B-spline is C k−1 if there are no duplicate knots otherthan the endpoints, C k−2 at a double knot (for k ≥ 2), C k−3 at atriple knot (for k ≥ 3), etc. A cubic B-spline curve interpolatesany control points associated with a knot of multiplicity 3.

R. J. Renka Curve Fitting

Nonuniform Rational B-splines (NURBS)

Given control points pi ∈ Rd , degree-k B-spline basis functionsBk

i : [u0, un]→ R, and nonnegative weights wi for i = 0, . . . , n, theB-spline curve associated with control points (wipi ,wi ) ∈ Rd+1 is

n∑i=0

Bki (u)

[wipi

wi

].

We obtain a rational B-spline curve in Rd by projecting throughthe origin onto the hyperplane w = 1:

C(u) =

∑ni=0 wiB

ki (u)pi∑n

i=1 wiBki (u)

.

Note that C is a polynomial B-spline if wi = c for all i . Theweights are shape parameters: increasing wi pulls the curve towardpi . The curve has all of the properties of a polynomial B-splinecurve with the additional property of invariance under a projectiveprojection.

R. J. Renka Curve Fitting

Classification of Parametric Curves

The following table summarizes the tradeoffs among curveproperties. For the degree-k spline, assume that k > 1.

Degree-1 Hermite Degree-k Poly. BezierSpline Cubic Spline Interp. Curve

Continuity C 0 C 1 C k−1 C∞ C∞

Interpolates Yes Yes No Yes NoLocal Control Yes Yes Yes No NoCoord-free Yes Yes Yes Yes/No YesConvex hull Yes No Yes No Yes

The column labeled ’Poly. Interp.’ is a polynomial interpolant. ForLagrangian basis functions it is coordinate-free; with monomials itis not. A fundamental tradeoff is that C∞ continuity requires aglobal method. Also, with the exception of (nonsmooth) piecewiselinear interpolation, the convex hull property excludes interpolation(except at the endpoints).

R. J. Renka Curve Fitting

Parametric Surfaces

A parametric surface is of the form

{S(u, v) = (x(u, v), y(u, v), z(u, v)) : u ∈ [a, b], v ∈ [c, d ]}.

A regular parametric surface has linearly independent first partialderivatives Su and Sv so that Su × Sv 6= 0, and the tangent planeand surface normal direction are therefore well-defined at everypoint. A G 1 surface has continuous tangent and normal, hencecontinuity of specular reflection (highlights). A tensor productsurface is of the form

S(u, v) =∑

i

∑j

Bij(u, v)pi ,j ,

where the basis functions Bij may be expressed as productsBij(u, v) = fi (u)gj(v).

R. J. Renka Curve Fitting

Parametric Surfaces continued

A parametric tensor product B-spline surface is constructed fromtensor products of univariate B-splines:

S(u, v) =n∑

i=0

m∑j=0

Bki (u)B l

j (v)pij

for knot sequences ui and vj and polynomial degrees k and l . Arational B-spline surface is defined as the projection of a 4D tensorproduct B-spline surface but is not itself a tensor product surface.A B-spline surface may be closed in one direction, forming acylinder, or both, forming a torus. No tensor product surface canhave the topology of a sphere without degeneracies.

Just as NURBS curves allow the exact representation of conicsections, rational B-spline surfaces allow the exact representationof surfaces of revolution and of quadric surfaces (zeros of quadraticfunctions of three variables, including spheres and cylinders).

R. J. Renka Curve Fitting

Parametric Surfaces Constructed from Curves

A surface of revolution is of the form

S(u, v) = (r(v) cos(2π u), r(v) sin(2π u), z(v))

for u, v ∈ [0, 1]. The curve (r(v), z(v)) in the xz-plane is revolvedabout the z-axis. For fixed v , the intersection of the surface withthe plane z = z(v) is a circle of radius r(v). Another means ofgenerating a surface from curves is a generalized cylinder surface,defined by

S(u, v) = (1− v)Y0(u) + vY1(u)

for v ∈ [0, 1] and parametric curves Y0(u) and Y1(u). A tubesurface has the form

S(u, v) = C(v) + r(v) cos(2πu)n(v) + r(v) sin(2πu)b(v)

for center curve C(v), radius r(v), and orthonormal vectors t(v),n(v), and b(v), where t(v) = C′(v)/‖C′(v)‖. A surface ofrevolution is a tube surface with a line segment as center curve.

R. J. Renka Curve Fitting


Recommended