Game Development Reference
In-Depth Information
13.9.3 Endpoint Conditions
The Catmull-Rom methods rely on the previous and next knots to compute
the tangent at a given knot. What should we do at an endpoint when there
is no “previous” or “next” knot? Several solutions to this problem have
been proposed.
One obvious answer would be to just throw our hands in the air and
set the tangent to zero at an endpoint. While this seems like surrendering
before the first shot is fired, it actually can be a good choice if the spline is
to be used for animation, since it's often natural to want the object being
animated to start and end “at rest.”
Another idea is to create extra knots k −1 and k n+1 , which are used
for tangent computations but are not interpolated. Where should we place
these so-called phantom points? One idea is to duplicate the neighboring
endpoint, which produces zero tangents and is equivalent to the “surrender”
spline of the previous paragraph. Another idea is simply to ask the user to
place the phantom point. When this method is used, the spline is known
as a Cardinal spline.
One final method is to fit the first (or last) three knots to a quadratic,
and use the endpoint tangent of this curve. The curve fitting is an example
of polynomial interpolation and can thus be done by using the techniques
from earlier in this chapter, such as Aitken's algorithm.
13.10
Exercises
(Answers on page 792.)
1. Compute the Lagrange basis polynomials for the knot sequence t 1 = 0,
t 2 = 1, t 3 = 2.
2. The motion of a projectile (see Section 11.6) can be described by the
quadratic function
p(t) = p 0 + tv 0 + t 2 (a/2),
where p 0 is the initial position, v 0 is the initial velocity, and a is the
constant acceleration (typically due to gravity).
Imagine you want to animate the path of a projectile—say, a herring sand-
wich. Assume you are working in our standard 3D coordinate space (see
Section 1.3.4) and the object is launched from the origin, reaches a max-
imum at t = 1 when its position is p(1) = (0, h, d/2), and finally lands
at t = 2 at the position p(2) = (0, 0, d). Derive an expression for p(t) in
monomial form, in terms of the variables h and d.
 
Search WWH ::




Custom Search