Graphics Programs Reference
In-Depth Information
1.4.6 Concatenating Rotations
Sometimes, we have to perform two consecutive rotations on an object. This turns out
to be easy and numerically stable with a quaternion representation.
If q 1 and q 2 are unit quaternions representing the two rotations, then associativity
of quaternion multiplication implies that the combined rotation of q 1 followed by q 2 is
represented by the quaternion q 2 ·
q 1 . The proof is
( q 1 · P · q 1
· q 1
2
( q 1
1
· q 1
2
( q 2 · q 1 ) 1 .
q 2 ·
)
=( q 2 · q 1 )
· P ·
)=( q 2 · q 1 )
· P ·
1
Quaternion multiplication involves fewer operations than matrix multiplication, so
combining rotations by means of quaternions is faster. Performing fewer multiplications
also implies better numerical accuracy.
In general, we use 4
4 transformation matrices to express three-dimensional trans-
formations, so we would like to be able to express the rotation P = q [0 , P ] q 1 as P =
PM ,where M is a 4
×
4 matrix. Given the two quaternions q 1 = w 1 + x 1 i + y 1 j + z 1 k =
( w 1 ,x 1 ,y 1 ,z 1 )and q 2 = w 2 + x 2 i + y 2 j + z 2 k =( w 2 ,x 2 ,y 2 ,z 2 ), their product is
×
q 1 ·
q 2 =( w 1 w 2
x 1 x 2
y 1 y 2
z 1 z 2 )+( w 1 x 2 + x 1 w 2 + y 1 z 2
z 1 y 2 ) i
+( w 1 y 2
x 1 z 2 + y 1 w 2 + z 1 x 2 ) j +( w 1 z 2 + x 1 y 2
y 1 x 2 + z 1 w 2 ) k .
The first step is to realize that each term in this product depends linearly on the
coe cients of q 1 . This product can therefore be expressed as
w 1
z 1
y 1
x 1
z 1
w 1
x 1
y 1
q 1 ·
q 2 = q 2 ·
L ( q 1 )=( x 2 ,y 2 ,z 2 ,w 2 )
.
y 1
x 1
w 1
z 1
x 1
y 1
z 1
w 1
When L ( q 1 ) multiplies the row vector q 2 , the result is a row vector representation for
q 1 ·
q 2 . Each term also depends linearly on the coe cients of q 2 , so the same product
can also be expressed as
w 2
z 2
y 2
x 2
z 2
w 2
x 2
y 2
q 1 ·
q 2 = q 1 ·
R ( q 2 )=( x 1 ,y 1 ,z 1 ,w 1 )
.
y 2
x 2
w 2
z 2
x 2
y 2
z 2
w 2
When R ( q 2 ) multiplies the row vector q 1 , the result is also a row vector representation
for q 1 ·
q 2 .
We can now write the triple product q
q 1
·
[0 , P ]
·
in terms of the matrices L ( q )
and R ( q ):
q [0 , P ] q 1 = q ([0 , P ]
q 1 )= q ([0 , P ] R ( q 1 ))
=([0 , P ] R ( q 1 )) L ( q )=[0 , P ]( R ( q 1 ) L ( q ))
=[0 , P ] M ,
·
Search WWH ::




Custom Search