Game Development Reference
In-Depth Information
Perhaps the reason for our a nity for polar coordinates is that each
polar coordinate has concrete meaning all by itself. One fighter pilot may
say to another “Bogey, six o'clock!” 8 In the midst of a dogfight, these brave
fighter pilots are actually using polar coordinates. “Six o'clock” means
“behind you” and is basically the angle θ that we've been studying. Notice
that the pilot didn't need to specify a distance, presumably because the
other pilot could turn around and see for himself faster than the other pilot
could tell him. So one polar coordinate (in this case, a direction) is useful
information by itself. The same types of examples can be made for the other
polar coordinate, distance (r). Contrast that with the usefulness of a lone
Cartesian coordinate. Imagine a fighter pilot saying, “Bogey, x = 1000 ft!”
This information is more di cult to process, and isn't as useful.
In video games, one of the most common times that polar coordinates
arise is when we want to aim a camera, weapon, or something else at some
target. This problem is easily handled by using a Cartesian-to-polar coor-
dinate conversion, since it's usually the angles we need. Even when angular
data can be avoided for such purposes (we might be able to completely
use vector operations, for example, if the orientation of the object is spec-
ified using a matrix), polar coordinates are still useful. Usually, cameras
and turrets and assassins' arms cannot move instantaneously (no matter
how good the assassin), but targets do move. In this situation, we usually
“chase” the target in some manner. This chasing (whatever type of control
system is used, whether a simple velocity limiter, a lag, or a second-order
system) is usually best done in polar space, rather than, say, interpolating
a target position in 3D space.
Polar coordinates are also often encountered with physical data acqui-
sition systems that provide basic raw measurements in terms of distance
and direction.
One final occasion worth mentioning when polar coordinates are more
natural to use than Cartesian coordinates is moving around on the sur-
face of a sphere. When would anybody do that? You're probably doing
it right now. The latitude/longitude coordinates used to precisely describe
geographic locations are really not Cartesian coordinates, they are polar
coordinates. (To be more precise, they are a type of 3D polar coordinates
known as spherical coordinates, which we'll discuss in Section 7.3.2.) Of
course, if you are looking at a relatively small area compared to the size of
the planet and you're not too far away from the equator, you can use lat-
itude and longitude as Cartesian coordinates without too many problems.
We do it all the time in Dallas.
8 The authors have never actually heard anything like this first-hand. However, they
have seen it in movies.
Search WWH ::




Custom Search