Game Development Reference
In-Depth Information
We've seen one trivial type of aliasing before with polar coordinates:
adding a multiple of 360 o does not change the orientation expressed, even
though the numbers are different.
A second and more troublesome form of aliasing occurs because the
three angles are not completely independent of each other. For example,
pitching down 135 o is the same as heading 180 o , pitching down 45 o , and
then banking 180 o .
To deal with aliasing of spherical coordinates, we found it useful to
establish a canonical set; any given point has a unique representation in
the canonical set that is the “o cial” way to describe that point using
polar coordinates. We use a similar technique for Euler angles. In order
to guarantee a unique Euler angle representation for any given orientation,
we restrict the ranges of the angles. One common technique is to limit
heading and bank to (−180 o ,+180 o ] and to limit pitch to [−90 o ,+90 o ].
For any orientation, there is only one Euler angle triple in the canonical
set that represents that orientation. (Actually, there is one more irritating
singularity that must be handled, which we describe in just a moment.)
Using canonical Euler angles simplifies many basic tests such as “am I
facing approximately east?”
The most famous (and irritating) type of aliasing problem suffered by
Euler angles is illustrated by this example: if we head right 45 o and then
pitch down 90 o , this is the same as pitching down 90 o and then banking 45 o .
In fact, once we chose ±90 o as the pitch angle, we are restricted to rotating
about the vertical axis. This phenomenon, in which an angle of ±90 o for
the second rotation can cause the first and third rotations to rotate about
the same axis, is known as Gimbal lock. To remove this aliasing from the
canonical set of Euler angle triples, we assign all rotation about the vertical
axis to heading in the Gimbal lock case. In other words, in the canonical
set, if pitch is ±90 o , then bank is zero.
This last rule for Gimbal lock completes the rules for the canonical set
of Euler angles:
−180 o < h ≤ 180 o
−90 o ≤ p ≤ 90 o
−180 o < b ≤ 180 o
p = ±90 o
Conditions satisfied by
Euler angles in the
canonical set
b = 0.
When writing C++ that accepts Euler angle arguments, it's usually
best to ensure that they work given Euler angles in any range. Luckily
this is usually easy; things frequently just work without taking any extra
precaution, especially if the angles are fed into trig functions. However,
when writing code that computes or returns Euler angles, it's good practice
Search WWH ::




Custom Search