Game Development Reference
In-Depth Information
conversion from Bezier form to monomial basis can be written with fewer
letters by using the matrix form introduced earlier in this chapter. After
putting the control points b 0 , b 1 , b 2 as columns into a matrix B , we can
write
2
4 | | |
3
2
3
2
3
1
−2
1
1
t
t 2
Quadratic Bezier curve
using matrix notation
5
4
5
4
5
p (t) = Ct = BMt =
b 0 b 1 b 2
|
0
2
−2
.
(13.18)
|
|
0
0
1
As we saw in Section 13.3 with Hermite curves, the two different ways to
group the product BMt lead to two different interpretations. If we perform
the multiplication BM first, we get the matrix of monomial coe cients C ,
meaning M is a conversion matrix from Bezier form to monomial form.
Direct evaluation of the monomial form is faster than implementing the
de Casteljau algorithm, and so this form might be preferable in situations
where we need to evaluate the same curve for many different values of t,
for example, when moving an object over time along a path described by a
Bezier curve. (However, one must be aware of issues related to precision.
For example, we can ensure that performing de Casteljau using t = 1.0
produces a result that matches the last control point exactly. However,
substituting t = 1.0 into the polynomial in monomial form, the coe cients
might not sum exactly to this value due to floating point representation.)
The other way to group the product BMt is to perform the right-
hand multiplication first: B ( Mt ). When we plug in a specific value of t,
the product Mt yields a column vector of barycentric coordinates. If we
perform this multiplication leaving t as a variable, we get a column vector
of polynomials that can be interpreted as a basis. The basis polynomials
for Bezier curves are the Bernstein basis, discussed in Section 13.4.2.
Back to repeated interpolation. One last round gives us the cubic poly-
nomial:
b i (t) = (1 − t)[ b i (t)] + t[ b i+1 (t)]
= (1 − t)[ b i + t(2 b i+1 − 2 b i ) + t 2 ( b i − 2 b i+1 + b i+2 )]
+ t[ b i+1 + t(2 b i+2
One last iteration of
de Casteljau iteration
yields the cubic
polynomial.
− 2 b i+1 ) + t 2 ( b i+1
− 2 b i+2 + b i+3 )]
− 2 b i ) + t 2 ( b i
= [ b i + t(2 b i+1
− 2 b i+1 + b i+2 )]
Whew, expanding it all
out like this is pretty
exhausting!
− 2 b i ) + t 2 ( b i
− 2 b i+1 + b i+2 )]
+ t[ b i+1 + t(2 b i+2 − 2 b i+1 ) + t 2 ( b i+1 − 2 b i+2 + b i+3 )]
= b i + t(2 b i+1 − 2 b i ) + t 2 ( b i − 2 b i+1 + b i+2 )
− t b i
− t[ b i + t(2 b i+1
− t 2 (2 b i+1
− 2 b i ) − t 3 ( b i
− 2 b i+1 + b i+2 )
+ t b i+1 + t 2 (2 b i+2
− 2 b i+1 ) + t 3 ( b i+1
− 2 b i+2 + b i+3 )
Search WWH ::




Custom Search