Game Development Reference
In-Depth Information
defines the position of an object by a distance r from an origin and two angles q and j as shown
in Figure 2-2.
Figure 2-2. The spherical coordinate system
The spherical coordinate system is useful for describing circular or rotational motion.
There will be times in your game programming when the spherical coordinate will prove easier
to use and more appropriate than the Cartesian coordinate system. You would use spherical
coordinates, for instance, if you were modeling a satellite in orbit around a planet.
A coordinate system provides a way to locate the position of an object in space. If required, the
coordinates in one coordinate system can be converted into another. For example, the coordi-
nates of an object in spherical ( r , j , q ) coordinates can be converted into Cartesian ( x , y , z )
coordinates using the following equations.
x rjq
=
sin
cos
(2.7a)
y rjq
=
sin
sin
(2.7b)
z rj
=
cos
(2.7c)
There is one other distinction about coordinate systems and frames of reference we need
to consider: every coordinate system (and therefore frame of reference) has an origin. The location
of the origin is arbitrary. It can be at a fixed point in space, or it can move with the object. If a
frame of reference is at rest or moves with a uniform velocity, it is known as an inertial frame
of reference. If the frame of reference is accelerating, it is known as a noninertial frame of reference.
Most of the time in this topic, we will be dealing with models that use an inertial frame of
reference whereby the origin is at a fixed point in space. In some instances, such as when we
are looking at the rotational motion of an object such as the spin of a golf ball in flight, it is more
advantageous to use a frame of reference that moves with the object.
Scalars and Vectors
Two types of quantities will go into the mathematical equations we will develop in this topic.
Scalar quantities are those that have a magnitude only. An example of a scalar quantity would
be the mass of an object. No matter which way you look at the object, it will have the same
mass. A vector quantity, on the other hand, has both a magnitude and a direction. An example
of a vector quantity would be the velocity of an object. If a baseball player throws a baseball
into the air and we want to calculate where it will go, it's not enough to know how fast the base-
ball is traveling. We would also need to know the direction that the baseball was thrown.
A vector is a way to describe the magnitude and direction of something in two- or three-
dimensional space. It is often useful to separate a vector quantity into components that act in
Search WWH ::




Custom Search