Game Development Reference
In-Depth Information
Let's summarize the dot product's geometric properties.
The dot product a b measures the length of the projection of b onto
a , multiplied by the length of a .
The dot product can be used to measure displacement in a particular
direction.
The projection operation is closely related to the cosine function. The
dot product a b also is equal to a b cosθ, where θ is the angle
between the vectors.
We review the commutative and distributive properties of the dot prod-
uct at the end of this chapter along with other algebraic properties of vector
operations.
2.12
Vector Cross Product
The other vector product, known as the cross product, can be applied only
in 3D. Unlike the dot product, which yields a scalar and is commutative,
the vector cross product yields a 3D vector and is not commutative.
2.12.1 Official Linear Algebra Rules
Similar to the dot product, the term “cross” product comes from the symbol
used in the notation a × b . We always write the cross symbol, rather than
omitting it as we do with scalar multiplication. The equation for the cross
product is
2
3
2
3
2
3
x 1
y 1
z 1
x 2
y 2
z 2
y 1 z 2 − z 1 y 2
z 1 x 2 − x 1 z 2
x 1 y 2 − y 1 x 2
4
5
4
5
4
5
×
=
.
Cross product
For example,
2
4
3
5
2
4
3
5
2
4
3
5
2
4
3
5
2
4
3
5
1
3
4
−5
8
(3)(8) − (4)(−5)
(4)(2) − (1)(8)
(1)(−5) − (3)(2)
24 − (−20)
8 − 8
−5 − 6
44
−11
×
=
=
=
.
The cross product enjoys the same level of operator precedence as the
dot product: multiplication occurs before addition and subtraction. When
dot product and cross product are used together, the cross product takes
precedence: a
c ). Luckily, there's an easy way to remember
this: it's the only way it could work. The dot product returns a scalar,
and so ( a b ) × c is undefined, since you cannot take the cross product of a
b
×
c = a
( b
×
 
Search WWH ::




Custom Search