Graphics Reference
In-Depth Information
B.2.3 Dot product of two vectors
The dot product ,or inner product , of two vectors is computed as in Equation B.19 . The computation is
commutative ( Eq. B.20 ) and associative ( Eq. B.21 ) . The dot product of a vector with itself results in the
square of its length ( Eq. B.22 ). The dot product of two vectors, A and B , is equal to the lengths of the
vectors times the cosine of the angle between them ( Eq. B.23 , Figure B.5 ) . As a result, the angle
between two vectors can be determined by taking the arccosine of the dot product of the two normalized
vectors (or, if they are not normalized, by taking the arccosine of the dot product divided by the lengths
of the two vectors). The dot product of two vectors is equal to zero if the vectors are perpendicular to
each other, as in Figure B.6 (or if one or both of the vectors are zero vectors). The dot product can also
be used to compute the projection of one vector onto another vector ( Figure B.7 ). This is useful in cases
in which the coordinates of a vector are needed in an auxiliary coordinate system ( Figure B.8 ).
A B ¼ A x B x þ A y B y þ A z B z
(B.19)
A B ¼ B A
(B.20)
ð
A B
Þ C ¼ A B C
ð
Þ
(B.21)
2
A A ¼jAj
(B.22)
A B ¼jAjjBjcosy
(B.23)
A
A ￿ B
cos
A
B
B
FIGURE B.5
Using the dot product to compute the cosine of the angle between two vectors.
y
B
A ￿ B
0
A
x
z
FIGURE B.6
The dot product of perpendicular vectors.
 
Search WWH ::




Custom Search