Graphics Programs Reference
In-Depth Information
A
Vector Products
It is trivial to add and subtract vectors, but vectors can also be multiplied. This short
appendix is a reminder of (or a refresher on) the two important operations of dot product
and cross product.
The dot product (or inner product) of two vectors is denoted by P Q and is defined
as the scalar
( P x ,P y ,P z )( Q x ,Q y ,Q z ) T
= PQ T
= P x Q x + P y Q y + P z Q z .
This simple definition implies that the dot product is commutative, P Q = Q P ,
and is also distributive with respect to vector addition or subtraction, P
( Q ± T )=
P Q ± P T .
The dot product also has a simple and useful geometric interpretation; it equals
| P || Q |
cos θ ,where θ is the angle between the vectors. The dot product of perpendicular
(or orthogonal ) vectors is therefore zero. We use Figure A.1 to prove this interpretation.
Part a shows a triangle with three sides a , b ,and c and three angles A , B ,and C opposite
those sides. We draw a line from vertex B that is perpendicular to side b . This line
divides the triangle into two right-angle triangles. The three sides of the triangle on the
right are a , a sin C ,and a cos C , while the sides of the triangle on the left are c , a sin C ,
and b
a cos C . Applying Pythagoras's theorem to the latter triangle yields the law of
cosines
c 2 =( a sin C ) 2 +( b
a cos C ) 2
= a 2 sin 2 C + b 2
2 ab cos C + a 2 cos 2 C
= a 2 (sin 2 C +cos 2 C )+ b 2
2 ab cos C
= a 2 + b 2
2 ab cos C.
This extends the Pythagorean theorem to arbitrary triangles.
Given two arbitrary vectors a and b separated by an angle θ , Figure A.1b shows
how we can subtract them to obtain a third vector c = a
b , such that a , b and c form
Search WWH ::




Custom Search