Graphics Reference
In-Depth Information
2
(
pP
)
q
−
1
= [sin(45
◦
)
,
[sin(45
◦
)
,
cos(45
◦
)
,
cos(45
◦
)]]
[cos(45
◦
)
,
[0
,
0
,
sin(45
◦
)]]
=[0
,
[sin(90
◦
)
,
cos(90
◦
)
,
1]]
·
The vector component of
P
confirms that
P
is rotated to (1, 0, 1).
7.7.6 Roll, Pitch and Yaw Quaternions
Having already looked at roll, pitch and yaw rotations, we can now define
them as quaternions:
q
roll
= [cos(
θ/
2)
,
sin(
θ/
2)[0
,
0
,
1]]
q
pitch
= [cos(
θ/
2)
,
sin(
θ/
2)[1
,
0
,
0]]
q
yaw
= [cos(
θ/
2)
,
sin(
θ/
2)[0
,
1
,
0]]
(7.98)
where
θ
is the angle of rotation.
These quaternions can be multiplied together to create a single quaternion
representing a compound rotation. For example, if the quaternions are defined
as
q
roll
= [cos(
roll/
2)
,
sin(
roll/
2)[0
,
0
,
1]]
q
pitch
= [cos(
pitch/
2)
,
sin(
pitch/
2)[1
,
0
,
0]]
q
yaw
= [cos(
yaw/
2)
,
sin(
yaw/
2)[0
,
1
,
0]]
(7.99)
they can be concatenated to a single quaternion
q
:
q
=
q
yaw
q
pitch
q
roll
=[
s
+
x
i
+
y
j
+
z
k
]
(7.100)
where
s
=cos
yaw
2
cos
pitch
2
cos
roll
2
+sin
yaw
2
sin
pitch
2
sin
roll
2
sin
pitch
2
cos
roll
2
+sin
yaw
2
cos
pitch
2
sin
roll
2
x
=cos
yaw
2
cos
pitch
2
cos
roll
2
sin
pitch
2
sin
roll
2
y
=sin
yaw
2
cos
yaw
2
−
cos
pitch
2
sin
roll
2
sin
pitch
2
cos
roll
2
z
=cos
yaw
2
sin
yaw
2
−
(7.101)