Game Development Reference
In-Depth Information
The naıve approach to this problem is to apply the standard linear
interpolation formula (“lerp”) to each of the three angles independently:
Simple linear
interpolation between
two angles
∆θ = θ 1 − θ 0 ,
θ t = θ 0 + t∆θ.
This is fraught with problems.
First, if canonical Euler angles are not used, we may have large angle
values. For example, imagine the heading of R 0 , denoted h 0 , is 720 o .
Assume h 1 = 45 o . Now, 720 o = 2 × 360 o , which is the same as 0 o , so
basically the h 1 and h 2 are only 45 o apart. However, naıve interpolation
will spin around nearly twice in the wrong direction, as shown in Figure 8.9.
Of course, the solution to this problem is to use canonical Euler angles.
We could assume that we will always be interpolating between two sets of
canonical Euler angles. Or we could attempt to enforce this by converting
to canonical values inside our interpolation routine. (Simply wrapping an-
gles within the (−180 o ,+180 o ] range is easy, but dealing with pitch values
outside the [−90 o ,+90 o ] range is more challenging.)
However, even using canonical angles doesn't completely solve the prob-
lem. A second type of interpolation problem can occur because of the cyclic
nature of rotation angles. Suppose h 0 = −170 o and h 1 = 170 o . Notice that
these are canonical values for heading, both in the range (−180 o ,+180 o ].
+90°
90°
+270°
270°
Figure 8.10
Naıve interpolation
can rotate the long way
around.
R 1 =170°
R 0 =170°
±180°
 
Search WWH ::




Custom Search