Game Development Reference
In-Depth Information
F IGURE 2.7
Geometric interpretation of the vector product.
In practice the non-commutative nature of the vector product means that we need
to ensure that the orders of arguments are correct in equations. This is a common
error and can manifest itself in the game by objects being sucked into each other with
ever increasing velocity or bobbing in and out of surfaces at an ever faster rate.
The Geometry of the Vector Product
Once again using the scalar product as an example, we can interpret the magnitude of
the vector product of a vector and a normalized vector. For a pair of vectors,
a and b ,
the magnitude of the vector product represents the component of b that is not in
the direction of
a . Again, having a vector a that is not normalized simply gives us a
magnitude that is scaled by the length of a . This can be used in some circumstances,
but in practice it is a relatively minor result.
Because it is easier to calculate the scalar product than the vector product, if we
need to know the component of a vector not in the direction of another vector, we
are better off performing the scalar product and then using Pythagoras's theorem to
give the result
1
c
=
s 2
where c is the component of b not in the direction of
a and s is the scalar product
b .
In fact the vector product is very important geometrically, not for its magnitude
but for its direction. In three dimensions the vector product will point in a direction
that is at right angles (i.e., 90 , also called “orthogonal”) to both of its operands. This
is illustrated in figure 2.7. There are several occasions in this topic where it will be
convenient to generate a unit vector that is at right angles to other vectors. We can
accomplish this easily using the vector product:
a
·
= a
r
×
b