Game Development Reference
In-Depth Information
threshold simply by using more sample points. We can do much better
than this naıve approach by adaptively subdividing the curve, using more
segments in the “curvier” parts and fewer in the “straighter” parts.
But where do the coe cients c 0 , c 1 , c 2 , c 3 come from? How can we
set them to design a particular curve? In general, the monomial form
is particularly ill-suited to this task, so we use other forms and convert
to monomial form when appropriate. (In many cases, we don't need the
monomial form at all!) Before we discuss these other forms, however, we
need to introduce some more notation and concepts about curves.
13.1.3 Matrix Notation
We can rewrite the monomial form (Equation (13.2)) in several different
ways. It's useful to be able to refer to a coe cient for a particular coordi-
nate. For example, in 2D let's use the notation c i =
c 1,i c 2,i
so we have
one polynomial per coordinate:
x(t) = c 1,0 + c 1,1 t + c 1,2 t 2 + c 1,3 t 3 ,
y(t) = c 2,0 + c 2,1 t + c 2,2 t 2 + c 2,3 t 3 .
Some topics are fond of writing this more compactly by using matrix nota-
tion. Let's put the coe cients into a matrix C and create a column vector
t from the powers of t, such that t i = t i−1 :
2D cubic curve in
expanded monomial form
2
4 t 0
3
2
4 1
3
5
5
t 1
t 2
t 3
c 1,0 c 1,1 c 1,2 c 1,3
c 2,0 c 2,1 c 2,2 c 2,3
t
t 2
t 3
C =
,
t =
=
.
Now we can express our curve function p (t) as a single matrix product:
2
4 1
3
5
2D cubic curve in
monomial form,
expressed as a matrix
product
c 1,0 c 1,1 c 1,2 c 1,3
c 2,0 c 2,1 c 2,2 c 2,3
t
t 2
t 3
p (t) = Ct =
.
Don't try to apply any geometric interpretations just yet. The vector t is
not to be interpreted as a point in space, and the matrix C is not a trans-
formation matrix. Although we're about to learn how to extract geometric
meaning from C , the techniques are very different from those learned in
previous chapters. For now, let's just be happy to use matrix notation
purely for sake of compactness.
 
Search WWH ::




Custom Search