Game Development Reference
In-Depth Information
more “wiggles.” However, sometimes extra “wiggles” come in that we don't
want; 1 more on this in Section 13.6.
We've already seen an example of a curve function that is parametric
but not polynomial—the parametric circle given by Equation (13.1). The
expressions for x(t) and y(t) are not polynomials because they use trig func-
tions. A complete circle can't be described in parametric polynomial form,
although a circular arc can be described by a rational curve. A rational
curve is essentially the result of dividing one curve by another, sort of like
the projective geometry of homogeneous coordinates (see Section 6.4.1).
The curve in the denominator is a 1D curve. Rational curves are not as
common in video games as simple polynomial curves and are not discussed
in this topic.
Of most interest to us are the parametric polynomial curves of degree 3,
known as cubic curves. Cubic curves are those that can be expressed in the
form shown in Equation (13.2).
Cubic Curve in Monomial Form
p (t) = c 0 + c 1 t + c 2 t 2 + c 3 t 3 .
(13.2)
This method of describing curves is often called the monomial form or the
power form, to emphasize the fact that the curve is specified by listing the
coe cients of the powers of t. Sections 13.2-13.4 discuss other methods of
describing a curve with more direct geometric data, such as a list of control
points that the curve is to pass through or nearby. These other forms are
still polynomial curves in the sense that they can be converted to monomial
form.
Once we have the coe cients, it's easy to reconstruct the curve by
evaluating the function p (t) for different values of t. For example, let's say
we wish to move a platform along a path in a video game. Our platform
actor would have a state variable to remember its parametric position t
along the path, and at each simulation time step, we would update t and
set the position of the platform to p (t).
Suppose we need to render a curve. One simple way to do this is to
approximate it with, say, 10 line segments, sampling the curve at t =
0, 10 , 10 ,..., 10 ,1 and drawing line segments between consecutive sample
points.
We can reduce the error in the approximation to any desired
1 This is not intended as a comment on a certain Australian children's musical group,
but may be misinterpreted as such.
Search WWH ::




Custom Search