Game Development Reference
In-Depth Information
Clockwise turn
Counterclockwise turn
In a left-handed coordinate sys-
tem, a × b (not shown) points
towards you. In a right-handed
coordinate system, a
In a left-handed coordinate sys-
tem, a × b (not shown) points
away from you. In a right-handed
coordinate system, a
×
b points
×
b points
away from you.
towards you.
Figure 2.30. Determining clockwise versus counterclockwise turns
head of a with the tail of b . Compare this to Figure 2.26, where the tails
are touching. The tail-to-tail alignment shown in Figure 2.26 is the correct
way to position the vectors to measure the angle between them, but to
judge whether the turn is clockwise or counterclockwise, the vectors should
be aligned head-to-tail, as shown in Figure 2.30.
Let's apply this general rule to the specific case of the cardinal axes. Let
x , y , and z be unit vectors that point in the +x, +y, and +z directions,
respectively. The results of taking the cross product of each pair of axes are
x
× y = z ,
y
× x = − z ,
y × z = x ,
z × y = − x ,
Cross product of the
cardinal axes
z × x = y ,
x × z = − y .
You can also remember which way the cross product points by using
your hand, similar to the way we distinguished between left-handed and
right-handed coordinate spaces in Section 1.3.3. Since we're using a left-
handed coordinate space in this topic, we'll show how it's done using your
left hand. Let's say you have two vectors, a and b , and you want to figure
out which direction a × b points. Point your thumb in the direction of a ,
and your index finger (approximately) in the direction of b . If a and b are
pointing in nearly the opposite direction, this may be di cult. Just make
sure that if your thumb points exactly in the direction of a ; then your index
finger is on the same side of a as the vector b is. With your fingers in this
position, extend your third finger to be perpendicular to your thumb and
 
Search WWH ::




Custom Search