Graphics Reference
In-Depth Information
Let's examine this compound quaternion with an example. For instance, given
the following conditions let's derive a single quaternion
q
to represent the
compound rotation:
roll
=90
◦
pitch
= 180
◦
yaw
=0
◦
Thevaluesof
s
,
x
,
y
,
z
are
s
=0
x
= cos(45
◦
)
y
=
sin(45
◦
)
−
z
=0
and the quaternion
q
is
q
=[0
,
[cos(45
◦
)
,
sin(45
◦
)
,
0]]
−
If the point
P
(1, 1, 1) is subjected to this compound rotation, the rotated
point is computed using the standard quaternion transform:
P
=
qPq
−
1
Let's evaluate
qPq
−
1
in two stages:
1
qP
=[0
,
[cos(45
◦
)
, −
sin(45
◦
)
,
0] ]
·
[0
,
[1
,
1
,
1]]
=[0
,
[
−
sin(45
◦
)
, −
cos(45
◦
)
,
sin(45
◦
) + cos(45
◦
)]]
2
(
qP
)
q
−
1
=[0
,
[
sin(45
◦
)
,
cos(45
◦
)
,
sin(45
◦
) + cos(45
◦
)]]
−
−
cos(45
◦
)
,
sin(45
◦
)
,
0]]
·
[0
,
[
−
P
=[0
,
[
−
1
,
−
1
,
−
1]]
Therefore, the coordinates of the rotated point are (
−
1
,
−
1
,
−
1), which
can be confirmed from Figure 7.28.
7.7.7 Quaternions in Matrix Form
There is a direct relationship between quaternions and matrices. For example,
given the quaternion [
s
+
x
i
+
y
j
+
z
k
) the equivalent matrix is
⎡
⎤
M
11
M
12
M
13
⎣
⎦
M
21
M
22
M
23
M
31
M
32
M
33