Game Development Reference
In-Depth Information
Figure 2.22
The dot product distributes over
addition.
of the original vector. In other words, taking the dot product of a vector
with a cardinal axis “sifts” out the coordinate for that axis.
If we combine this “sifting” property of the dot product with the fact
that it distributes over addition, which we have been able to show in purely
geometric terms, we can see why the formula has to be what it is.
Because the dot product mea-
sures the length of a projection,
it has an interesting relationship
to the vector magnitude calcula-
tion. Remember that the vector
magnitude is a scalar measuring
the amount of displacement (the
length) of the vector. The dot
product also measures the amount
of displacement, but only the dis-
placement in a particular direc-
tion is counted; perpendicular dis-
placement is discarded by the pro-
jecting process. But what if we
measure the displacement in the
same direction that the vector is
pointing? In this case, all of the
vector's displacement is in the di-
rection being measured, so if we project a vector onto itself, the length of
that projection is simply the magnitude of the vector. But remember that
a b is equal to the length of the projection of b onto a , scaled by a . If
we dot a vector with itself, such as v v , we get the length of the projection,
which is v , times the length of the vector we are projecting onto, which
is also v . In other words,
Figure 2.23
Taking the dot product with a cardinal axis sifts
out the corresponding coordinate.
Relationship between
vector magnitude and
the dot product
v v = v 2 ,
v =
v v .
 
Search WWH ::




Custom Search