Game Engine Architecture

(Ben Green) #1
149

Direction of the Cross Product


When using a right-handed coordinate system, you can use the right-hand rule
to determine the direction of the cross product. Simply cup your fi ngers such
that they point in the direction you’d rotate vector a to move it on top of vector
b, and the cross product (a × b) will be in the direction of your thumb.
Note that the cross product is defi ned by the left -hand rule when using
a left -handed coordinate system. This means that the direction of the cross
product changes depending on the choice of coordinate system. This might
seem odd at fi rst, but remember that the handedness of a coordinate system
does not aff ect the mathematical calculations we carry out—it only changes
our visualization of what the numbers look like in 3D space. When converting
from a RH system to a LH system or vice-versa, the numerical representations
of all the points and vectors stay the same, but one axis fl ips. Our visualization
of everything is therefore mirrored along that fl ipped axis. So if a cross prod-
uct just happens to align with the axis we’re fl ipping (e.g., the z-axis), it needs
to fl ip when the axis fl ips. If it didn’t, the mathematical defi nition of the cross
product itself would have to be changed so that the z-coordinate of the cross
product comes out negative in the new coordinate system. I wouldn’t lose too
much sleep over all of this. Just remember: when visualizing a cross product,
use the right-hand rule in a right-handed coordinate system and the left -hand
rule in a left -handed coordinate system.


Properties of the Cross Product


The cross product is not commutative (i.e., order matt ers):


a × b ≠ b × a.


However, it is anti-commutative :


a × b = – b × a.


The cross product is distributive over addition:


a × (b + c) = (a × b) + (a × c).


And it combines with scalar multiplication as follows:


(sa) × b = a × (sb) = s(a × b).


The Cartesian basis vectors are related by cross products as follows:

(^)
() () ,
()(),
()().
× =− × =
× =− × =
× =− × =
jk k j i
ki ik j
i jji k
4.2. Points and Vectors

Free download pdf