116 Chapter 7 Polynomial Curve Constructions
and finally
P4=gAp3 + P3.
Then compute P5 in the same manner, and so on. The general formula is, with
qj = g^A^Py:
q; = q;:^l + q;_i; / = 2,1,0. (7.31)
It yields the points py = q^^.^
This way of computing the py does not involve a single multiplication after
the startup phase! It is therefore extremely fast and has been implemented in
many graphics systems. Given four initial points po, pi, p2,
P3
and a stepsize
/?,
it
generates a sequence of points on the cubic polynomial through the initial four
points. Typically, the polynomial will be given in Bezier form, so those four points
have to be computed as a startup operation.
In a graphics environment, it is desirable to adjust the stepsize h such that
each pixel along the curve is hit. One way of doing this is to adjust the stepsize
while marching along the curve. This is called adaptive forward differencing and
is described by Lien, Shantz, and Pratt [389] and by Chang, Shantz, and Rochetti
[109].
Although fast, forward differencing is not
foolproof.
As we compute more
and more points on the curve, they begin to be affected by
roundoff.
So while we
intend to march along our curve, we may instead leave its path, deviating from it
more and more as we continue. For more literature on this method, see Abi-Ezzi
[1],
Bartels, Beatty, and Barsky [47], or Shantz and Chang
[571].
7.12 Implementation
The code for Aitken's algorithm is very similar to that for the de Casteljau
algorithm. Here is its header:
float aitken(degree,coeff,t)
/* uses Aitken to compute one coordinate
value of a Lagrange interpolating polynomial. Has to be called
for each coordinate (x,y, and/or z) of data points.
Input: degree: degree of curve.
8 It holds for any degree n if we replace / = 2,1,0 by / = «
—
1,
w —
2,...,
0.