You are on page 1of 18

Computer Aided Geometric Design 17 (2000) 179–196

www.elsevier.com/locate/comaid

Convergent inversion approximations


for polynomials in Bernstein form

Rida T. Farouki 1
Department of Mechanical and Aeronautical Engineering, University of California, Davis, CA 95616, USA
Received December 1998; revised June 1999

Abstract
Given a monotone polynomial function λ = f (t) in Bernstein form on t ∈ [ 0, 1 ], we formulate
an algorithm that computes a sequence of rapidly convergent Bernstein-form polynomial approxi-
mations Pn (λ) to the inverse t = f −1 (λ) of this function. The method is based upon a least-squares
minimization of the error en (λ) = f −1 (λ) − Pn (λ), using the orthogonal Legendre polynomials to
yield an uncoupled sequential computation of the least-squares coefficients, and it requires only the
standard arithmetic, degree elevation, and composition algorithms for polynomials in Bernstein form.
An extension of the method to error minimization under the constraint of fixed end values is also pre-
sented. As an example application, we show that the algorithm can be used to derive representations
for polynomial PH curves that come arbitrarily close to the ideal of arc-length parameterization.
 2000 Elsevier Science B.V. All rights reserved.

Keywords: Bernstein basis; Inversion of polynomials; Least-squares approximations; Legendre


polynomials; Polynomial composition

1. Introduction

A function λ = f (t) that is monotone over an interval t ∈ [a, b] of interest has a single-
valued inverse, t = f −1 (λ). Except in trivial cases, however, this inverse does not admit
a simple closed-form expression. The parametric curve and surface representations used
in CAGD are based upon polynomial (or sometimes rational) functions, and the ability to
invert such functions is thus a useful basic tool in a variety of geometrical computations.
A monotone polynomial function of degree m 6 4 can, in principle, be inverted in
terms of expressions involving radicals. In the case of cubics and quartics, these inverse
expressions are cumbersome, and complex arithmetic must be employed to evaluate them.

1 E-mail: farouki@ucdavis.edu.

0167-8396/00/$ – see front matter  2000 Elsevier Science B.V. All rights reserved.
PII: S 0 1 6 7 - 8 3 9 6 ( 9 9 ) 0 0 0 4 6 - 1
180 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

For polynomials of degree m > 4, such inversions are impossible, and one must resort to
approximations.
By suitable translations and scalings we may assume that the domain and range of the
function λ = f (t) are t ∈ [0, 1] and λ ∈ [0, 1]. Moreover, if f (t) is monotone on [0, 1], we
must have either f 0 (t) > 0 or f 0 (t) < 0 over that interval. For the sake of definiteness, we
assume the former.
One approach to representing the inverse t = f −1 (λ) of
λ = f (t) = a1 t + a2 t 2 + · · · + am t m (1)
is to regard the above as an infinite series, in which all terms of order > m + 1 vanish.
A power series with a zero constant term always admits a reversion, i.e., the development
of an “inverted” series
t = f −1 (λ) = c1 λ + c2 λ2 + c3 λ3 + c4 λ4 + c5 λ5 + · · · (2)
expressing the independent variable in terms of the dependent variable. By substituting (2)
into (1), the coefficients c1 , c2 , . . . are found to be
c1 = 1/a1 ,
c2 = −a2 /a13 ,
c3 = (2a22 − a1 a3 )/a15 ,
c4 = (5a1 a2 a3 − 5a23 − a12 a4 )/a17 ,
· · · etc.
The main shortcoming of this approach is that the reverted series (2) will be convergent
only within some radius ρ about λ = 0, which may be insufficient to accommodate
the interval λ ∈ [0, 1] that interests us. Standard methods for estimating the radius of
convergence, such as the limits (Henrici, 1974)
1 |ck+1 |
= lim |ck |1/ k or lim ,
ρ k→∞ k→∞ |ck |
can be very difficult to evaluate in the present context.
Another approach, that guarantees uniform convergence to continuous functions on
finite intervals, is the use of Bernstein polynomial approximants. Let t0 , t1 , . . . , tn be the
values of t at which f has the values 0/n, 1/n, . . . , n/n—these values are the (unique)
real roots of the polynomial equations
k
f (tk ) = for k = 0, . . . , n,
n
i.e., we have tk = f −1 (k/n). Then we may write
Xn  
n
t ≈ Bn (λ) = tk (1 − λ)n−k λk
k
k=0

as the nth order Bernstein polynomial approximant to f −1 (λ). The problem with this
method is that, while uniform convergence is certain, it is very slow—the error decreases
only like 1/n with the degree n of the approximant (Davis, 1975).
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 181

To circumvent these difficulties, we adopt a least-squares approach to the approximation


of f −1 (λ) in this paper. The least-squares approximants can be efficiently constructed
by expressing them as orthogonal Legendre series. In Section 2 below we review some
properties of the Legendre polynomials on [0, 1] and show how the Legendre coefficients
of the approximants can be computed sequentially. We also describe the evaluation of the
approximation error, and conversion of the approximant to Bernstein form. The algorithm
given in Section 3 summarizes these results. Unconstrained least-squares approximants
do not ordinarily match the endpoint values of a function, and in some applications this is
unacceptable. In Section 4 we therefore develop an extension of the algorithm, to minimize
the least-squares error with constrained end values. Finally, Sections 5 and 6 present some
computed examples and an example application of the method, and Section 7 offers some
concluding remarks.

2. Least-squares approximation

Let λ be a degree-m polynomial function of t in Bernstein form,


X
m
λ = f (t) = ak bkm (t), (3)
k=0

that is monotone on the unit interval: f 0 (t) > 0 for t ∈ [0, 1]. Here
 
m
bk (t) =
m
(1 − t)m−k t k for k = 0, . . . , m
k
are the Bernstein basis functions of degree m on t ∈ [0, 1]. We assume the function (3) has
range λ ∈ [0, 1], so that f (0) = a0 = 0 and f (1) = am = 1. A simple sufficient condition
for monotonicity of f (t) is that its Bernstein coefficients a0 , a1 , . . . , am are monotone in
value. In some circumstances, f (t) is known to be monotone by construction (see, for
example, Section 6 below).
We are interested in finding Bernstein-form polynomial approximations
X
n
t = f −1 (λ) ≈ Pn (λ) = ck bkn (λ) (4)
k=0

to the inverse function t = f −1 (λ). We use a least-squares measure εn for the closeness of
approximation, defined by
Z1
 2
εn2 = f −1 (λ) − Pn (λ) dλ. (5)
0

2.1. The Legendre polynomials

Although we ultimately wish to express the polynomial approximants to the inverse


function in the Bernstein form (4), it is convenient in least-squares problems to adopt a
182 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

set of polynomial basis functions that are orthogonal on the domain of interest (Davis,
1975; Isaacson and Keller, 1994). This allows the coefficients of the approximant to be
determined directly, without solving a linear system. Moreover, these coefficients exhibit
permanence with respect to the degree of the approximant—i.e., all the coefficients
of Pn+1 (λ) in the orthogonal basis agree with those of Pn (λ), except for that of the
newly-introduced term. The Legendre polynomials 2 are perhaps the simplest system of
orthogonal polynomials on a finite interval—usually assumed to be [−1, +1]. For our
purposes, however, it is preferable to map the domain to [0, 1]. The Legendre polynomials
Lj (u) on u ∈ [0, 1] can be generated by the recurrence relation
(j + 1)Lj +1 (u) = (2j + 1)(2u − 1)Lj (u) − j Lj −1 (u)
for j = 1, 2, . . . , commencing with L0 (u) = 1 and L1 (u) = 2u − 1. Alternately, with
L0 (u) = 1, they may be defined for j = 1, 2, . . . by Rodrigues’ formula
1 dj 2
Lj (u) = (u − u)j (6)
j ! duj
or by the requirement that
Z1
Lj (u)uk du = 0 for k = 0, . . . , j − 1
0

together with the normalization condition Lj (1) = 1. The first few Legendre polynomials
on [0, 1] are thus

L0 (u) = 1,
L1 (u) = 2u − 1,
L2 (u) = 6u2 − 6u + 1,
L3 (u) = 20u3 − 30u2 + 12u − 1,
L4 (u) = 70u4 − 140u3 + 90u2 − 20u + 1,
· · · etc.
The orthogonality of the Legendre polynomials is expressed by the relation

Z1  1 if k = j ,
Lj (u)Lk (u) du = 2j + 1 (7)

0 0 if k 6= j .
Some other properties that we shall make use of are as follows: the end-point values of
Lj (u) are given by

Lj (0) = (−1)j and Lj (1) = 1, (8)

2 Introduced by Adrien-Marie Legendre in 1785, in his investigation of the gravitational attraction of a solid of
revolution, “Recherches sur l’attraction des sphéroïdes”.
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 183

while the indefinite integral may be expressed as


Z
Lj +1 (u) − Lj −1 (u)
Lj (u) du = for j > 1, (9)
4j + 2
R
and L0 (u) du = u. We also need to express the Legendre polynomials in Bernstein form.
Since
 
2j 2j
(u2 − u)j = (−1)j bj (u),
j
by applying the differentiation rule (Farouki and Rajan, 1988) for the Bernstein basis
functions
d n  n−1 
b (u) = n bi−1 (u) − bin−1 (u)
du i
to Rodrigues’ formula (6) one can verify by induction that, in the degree-j Bernstein basis,
the j th Legendre polynomial
X
j
j
Lj (u) = Mj k bk (u) (10)
k=0
on u ∈ [0, 1] has the coefficients
 
j +k j
Mj k = (−1) for k = 0, . . . , j.
k
To express Lj (u) in the Bernstein basis of arbitrary degree n (> j ), we use the degree
elevation algorithm (Farouki and Rajan, 1988)—see Appendix A.

2.2. Least-squares Legendre coefficients

We begin by writing the approximation Pn (λ) to f −1 (λ) as a Legendre series,


Xn
Pn (λ) = `k Lk (λ). (11)
k=0
To evaluate the error measure (5), it is convenient to express the integral in terms of t,
Z1
 2
εn2 = t − Pn (f (t)) f 0 (t) dt. (12)
0
Substituting (11) into (12) and differentiating with respect to the coefficient `j then gives
Z1 " X n
#
∂εn2
=−2 t− `k Lk (f (t)) Lj (f (t))f 0 (t) dt.
∂`j
0 k=0

Upon equating this derivative to zero and invoking the orthogonality relation (7), we obtain
the expressions
Z1
`j = (2j + 1) tLj (f (t))f 0 (t) dt, (13)
0
184 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

j = 0, 1, . . . , n, for the Legendre coefficients of Pn (λ). We can use integration by parts to


simplify this—invoking (8) and (9) and the fact (Farouki and Rajan, 1988) that
Z1
1
bin (t) dt = for i = 0, . . . , n, (14)
n+1
0

we obtain
1 X
m
`0 = 1 − ak (15)
m+1
k=0

for the case j = 0, and


Z1
1
`j = Lj −1 (f (t)) − Lj +1 (f (t)) dt for j > 1. (16)
2
0

We now write the composition of the Bernstein forms (3) and (10) of the polynomial f
and the j th Legendre polynomial Lj in the Bernstein basis of degree mj as

X
mj
mj
Lj (f (t)) = αj k bk (t). (17)
k=0

For each j , the coefficients αj k for k = 0, . . . , mj can be easily determined by the


composition algorithm for polynomials in Bernstein form (DeRose, 1988), summarized
in Appendix A. Then, using (14), we have
" −m +m
#
1 1 X
mj
1 X
mj
`j = αj −1,k − αj +1,k . (18)
2 mj − m + 1 mj + m + 1
k=0 k=0

2.3. Conversion to Bernstein form

We have shown above how to compute the Legendre coefficients `0 , `1 , `2 , . . . of Pn (λ)


in an uncoupled and sequential manner. For numerical stability and compatibility with
CAD conventions, however, we prefer to store the inverse approximations in Bernstein
form (Farouki and Rajan, 1987). This can be accomplished by a process of successive
degree elevation of the Bernstein representation of Pj −1 (λ) to degree j , and use of (10) to
express the contribution of the j th Legendre polynomial in the degree-j Bernstein basis.
Thus, for j = 1, 2, . . . , we write

  X j
j
Pj (λ) = (1 − λ) + λ Pj −1 (λ) + `j Mj k bk (λ), (19)
k=0

where multiplication by (1 − λ) + λ represents a unit degree elevation (see Appendix A).


The Bernstein coefficients of Pj (λ) are thus obtained through a term-by-term addition of
the degree-elevated coefficients ck of Pj −1 (λ) with the quantities `j Mj k for k = 0, . . . , j .
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 185

The process commences by noting trivially that the Bernstein coefficient c0 of the
constant approximation P0 (λ) is given by (15). After n steps one has the Bernstein form
of the degree-n inverse approximation,
X
n
Pn (λ) = ck bkn (λ).
k=0
Note that, if the polynomial λ = f (t) is monotone (with f 0 (t) > 0) over the domain t ∈
[0, 1], its inverse t = f −1 (λ) must be monotone over the corresponding range λ ∈ [0, 1].
Monotonicity of the Bernstein coefficients
c0 < c1 < · · · < cn
is a sufficient condition for the approximate inverse Pn (λ) to be monotone. One could, in
principle, attempt to modify the approximation scheme so as to guarantee monotonicity
by appending such a system of linear inequalities to the minimization of (5). However,
the implementation becomes much more involved, and in practice the above inequalities
are far too restrictive—they exclude many satisfactory monotone solutions. As a pragmatic
measure, we recommend that monotonicity of Pn (λ) be checked a posteriori by applying
standard root isolation methods (Lane and Riesenfeld, 1981) to its derivative. In fact, no
instances of non-monotonicity of Pn (λ) were observed in the test cases we ran.
An alternative approach to least-squares approximation by polynomials in Bernstein
form, described by Jüttler (1998), relies on construction of the basis d0n (t), . . . , dnn (t) that
is “dual” to the degree-n Bernstein basis b0n (t), . . . , bnn (t)—defined by the property
Z1 
1 if j = k,
djn (t)bkn (t) dt = δj k =
0 if j 6= k
0
for j, k = 0, . . . , n. The least-squares Bernstein coefficients are then simply
Z1 Z1
ck = dkn (λ)f −1 (λ) dλ = tdkn (f (t))f 0 (t) dt, k = 0, . . . , n.
0 0
However, the dual basis construction is somewhat involved (Jüttler, 1998), and must be
repeated each time we increase the degree of the approximant. The simplicity of the “on-
the-fly” conversion (19) from Legendre to Bernstein form makes our method preferable in
terms of efficiency and ease of implementation.

2.4. Evaluation of approximation error

Consider the approximation error


Z1 Z1
 −1
2  2
εj2 = f (λ) − Pj (λ) dλ = t − Pj (f (t)) f 0 (t) dt (20)
0 0
for the j th order approximant. Once the Bernstein coefficients c0 , . . . , cj of Pj (λ) are
known, we may, in principle, evaluate this by using the composition and multiplication
186 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

rules (see Appendix A) to express the integrand in the Bernstein basis of degree 2mj +
m − 1 on t ∈ [0, 1]. Thus, with
+m−1
2mjX
 2 2mj +m−1
t − Pj (f (t)) f 0 (t) = ek b k (t) (21)
k=0
we have
+m−1
2mjX
1
εj2 = ek .
2mj + m
k=0
However, we can avoid explicitly computing the high-degree polynomial (21) by
expanding the integrand and using integration by parts. This gives

1 X
m+1
εj2 = k(k − 1)(ak−1 − ak−2 )
(m + 1)(m + 2)
k=2
X X +m
1 X
j mj 2j
2 2
− ck + γj k + βk , (22)
j +1 mj + m + 1 2j + 1
k=0 k=0 k=0
where γj k for k = 0, . . . , mj + m are the coefficients of the composition
X
mj +m
mj +m
Ij (f (t)) = γj k b k (t)
k=0
of λ = f (t) with the indefinite integral (Farouki and Rajan, 1988)
Z j +1
X k−1 
1 X j +1
Ij (λ) = Pj (λ) dλ = ci bk (λ)
j +1
k=1 i=0
of Pj (λ), and the coefficients of the square
X
2j
2j
Pj2 (λ) = βk bk (λ)
k=0
of Pj (λ) are given, for k = 0, . . . , 2j , by
X
min(j,k) j j 
i k−i
βk = 2j 
ci ck−i .
i=max(0,k−j ) k

3. Algorithm

We now summarize the above results by outlining an algorithm that computes an


approximation Pj (λ) to the inverse t = f −1 (λ) of the degree-m polynomial (3), satisfying
a prescribed bound δ on the error measure defined by (20).
input: Bernstein coefficients a0 , . . . , am of λ = f (t) & tolerance δ
0. set P0 (λ) = `0 , as given by Eq. (15), and j = 1
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 187

1. compute Bernstein coefficients αj −1,k for k = 0, . . . , mj − m and αj +1,k for


k = 0, . . . , mj + m of Lj −1 (f (t)) and Lj +1 (f (t)) by the composition algorithm
2. compute the Legendre coefficient `j from Eq. (18)
3. elevate the degree of Pj −1 (λ) to obtain Bernstein coefficients c0 , . . . , cj in the
basis of degree j
4. add the contributions `j Mj k from the j th Legendre polynomial to the Bernstein
coefficients ck for k = 0, . . . , j
5. compute the approximation error εj from Eq. (22)
6. if εj < δ and Pj (λ) is monotone, stop—otherwise increment j and go back to
step 1

output: Bernstein coefficients c0 , . . . , cj of the polynomial approximation Pj (λ) to the


inverse t = f −1 (λ) of λ = f (t)

In terms of computational complexity, composition of the polynomial f (t) of degree m


with Legendre polynomials Lj (t) of successive degrees j in step 1 will dominate the total
cost when j m  1. The composition algorithm—see Appendix A—involves O(j 3 m2 )
arithmetic operations, excluding the computation of binomial coefficients. The error
evaluation in step 5 involves a single composition, of similar cost, while the monotonicity
test in step 6 invokes (Lane and Riesenfeld, 1981) the de Casteljau algorithm on the
derivative of Pj (λ), with cost O(j 2 ). Nevertheless, we have not found CPU times to be
a significant concern in test examples involving composite degrees j m of ∼ 100 or more.

4. Approximation with end constraints

The error (5) is an absolute minimum when the Legendre coefficients of the approx-
imation Pn (λ) to f −1 (λ) are determined in the unconstrained manner described in Sec-
tion 2.2. However, this approximation does not, in general, exhibit the proper end values,
f −1 (0) = 0 and f −1 (1) = 1. Typically, the end-value discrepancies diminish rapidly with
the degree n of the approximant, but for some applications it may be essential to guarantee
the proper end values for all n, even at the expense of somewhat worse error values (5).
A similar problem has been discussed by Lachance (1988) in the context of “Chebyshev
economization” for polynomial parametric curves and surfaces, i.e., the determination
of lower-degree approximants to loci that minimize the largest point-wise error between
the given locus and the approximant. Again the solutions exhibit end-point discrepancies,
which are unacceptable in the context of spline curves and surfaces, and the economization
procedure must be modified to explicitly interpolate end values (see also (Watkins and
Worsey, 1988)).
Imposing end values Pn (0) = 0 and Pn (1) = 1 on the approximant (11) amounts to
introducing the two linear constraints
X
n X
n
φ0 (`0 , . . . , `n ) = (−1)k `k = 0, φ1 (`0 , . . . , `n ) = −1 + `k = 0 (23)
k=0 k=0
188 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

on the Legendre coefficients. Thus, introducing the Lagrange undetermined multipliers µ


and ν, we seek to minimize
Z1 " Xn
#2
t− `k Lk (f (t)) f 0 (t) dt + µφ0 (`0 , . . . , `n ) + νφ1 (`0 , . . . , `n )
0 k=0

subject to the constraints (23). Clearly, we must have n > 2 if any degrees of freedom are
to be left over for the minimization. Differentiating the above with respect to `j , and using
arguments analogous to those of Section 2.2, yields
1 X
m
1
`0 = 1 − ak − (µ + ν) (24)
m+1 2
k=0

for the case j = 0, and


Z1  
1 1  
`j = Lj −1 (f (t)) − Lj +1 (f (t)) dt − j + (−1)j µ + ν (25)
2 2
0

for j = 1, . . . , n. Eqs. (24) and (25), together with the constraints (23), comprise a loosely-
coupled system of n + 3 linear equations for the unknowns `0 , . . . , `n , µ, ν. We will
now show how to compute µ and ν a priori, allowing the Legendre coefficients for the
constrained approximation problem to be determined sequentially from expressions (24)
and (25).
By substituting (24) and (25) into (23), we obtain a pair of simultaneous linear equations
for µ and ν. After some straightforward (but rather lengthy) manipulations, we obtain the
solutions
An Sn − Bn Rn An Rn − Bn Sn
µ= , ν= , (26)
A2n − Bn2 A2n − Bn2
where An and Bn denote the sums
Xn   X
n  
1 (n + 1)2 1 n+1
An = j+ = , Bn = (−1)j j + = (−1)n
2 2 2 2
j =0 j =0

and the constants Rn and Sn are defined by


 
1 X X
mn mn+m
1 1
Rn = − αn,k + αn+1,k ,
2 mn + 1 mn + m + 1
k=0 k=0
 
1 X X
mn mn+m
n1 1
Sn = (−1) αn,k − αn+1,k .
2 mn + 1 mn + m + 1
k=0 k=0

Here, the quantities αj k for k = 0, . . . , mj are the Bernstein coefficients of the composite
polynomial Lj (f (t)), introduced in Eq. (17) above.
Hence, by pre-computing µ and ν for any desired final degree n of the approximant,
we can compute the Legendre coefficients for the constrained approximation problem by
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 189

simply subtracting (j + 12 )[(−1)j µ + ν] from each unconstrained Legendre coefficient `j ,


for j = 0, . . . , n.
If, instead of choosing the final degree n of the approximant a priori, we desire a
hierarchical scheme in which successive terms are introduced until a prescribed bound
on the error is satisfied, the Lagrange multipliers µ and ν appropriate to each degree must
be re-computed as the algorithm proceeds.
The modifications to the algorithm of Section 3 required to include the Lagrange
multipliers (26) appropriate to the end constraints (23) are straightforward, so we refrain
from explicitly enumerating them. We note, also, that it should not be difficult to extend
the above generalization to encompass higher-order Hermite end constraints (i.e., fixed end
values and derivatives).
For a different approach to least-squares approximation with constrained end values,
that does not employ the Lagrange multipliers, see Appendix A.

5. Computed example

As an example, consider the quartic λ = f (t) with Bernstein coefficients


a0 = 0, a1 = 0.15, a2 = 0.75, a3 = 0.9, a4 = 1. (27)
Approximants Pn (λ) to the inverse function t = f −1 (λ), with fixed end values Pn (0) = 0
and Pn (1) = 1, were computed for n = 2, 3, . . . , 20. The CPU time required to construct
these approximants is quite insignificant, even for the high-degree instances. The n =
2 approximation is somewhat crude, since it offers only one degree of freedom for
minimization of the error. However, successive approximants converge rapidly to the true

Fig. 1. Variation of pointwise error for approximants Pn (λ) of degree n = 8, 10, . . . , 16 to the inverse
f −1 (λ) of the quartic with Bernstein coefficients (27).
190 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

Fig. 2. Variation of the error measure εn , defined by Eq. (5), with the degree n of the Bernstein-form
polynomial inversion approximations (4).

inverse, and for n > 4 the graph of the inverse approximation t = Pn (λ) can hardly be
distinguished from that of λ = f (t) when the two are drawn on the same plot.
Fig. 1 shows the variation 3 of the error en (λ) = f −1 (λ) − Pn (λ) for some of the
higher-degree cases. These errors exhibit the characteristic oscillatory behavior of best-fit
polynomial approximations. Finally, Fig. 2 illustrates the convergence of the approximants
by plotting the error measure defined in (5) against the degree n of the approximant, on a
log-linear scale.

6. Arc-length parameterization of PH curves

A basic limitation of the polynomial/rational curve parameterizations used in CAD


systems is the fact that the curve parameter can never be precisely equal to the arc length
(Farouki and Sakkalis, 1991). The optimal re-parameterizations of polynomial curves, that
minimize the deviation from the ideal of “unit speed” parameterization without altering the
curve degree, can be identified (Farouki, 1997; Jüttler, 1997)—but they offer, in general,
only limited scope for improvement.
The inversion approximation scheme allows higher-order representations of the Pythago-
rean-hodograph (PH) curves (Farouki, 1992; Farouki and Sakkalis, 1990) to be computed,

3 To compute exact values of t = f −1 (λ), we apply a Newton–Raphson iteration to the equation F (t) =
f (t) − λ = 0 for successive fixed values of λ.
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 191

that come arbitrarily close to the arc-length parameterization. Recall that the PH curve
with hodograph r0 (t) = (u2 (t) − v 2 (t), 2u(t)v(t)) has the parametric speed
q
ds
σ (t) = = x 02 (t) + y 02 (t) = u2 (t) + v 2 (t),
dt
where s(t) is the cumulative arc length. If u(t) and v(t) are polynomials of degree d with
Bernstein coefficients u0 , . . . , ud and v0 , . . . , vd , then σ (t) is the polynomial of degree 2d
with Bernstein coefficients
d d 
X
min(d,k)
j k−j
σk = 2d 
(uj uk−j + vj vk−j )
j =max(0,k−d) k

for k = 0, . . . , 2d. Integration then gives the polynomial arc-length function


Zt X
m
s(t) = σ (τ ) dτ = sk bkm (t)
0 k=0

of degree m = 2d + 1, with Bernstein coefficients

1 X
k−1
s0 = 0 and sk = σj for k = 1, . . . , m.
m
j =0

The total arc length is S = s(1) = (σ0 + · · · + σm−1 )/m. Note that s(t), being the integral
of a non-negative polynomial, is a monotone function.
Let λ = f (t) = s(t)/S be the fractional arc length of the degree-m PH curve r(t), and
let Pn (λ) be the nth polynomial approximation to the inverse function t = f −1 (λ) (with
constrained end values). Then the compositions
X
mn
Rn (λ) = r(Pn (λ)) = pnk bkmn (λ) for n = 2, 3, . . . (28)
k=0
of the approximate inverses t ≈ Pn (λ) with the PH curve r(t) yield a sequence of degree-
elevated representations 4 of this curve, whose parameter variations approximate the
fractional arc length λ with increasing accuracy. The Bézier control points, pnk for k =
0, . . . , mn, of Rn (λ) may be computed from the original control points p0 , . . . , pm of r(t)
and the coefficients c0 , . . . , cn of Pn (λ) by the composition algorithm (see Appendix A).
Fig. 3 illustrates the application of this re-parameterization scheme to a PH quintic.
Note that explicit composition of the re-parameterization function with the original
curve can yield rather high-degree representations. It is usually advantageous to store the
original curve and the re-parameterization function separately, allowing each coordinate
component of (28) to be evaluated at any given λ with m + n, rather than mn, additions
and multiplications.
Ong (1996) has described a method similar to the above procedure, based on
approximating the inverse of the arc-length function by interpolation of sampled values

4 Note that the geometrical locus of the curve remains unaltered—only the parametric flow along it is changed
by the substitution t = Pn (λ).
192 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

Fig. 3. Re-parameterizations of a PH quintic by approximations of degree 3 and 5 to the inverse of the


fractional arc-length function, λ = s(t)/S. For the original curve (top) the normalized speed σ (t)/S
varies by a factor of ∼ 3. This variation is reduced to just a few percent in the n = 5 case. The control
polygons of the re-parameterized versions, obtained by composition of the inverse approximations
with the original control polygon, are also shown.

and derivatives using C 2 quintic splines. This approach may be preferable when very tight
tolerances on the deviation from true arc-length parameterization are desired, since the
error can be subdued by introducing further spline knots rather than increasing the degree.
Our method has the advantage of retaining just a single C ∞ curve representation and,
although it incurs rather high degrees, we have not encountered evidence of numerical
instability in examples with mn up to ∼ 100 when the stable Bernstein form is employed
consistently throughout the calculations.

7. Conclusion

The ability to “invert” monotone polynomials is a basic computational tool, that


has applications in a wide variety of CAGD problems. The monotonicity constraint is
R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 193

not a limitation of the particular algorithm proposed herein, but rather a fundamental
requirement for the existence of a single-valued inverse—non-monotone functions must
be broken up into domains of monotonicity, over each of which a single-valued inverse can
be defined.
Of course, it is always possible to invert a monotone polynomial function on a “point-
by-point” basis, by use of a root-finding procedure. The method described herein is
advantageous when a differentiable functional form for the inverse is necessary, such
as in the re-parameterization problem of Section 6, or repeated root-finding would be
computationally prohibitive.
The inversion method also has direct bearing on various problems that arise in computing
the intersections of parametric curves (Sederberg et al., 1984; Sederberg and Parry, 1986).
A degree-m polynomial curve x = f (t), y = g(t) has an implicit equation h(x, y) = 0,
also of degree m, that is obtained by taking the resultant of p(t, x) = f (t) − x and
q(t, y) = g(t) − y with respect to t. As a by-product, one can also solve the point inversion
problem—given the Cartesian coordinates (x∗ , y∗ ) of a curve point, find the corresponding
parameter value t∗ (Sederberg et al., 1984).
Now if, say, x = f (t) is monotone, the methods described herein allow us to compute
approximations Pn (x) of any desired accuracy to the “functional inversion” t = f −1 (x).
By substituting the latter into y = g(t), one obtains convergent polynomial approximations
to a special type of implicit equation—namely, the functional description y = F (x) of the
curve.
Finally, we remark that the overall strategy of our approximation scheme is not
limited to inversion of polynomials: it can also be used to approximate more general
functions, provided the integrals for the Legendre coefficients are easily evaluated. The
ease of conversion between Legendre and Bernstein forms, expressed by Eq. (19), allows
us to simultaneously take advantage of the simplicity and efficiency of least-squares
minimization with the former, and the numerical stability and geometrical insight offered
by the latter.

Acknowledgement

This work was supported in part by the National Science Foundation under grant CCR-
9996045.

Appendix A

The inversion approximation scheme requires several standard algorithms for Bernstein-
form polynomials—arithmetic operations, degree elevation, subdivision, etc. These are
widely known, and descriptions may be found in, for example, (Farin, 1993) or (Farouki
and Rajan, 1988). Since the composition algorithm (DeRose, 1988) for Bernstein-form
polynomials is not as well-known or as straightforward, we briefly review it here. We
also sketch an alternative approach to the problem of least-squares approximation under
constrained end values in Section 4, that does not require the introduction of Lagrange
undetermined multipliers.
194 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

A.1. Bernstein basis composition algorithm

The composition algorithm is concerned with computing the Bernstein coefficients of


the polynomial w(t) = q(p(t)) that is obtained by substituting the polynomial u = p(t)
into the polynomial q(u). If p(t) and q(u) are of degree m and n, respectively
X
m X
n
p(t) = pj bjm (t) and q(u) = qk bkn (u),
j =0 k=0

then w(t) is evidently of degree mn,


X
mn
w(t) = q(p(t)) = wi bimn (t).
i=0

We assume here that n > 0 since, if q(u) is simply a constant, w(t) = q(p(t)) obviously
has the same constant value. The product algorithm of DeRose (1988) offers an elegant
means of computing the Bernstein coefficients w0 , . . . , wmn of the composite polynomial.
This algorithm populates a tetrahedral array of numbers h(s) i,j as follows. The first level,
s = 0, is defined by
(0)
hi,0 = qi for i = 0, . . . , n.
Then the entries in successive levels, s = 1, . . . , n, are computed recursively according to
the formula
  X
min(j,ms−m)   
ms (s) ms − m m  (s−1) (s−1) 
hi,j = (1 − pj −k )hi,k + pj −k hi+1,k
j k j −k
k=max(0,j −m)

for i = 0, . . . , n − s and j = 0, . . . , ms. Once the array is fully populated, the last level,
s = n, contains the desired coefficients of w(t):
wj = h(n)
0,j for j = 0, . . . , mn.

A.2. Orthogonal polynomials with constrained end values

As an alternative to the Lagrange undetermined multiplier approach to least-squares


approximation under constrained end values (see Section 4), we sketch here how a system
of orthogonal polynomials can be constructed to automatically incorporate the desired end
values during the approximation process. 5
The Legendre polynomials are special instances of the Jacobi polynomials, which can
be shown (Szegö, 1975) to have the Bernstein representations
Xn n+r  n+s 

n
n+k k n−k n
Pn (x) =
(r,s)
(−1) bk (t) for n = 0, 1, . . . ,
k=0 k

5 We are grateful to an anonymous referee for suggesting this approach.


R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196 195

where x ∈ [−1, +1], t = 12 (x + 1) ∈ [0, 1], and r, s > −1. These polynomials are
orthogonal with respect to the weight function
w(r,s)(x) = (1 − x)r (1 + x)s
on x ∈ [−1, +1]. Consequently, for any positive integer α, the polynomials defined by
(2α,2α)
Pn,α (x) = (x − 1)α (x + 1)α Pn−2α (x) for n = 2α, 2α + 1, . . .
form an orthogonal basis, with respect to the weight w(x) = 1, for the space of polynomials
that have roots of multiplicity α at x = −1 and x = +1.
Then, if h(x) = 12 [(1 − x)f (−1) + (x + 1)f (+1)] is the linear interpolant to the end-
point values of f (x), it can be shown that the polynomial
X
n
Pn (x) = h(x) + ck Pk,1 (x),
k=2

where
Z+1
 
ck = f (x) − h(x) Pk,1 (x) dx
−1

is the best least-squares approximant to f (x) on x ∈ [−1, +1] that matches the end-point
values f (−1) and f (+1).

References

Davis, P.J. (1975), Interpolation and Approximation, Dover, New York (reprint).
DeRose, A.D. (1988), Composing Bézier simplexes, ACM Trans. Graphics 7, 198–221.
Farin, G. (1993), Curves and Surfaces for Computer Aided Geometric Design, 3rd edn., Academic
Press, Boston.
Farouki, R.T. (1992), Pythagorean-hodograph curves in practical use, in: R.E. Barnhill, ed.,
Geometry Processing for Design and Manufacturing SIAM, Philadelphia, 3–33.
Farouki, R.T. (1997), Optimal parameterizations, Computer Aided Geometric Design 14, 153–168.
Farouki, R.T. and Rajan, V.T. (1987), On the numerical condition of polynomials in Bernstein form,
Computer Aided Geometric Design 4, 191–216.
Farouki, R.T. and Rajan, V.T. (1988), Algorithms for polynomials in Bernstein form, Computer
Aided Geometric Design 5, 1–26.
Farouki, R.T. and Sakkalis, T. (1990), Pythagorean hodographs, IBM J. Res. Develop. 34, 736–752.
Farouki, R.T. and Sakkalis, T. (1991), Real rational curves are not “unit speed”, Computer Aided
Geometric Design 8, 151–157.
Goetgheluck, P. (1987), Computing binomial coefficients, Amer. Math. Monthly 94, 360–365.
Henrici, P. (1974), Applied and Computational Complex Analysis, Vol. 1, Wiley, New York.
Isaacson, E. and Keller, H.B. (1994), Analysis of Numerical Methods, Dover, New York (reprint).
Jüttler, B. (1997), A vegetarian approach to optimal parameterizations, Computer Aided Geometric
Design 14, 887–890.
Jüttler, B. (1998), The dual basis functions for the Bernstein polynomials, Adv. Comp. Math. 8,
345–352.
196 R.T Farouki / Computer Aided Geometric Design 17 (2000) 179–196

Lachance, M.A. (1988), Chebyshev economization for parametric surfaces, Computer Aided
Geometric Design 5, 195–208.
Lane, J.M. and Riesenfeld, R.F. (1981), Bounds on a polynomial, BIT 21, 112–117.
Ong, B.H. (1996), An extraction of almost arc length parameterization from parametric curves, Ann.
Numer. Math. 3, 305–316.
Sederberg, T.W., Anderson, D.C. and Goldman, R.N. (1984), Implicit representation of parametric
curves and surfaces, Comput. Vision Graphics Image Process. 28, 72–84.
Sederberg, T.W. and Parry, S.R. (1986), Comparison of three curve intersection algorithms,
Computer-Aided Design 18, 58–63.
Szegö, G. (1975), Orthogonal Polynomials, 4th edn., Amer. Math. Soc., Providence, RI.
Watkins, M.A. and Worsey, A.J. (1988), Degree reduction of Bézier curves, Computer-Aided Design
20, 398–405.

You might also like