Game Development Reference

In-Depth Information

But the results of this crude method will be very jerky. This is because

the curve joining the points is not smooth. The technical description of this

is that it lacks G1 and C1 continuity. A curve has G0 continuity if it is

connected at the key positions,
K
n
, and has G1 continuity if the tangent at

this point for both the segment
K
n
-1

K
n
+1
is in

the same direction but not necessarily of the same magnitude. For a curve

to have C1 continuity, the tangents must be in the same direction and of

the same magnitude. For the curve we are considering, we have a value

changing against time. If you are familiar with calculus then you will know

that differentiating a curve gives a new curve that represents the way the

slope of the original curve changes with time. For a smooth curve we need

C1 continuity as it bends through the key positions. There are many

possible contenders for such a curve. The standard technique is to use a

different curve between each pair of key positions. To ensure that the

curve is smooth through the key positions, we need to consider the slope

or tangent to the curve for the end of one segment and the beginning of

the next. The slopes must be in the same direction and of the same

magnitude to ensure a smooth transition. Figure 8.3 shows the result of

using piecewise cubic curves with and without the matching of tangents

for the curve leading up to the key position and the curve following the key

position.

That's all well and good, but how do we define a cubic that is

guaranteed to go through the key positions. The problem comes down to

a familiar problem for computer graphics generally, one of curve fitting.

Some curve-fitting options do not go through the actual key positions so

would not be suitable. A curve that is guaranteed to go through the key

→

K
n
and segment
K
n

→

Figure 8.3 Key position tangents for piecewise cubic curves.

Search Nedrilad ::

Custom Search