Graphics Reference
In-Depth Information
r
·
s = ad ( i
k )+
bd ( j · i )+ be ( j · j )+ bf ( j · k )+
cd ( k · i )+ ce ( k · j )+ cf ( k · k )
·
i )+ ae ( i
·
j )+ af ( i
·
(6.21)
Before we proceed any further, we can see that we have created various dot
product terms such as ( i · i ), ( j · j ), ( k · k ), etc. These terms can be di-
vided into two groups: those that involve the same unit vector, and those that
reference different unit vectors.
Using the definition of the dot product, terms such as ( i · i ), ( j · j )and
( k · k ) = 1, because the angle between i and i , j and j ,or k and k is 0 ;and
cos(0 ) = 1. But because the other vector combinations are separated by 90 ,
and cos(90 ) = 0, all remaining terms collapse to zero. Bearing in mind that
the magnitude of a unit vector is 1, we can write
||
s
|| · ||
r
||
cos( β )= ad + be + cf
(6.22)
This result confirms that the dot product is indeed a scalar quantity. Now
let's see how it works in practice.
6.2.9 Example of the Dot Product
To find the angle between two vectors r and s ,
2
5
6
10
r =
3
4
and
s =
= 2 2 +(
|| r ||
3) 2 +4 2 =5 . 385
= 5 2 +6 2 +10 2 =12 . 689
|| s ||
Therefore
||
s
|| · ||
r
||
cos( β )=2
×
5+(
3)
×
6+4
×
10 = 32
12 . 689
×
5 . 385
×
cos( β )=32
32
12 . 689
cos( β )=
=0 . 468
×
5 . 385
β =cos 1 (0 . 468) = 62 . 1
The angle between the two vectors is 62 . 1 .
It is worth pointing out at this stage that the angle returned by the dot
product ranges between 0 and 180 . This is because, as the angle between
two vectors increases beyond 180 , the returned angle β is always the smallest
angle associated with the geometry.
 
Search WWH ::




Custom Search