Graphics Reference
In-Depth Information
B.2 Geometric computations
A vector (a one-dimensional list of numbers) is often used to represent a point in space or a direction
and magnitude in space (e.g., Figure B.3 ) . A slight complication in terminology results because a direc-
tion and magnitude in space is also referred to as a vector . As a practical matter, this distinction is
usually not important. A vector in space has no position, only magnitude and direction. For geometric
computations, a matrix usually represents a transformation (e.g., Figure B.4 ).
B.2.1 Components of a vector
A vector, A , with coordinates ( A x , A y , A z ) can be written as a sum of vectors, as shown in Equation B.17 ,
in which i ,
j , k are unit vectors along the principal axes, x , y , and z , respectively.
A ¼ A x i þ A y j þ A z k
(B.17)
B.2.2 Length of a vector
The length of a vector is computed as in Equation B.18 . If a vector is of unit length, then | A |
1.0, and it
is said to be normalized . Dividing a vector by its length, forming a unit-length vector, is said to be
normalizing the vector.
¼
q
A
jAj¼
2
x þ A
2
y þ A
2
z
(B.18)
y
(2,5)
(5,2 )
x
FIGURE B.3
A point and vector in two-space.
y
Q
cos
sin cos
sin
Q
p
P
x
FIGURE B.4
A matrix representing a rotation.
 
Search WWH ::




Custom Search