Game Development Reference
In-Depth Information
Figure 1-1. Right-handed coordinate system
In three dimensions we will use the coordinate system shown in Figure 1-1 (b), where
rotations about the x-axis are positive from positive y to positive z , rotations about the
y-axis are positive from positive z to positive x , and rotations about the z-axis are positive
from positive x to positive y .
Vectors
Let us take you back for a moment to your high school math class and review the concept
of vectors . Essentially, a vector is a quantity that has both magnitude as well as direction.
Recall that a scalar , unlike a vector, has only magnitude and no direction. In mechanics,
quantities such as force, velocity, acceleration, and momentum are vectors, and you
must consider both their magnitude and direction. Quantities such as distance, density,
viscosity, and the like are scalars.
With regard to notation, we'll use boldface type to indicate a vector quantity, such as
force, F . When referring to the magnitude only of a vector quantity, we'll use standard
type. For example, the magnitude of the vector force, F , is F with components along the
coordinate axes, F x , F y , and F z . In the code samples throughout the topic, we'll use the
* (asterisk) to indicate vector dot product, or scalar product, operations depending on
the context, and we'll use the ^ (caret) to indicate vector cross product.
Because we will be using vectors throughout this topic, it is important that you refresh
your memory on the basic vector operations, such as vector addition, dot product, and
cross product, among others. For your convenience (so you don't have to drag out that
old math book), we've included a summary of the basic vector operations in Appen‐
dix A . This appendix provides code for a Vector class that contains all the important
vector math functionality. Further, we explain how to use specific vector operations—
such as the dot-product and cross-product operations—to perform some common and
 
Search Nedrilad ::




Custom Search