Graphics Reference
In-Depth Information
2.13 Direction cosines
A vector's orientation and magnitude are encoded within its Cartesian components. The
magnitude of a 3D vector
v
is readily obtained using
x
v
+
v
=
y
v
+
z
v
while its orientation is obtained using
tan
−
1
y
v
x
v
=
where is the angle between the vector and the x-axis. However, we can develop this idea of
orientation using
direction cosines
.
Y
Y
v
v
α
j
α
α
j
α
k
i
α
i
X
X
Z
Figure 2.40.
Figure 2.40 illustrates the idea behind direction cosines for a 2D and a 3D vector. The angles
i
,
j
, and
k
(for a 3D vector) provide an elegant visual mechanism for orientating a vector
relative to the Cartesian axes. In fact, the cosines of the angles are used as they are intimately
related to the vector's components.
Y
y
v
v
α
j
α
i
x
v
X
Figure 2.41.
To begin with, consider the 2D vector
v
in Fig. 2.41. It has components x
v
and y
v
and it is
obvious that
i
+
90
. Now
j
=
x
v
cos
i
=
v