Game Development Reference
In-Depth Information
The cross product is written as follows:
Figure 3.8
Cross product (a), and right-hand rule (b).
An important thing to note is that there is technically a second vector that is per-
pendicular to the plane: the vector that points in the opposite direction of . So
how do you know which direction the cross product result should face? The an-
swer is tied into what is known as the
handedness
of the coordinate system. In
a right-handed system, you take your right hand and create a 90° angle between
your thumb and index finger. You likewise make a 90° angle between your index
finger and your middle finger. You then line up your index finger with and your
middle finger with . The direction your thumb points in is the direction the cross
product will face.
Figure 3.8(b)
shows an application of the
right-hand rule
.
You may have noticed that if you switch it so your index finger lines up with
and your middle finger with , your thumb points in the opposite direction. This
is because the cross product is not commutative, but in fact
anti
-commutative:
It is important to remember that
not all games use a right-handed coordinate sys-
tem
. We will describe coordinate systems in greater detail later, but for now let's
assume a right-handed coordinate system.