Graphics Reference
In-Depth Information
B.3.4 Quaternions
Quaternions are discussed in Chapter 2.4 and Chapter 3.1 . The equations from those chapters, along
with additional equations, are collected here to facilitate the discussion.
Quaternion arithmetic
Quaternions are four-tuples and can be considered as a scalar combined with a vector ( Eq. B.4 3). Addi-
tion and multiplication are defined for quaternions by Equations B.44 and B.45 , respectively. Quater-
nion multiplication is associative ( Eq. B.46 ), but it is not commutative ( Eq. B.47 ). The magnitude of a
quaternion is computed as the square root of the sum of the squares of its four components ( Eq. B.48 ).
Quaternion multiplication has an identity ( Eq. B.49 ) and an inverse ( Eq. B.50 ) . The inverse distributes
over quaternion multiplication similarly to how the inverse distributes over matrix multiplication
( Eq. B.51 ). A quaternion is normalized by dividing it by its magnitude ( Eq. B.52 ) . Equation B.52a
is used to compute the quaternion that represents the rotation r such that q represents the half-way rota-
tion between p and r .
q ¼ s; x; y; z
½
¼s; v
½
(B.43)
½
s 1 ; v 1
þs 2 ; v 2
½
¼s 1 þ s 2 ; v 1 þ v 2
½
(B.44)
½
s 1 ; v 1
s 2 ; v 2
½
¼s 1 s 2 v 1 : v 2 ; s 1 v 2 þ s 2 v 1 þ v 1 v 2
½
(B.45)
ð
q 1 q 2
Þq 3 ¼ q 1 q 2 q 3
ð
Þ
(B.46)
q 1 q 2 6¼ q 2 q 1
(B.47)
p
s
2
2
2
2
kqk¼
þ x
þ y
þ z
(B.48)
½
s; v
½
1
;
ð
0
;
0
;
0
Þ
¼ s; v
½
(B.49)
2
q 1
¼
ð
1
=kqk
Þ
½
s; v
(B.50)
q 1
q ¼ qq 1
¼
½
1
;
ð
0
;
0
;
0
Þ
pðÞ
1
¼ q 1
p 1
(B.51)
qunit ¼ q= kqðÞ
(B.52)
r ¼
2 p q
ð
Þq p
(B.52a)
Rotations by quaternions
A point in space is represented by a vector quantity in quaternion form by using a zero scalar value
( Eq. B.53 ). A quaternion can be used to rotate a vector using quaternion multiplication ( Eq. B.54 ) . Com-
pound rotations can be implemented by premultiplying the corresponding quaternions ( Eq. B.55 ), similar
to what is routinely done when rotation matrices are used. As should be expected, compounding a rotation
with its inverse produces the identity transformation for vectors ( Eq. B.56 ) . An axis-angle rotation is repre-
sented by a unit quaternion, as shown in Equation B.57 . Any scalar multiple of a quaternion represents the
same rotation. In particular, the negation of a quaternion (negating each of its four components,
q ¼
[ -s ,
x , y ,
z ]) represents the same rotation that the original quaternion represents ( Eq. B.58 ) .
v ¼
½
0
; x; y; z
(B.53)
0
Rot ðÞ¼qvq 1
v
¼
(B.54)
 
Search WWH ::




Custom Search