30.12.2013 Views

Quaternions and Rotations∗ - Iowa State University

Quaternions and Rotations∗ - Iowa State University

Quaternions and Rotations∗ - Iowa State University

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

By the reasoning so far, the optimal rotation can be solved from the formulation below:<br />

min<br />

R<br />

n∑<br />

‖Rp ′ i − q ′ i‖ 2 . (12)<br />

i=1<br />

Here we present an exact solution to (12) as described in [3] using quaternions. An equivalent<br />

quaternion-based solution is given in [2]. The version of matching two curves (or surfaces), also<br />

assuming pointwise correspondences, is solved exactly in [8] in a somewhat similar manner without<br />

the use of quaternions.<br />

First, we rewrite the summation in (12) as follows:<br />

n∑<br />

‖Rp ′ i − q ′ i‖ 2 =<br />

i=1<br />

=<br />

n∑<br />

(Rp ′ i · Rp ′ i) − 2<br />

i=1<br />

n∑<br />

(Rp ′ i · q ′ i) +<br />

i=1<br />

n∑ (<br />

‖p<br />

′<br />

i ‖ 2 + ‖q ′ i‖ 2) − 2<br />

i=1<br />

n∑<br />

q ′ i · q ′ i<br />

i=1<br />

n∑<br />

Rp ′ i · q ′ i.<br />

The first summ<strong>and</strong> in the last equation above does not depend on the rotation, so we need only<br />

minimize the second summ<strong>and</strong>. Equivalently, this can be done through a maximization:<br />

max<br />

R<br />

i=1<br />

n∑<br />

Rp ′ i · q′ i . (13)<br />

i=1<br />

The rotation matrix R has nine entries, only four of which are independent due to the orthogonality<br />

<strong>and</strong> unit determinant of R. Instead, we represent rotations using unit quaternions.<br />

Essentially, we find the unit quaternion q that maximizes<br />

n∑<br />

(qp ′ iq ∗ ) · q ′ i. (14)<br />

i=1<br />

Here we view quaternions as vectors in R 4 . Let q = (q 0 ,q 1 ,q 2 ,q 3 ) T <strong>and</strong> q ∗ = (q 0 , −q 1 , −q 2 , −q 3 ) T .<br />

Also, the points p ′ 1 ,...,p′ n <strong>and</strong> q′ 1 ,... ,q′ n are viewed as 4-tuples with p′ i = (0,p′ i1 ,p′ i2 ,p′ i3 )T <strong>and</strong><br />

q ′ i = (0,q′ i1 ,q′ i2 ,q′ i3 )T by a slight abuse of notation.<br />

Applying the definition of quaternion product, it is not difficult to show that<br />

(qp ′ iq ∗ ) · q ′ i = (qp ′ i) · (q ′ iq). (15)<br />

Next, we intend to rewrite the summ<strong>and</strong>s in (14) as matrix products. For this purpose, we define<br />

matrices<br />

⎛<br />

0 −p ′ i1 −p ′ i2 −p ′ ⎞ ⎛<br />

i3<br />

0 −q P i = ⎜ p ′ i1 0 p ′ i3 −p ′ i1 ′ −q i2 ′ −q ′ ⎞<br />

i3<br />

i2 ⎟<br />

⎝ p ′ i2 −p ′ i3 0 p ′ ⎠ <strong>and</strong> Q i = ⎜ q i1 ′ 0 −q i3 ′ q ′ i2 ⎟<br />

⎝<br />

i1<br />

q ′<br />

p ′ i3 p ′ i2 −p ′ i2 q i3 ′ 0 −q i1<br />

′ ⎠ ,<br />

i1 0<br />

q i3 ′ −q i2 ′ q i1 ′ 0<br />

for 1 ≤ i ≤ n. Then the quaternion products qp ′ i <strong>and</strong> q′ iq are equivalent to the matrix products<br />

P i q <strong>and</strong> Q i q. We thus have<br />

n∑<br />

(qp ′ i q∗ ) · q ′ i =<br />

i=1<br />

n∑<br />

(qp ′ i ) · (q′ iq) from (15)<br />

i=1<br />

10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!