Graphics Reference
In-Depth Information
7.5 Quaternions as rotators
Surely, if a complex number can rotate a vector in R
2
, can a quaternion rotate a vector in R
3
?
Let's explore how this is possible.
In Section 7.3.5 we saw that a complex number can be used as a 2D rotator using
z
=
cos
+
sin
i
x
+
y
i
and it is tempting to see whether a quaternion can be used in a similar fashion. This time we
will use a vector
v
=
x
i
+
y
j
+
z
k
and a quaternion
q
=
cos
+
sin
i
and create the product
q
v
=
cos
+
sin
i
x
i
+
y
j
+
z
k
which expands to
x sin
i
2
q
v
=
x cos
i
+
y cos
j
+
z cos
k
+
+
y sin
ij
+
z sin
ik
Invoking Hamilton's rules
i
2
=−
1
ij
=
k
ik
=−
j
gives
q
v
=
x cos
i
+
y cos
j
+
z cos
k
−
x sin
+
y sin
k
−
z sin
j
Collecting like terms gives
q
v
=−
x sin
+
x cos
i
+
y cos
−
z sin
j
+
z cos
+
y sin
k
Some subtle changes reveal
=
+
+
−
+
+
q
v
x cos
x sin
i
i
y cos
z sin
j
z cos
y sin
k
(7.12)
Equation (7.12) is tantalizingly close to a perfect rotation about the
i
-axis. For if we ignore the
i
term, the
j
and
k
terms contain a rotation transform for the y and z coordinates:
cos
y
z
sin
sin cos
−
Obviously, the operation q
v
falls short of a pure rotation, but we could consider developing it
to create one. Basically, we want to convert the
i
term to x
i
, which can, perhaps, be achieved
by extending q
v
to q
v
¯
q, where
q is another quaternion.
¯
Let's make
q
¯
=
cos
−
sin
i