Graphics Reference
In-Depth Information
The
inverse of a quaternion
,[
s
,
v
]
1
, is obtained by negating its vector part and dividing both parts by
the magnitude squared (the sum of the squares of the four components), as shown in
Equation 2.27
.
p
(2.27)
Multiplication of a quaternion, q, by its inverse, q
1
, results in the multiplicative identity
[1, (0, 0, 0)]. A unit-length quaternion (also referred to here as a unit quaternion), q, is created by divid-
ing each of the four components by the square root of the sum of the squares of those components
(Eq.
s
q
1
2
¼ð
1
=jjqjjÞ
½s; v
where
jjqjj ¼
2
þ x
2
þ y
2
þ z
2
q ¼ q=ðjjqjjÞ
(2.28)
Representing rotations using quaternions
A rotation is represented in a quaternion form by encoding axis-angle information.
Equation 2.29
shows a
unit quaternion representation of a rotation of an angle,
u
, about a unit axis of rotation (
x
,
y
,
z
).
QuatRotð
y
; ðx; y; zÞÞ ½
cos
ð
y
=
2
Þ;
sin
ð
y
=
2
Þðx; y; zÞ
(2.29)
Notice that rotating some angle around an axis is the same as rotating the negative angle around the
negated axis. In quaternions, this is manifested by the fact that a quaternion,
q ¼
[
s
,
v
], and its negation,
q ¼
v
], represent the same rotation. The two negatives in this case cancel each other out and
produce the same rotation. In
Equation 2.30
,
the quaternion
q
represents a rotation of
u
about a unit axis
of rotation (
x
,
y
,
z
), i.e.,
[
s
,
q ¼½
cos
ð
y
=
2
Þ;
sin
ð
y
=
2
Þðx; y; zÞ
¼½
cos
ð
180
ð
y
=
2
ÞÞ;
sin
ð
y
=
2
Þððx; y; zÞÞ
¼½
cos
ðð
360
y
Þ=
2
Þ;
sin
ð
180
y
=
2
Þððx; y; zÞÞ
(2.30)
¼½
cos
ðð
360
y
Þ=
2
Þ;
sin
ð
360
y
=
2
Þððx; y; zÞÞ
QuatRotð
y
; ðx; y; zÞÞ
QuatRotð
y
; ðx; y; zÞÞ
Negating
q
results in a negative rotation around the negative of the axis of rotation, which is the
Rotating vectors using quaternions
To rotate a vector,
v
, using quaternion math, represent the vector as [0,
v
] and represent the rotation by
0
Rot
q
ðvÞqvq
1
¼ v
(2.31)
A series of rotations can be concatenated into a single representation by quaternion multiplication.
Consider a rotation represented by a quaternion,
p
, followed by a rotation represented by a quaternion,
¼ðqpÞvðqpÞ
1
Rot
q
ðRot
p
ðvÞÞ ¼ qðpvp
1
Þq
1
¼ Rot
qp
ðvÞ
(2.32)
The inverse of a quaternion represents rotation about the same axis by the same amount but in the
reverse direction.
Equation 2.33
shows that rotating a vector by a quaternion,
q
, followed by rotating
the result by the inverse of that same quaternion produces the original vector.
ðRot
q
ðvÞÞ ¼ q
1
ðqvp
1
Rot
q
1
Þq ¼ v
(2.33)
Search WWH ::
Custom Search