Page 61 -
P. 61
40 2 Image formation
z
ŒqŒ=1 q 2 q 1
w
q 0
x
-q 2 y
Figure 2.6 Unit quaternions live on the unit sphere q =1. This figure shows a smooth trajectory through the
three quaternions q , q , and q . The antipodal point to q , namely −q , represents the same rotation as q .
1
2
2
2
0
2
Quaternions can be derived from the axis/angle representation through the formula
θ θ
q =(v,w)=(sin ˆn, cos ), (2.39)
2 2
where ˆn and θ are the rotation axis and angle. Using the trigonometric identities sin θ =
θ
2 sin cos θ and (1 − cos θ) = 2 sin 2 θ , Rodriguez’s formula can be converted to
2 2 2
R(ˆn,θ)= I + sin θ[ˆn] × +(1 − cos θ)[ˆn] 2
×
2
= I +2w[v] × +2[v] . (2.40)
×
This suggests a quick way to rotate a vector v by a quaternion using a series of cross products,
scalings, and additions. To obtain a formula for R(q) as a function of (x, y, z, w), recall that
0 −z y −y − z xy xz
⎡ ⎤ ⎡ 2 2 ⎤
2
2
[v] × = ⎣ z 0 −x ⎦ and [v] = ⎣ xy −x − z 2 yz ⎦ .
×
2
−y x 0 xz yz −x − y 2
We thus obtain
⎡ 2 2 ⎤
1 − 2(y + z ) 2(xy − zw) 2(xz + yw)
⎢ ⎥
2
2
R(q)= ⎢ 2(xy + zw) 1 − 2(x + z ) 2(yz − xw) ⎥ . (2.41)
⎣ ⎦
2
2
2(xz − yw) 2(yz + xw) 1 − 2(x + y )
2
2
2
The diagonal terms can be made more symmetrical by replacing 1 − 2(y + z ) with (x +
2
2
2
w − y − z ), etc.
The nicest aspect of unit quaternions is that there is a simple algebra for composing rota-
tions expressed as unit quaternions. Given two quaternions q =(v 0 ,w 0 ) and q =(v 1 ,w 1 ),
0 1
the quaternion multiply operator is defined as
q = q q =(v 0 × v 1 + w 0 v 1 + w 1 v 0 ,w 0 w 1 − v 0 · v 1 ), (2.42)
2
0 1
with the property that R(q )= R(q )R(q ). Note that quaternion multiplication is not
2
0
1
commutative, just as 3D rotations and matrix multiplications are not.