Graphics Reference
In-Depth Information
50
12
.
689
cos
β
=
4
.
472
≈
0
.
8811
×
cos
−
1
0
.
8811
=
≈
β
28
.
22°
.
The angle between the two vectors is approximately 28
.
22°, and
β
is always the
smallest angle associated with the geometry.
3.11 The Vector Product
The second way to multiply vectors is by using the
vector product
, which is also
called the
cross product
due to the '
' symbol used in its notation. It is based on the
observation that two vectors
r
and
s
can be multiplied together to produce a third
vector
t
:
×
r
×
s
=
t
where
|
t
|=|
r
||
s
|
sin
β
(3.2)
and
β
is the angle between
r
and
s
.
The vector
t
is normal (90°) to the plane containing the vectors
r
and
s
, which
makes it an ideal way of computing surface normals in computer graphics applica-
tions. Once again, let's define two vectors and proceed to multiply them together
using the '
×
' operator:
r
=
a
i
+
b
j
+
c
k
s
=
d
i
+
e
j
+
f
k
r
×
s
=
(a
i
+
b
j
+
c
k
)
×
(d
i
+
e
j
+
f
k
)
=
a
i
×
(d
i
+
e
j
+
f
k
)
+
b
j
×
(d
i
+
e
j
+
f
k
)
+
c
k
×
(d
i
+
e
j
+
f
k
)
=
ad
i
×
i
+
ae
i
×
j
+
af
i
×
k
+
bd
j
×
i
+
be
j
×
j
+
bf
j
×
k
+
cd
k
×
i
+
ce
k
×
j
+
cf
k
×
k
.
As we found with the dot product, there are two groups of vector terms: those that
reference the same unit vector, and those that reference different unit vectors.
Using the definition for the cross product (
3.2
), operations such as
i
×
i
,
j
×
j
and
k
k
result in a vector whose magnitude is 0. This is because the angle between the
vectors is 0°, and sin 0°
×
=
0. Consequently these terms vanish and we are left with
r
×
s
=
ae
i
×
j
+
af
i
×
k
+
bd
j
×
i
+
bf
j
×
k
+
cd
k
×
i
+
ce
k
×
j
.
(3.3)
The mathematician Sir William Rowan Hamilton struggled for many years to gener-
alise complex numbers - and in so doing created a means of describing 3D rotations.
At the time, he was not using vectors - as they had yet to be defined - but the imag-
inary terms
i
,
j
and
k
. Hamilton's problem was to resolve the products
ij
,
jk
,
ki
and their opposites
ji
,
kj
and
ik
.