Game Development Reference
In-Depth Information
We're considering curves where p (t) is a polynomial of t here, so the
derivatives are trivially obtained. The position, velocity, and acceleration
functions for polynomials of arbitrary degree n are
p (t) = c 0 + c 1 t + c 2 t 2 + + c n−1 t n−1 + c n t n ,
v (t) = p (t) = c 1 + 2 c 2 t + + (n − 1) c n−1 t n−2 + n c n t n−1 ,
a (t) = v (t) = p (t) = 2 c 2 + + (n − 1)(n − 2) c n−1 t n−3 + n(n − 1) c n t n−2 .
Velocity and acceleration
are the first and second
derivatives, remember?
The derivatives of cubic curves are especially notable and appear several
times in this chapter.
Velocity and Acceleration of Cubic Monomial Curve
p (t) = c 0 + c 1 t + c 2 t 2 + c 3 t 3 ,
(13.4)
v (t) = p (t) = c 1 + 2 c 2 t + 3 c 3 t 2 ,
(13.5)
a (t) = v (t) = p (t) = 2 c 2 + 6 c 3 t.
(13.6)
Now let's examine velocity and acceleration in the special case of a
parametric ray. Applying the velocity and acceleration functions of Equa-
tions (13.5) and (13.6) to the original parameterization of a ray from Equa-
tion (13.3) yields
p (t) = p 0 + d t,
v (t) = c 1 + 2 c 2 t + 3 c 3 t 2 = d ,
a (t) = 2 c 2 + 6 c 3 t = 0 .
Velocity and acceleration
of a ray
As we'd expect, the velocity is constant; there is no acceleration.
Sometimes two curves define the same shape but different paths (see
Figure 13.1 ). We've already mentioned one example of this: if we traverse
the path backwards it still traces out the same shape. A more general way to
generate alternate paths that trace out the same shape is to reparameterize
the curve. For example, let's reparameterize our line segment p (t) = p 0 +
d t. We'll make a new function s(t) = t 2 and see what p (s(t)) looks like:
p (s(t)) = p (t 2 ) = p 0 + d t 2 .
Notice that both curves in Figure 13.1 define the same static shape, but
different paths. On the left, the particle moves with constant velocity, but
on the right it starts out slowly and accelerates to the finish.
Search WWH ::




Custom Search