
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Matthew T. Mason
Mechanics of Manipulation Spring 2010
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Overview, motivation
Background
Definition and properties
Rotation using unit quaternions
Intuition
Using quaternions to represent rotations
Why we love quaternions.
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
I (^) We can invert reals. x × (^1) x = 1. I (^) We can invert elements of R^2 using complex numbers. z × z∗/|z|^2 = 1, where ∗^ is complex conjugate. I (^) Can we invert v ∈ R^3? I (^) No. I (^) How about v ∈ R^4? I (^) Yes! Hamilton’s quaternions are to R^4 what complex numbers are to R^2.
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
I (^) Define basis elements 1 and i; I (^) Define complex numbers as a vector space over reals: elements have the form x + iy; I (^) One more axiom required: i^2 = −1.
I (^) Define basis elements 1, i, j, k; I (^) Define quaternions as a vector space over reals: elements have the form q 0 + q 1 i + q 2 j + q 3 k; I (^) One more axiom:
i^2 = j^2 = k^2 = ijk = − 1
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
We can write a quaternion several ways:
q = q 0 + q 1 i + q 2 j + q 3 k q = (q 0 , q 1 , q 2 , q 3 ) q = q 0 + q
For quaternion q 0 + q , q 0 is the scalar part and q is the vector part
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
We can write a quaternion product several ways:
pq = (p 0 + p 1 i + p 2 j + p 3 k)(q 0 + q 1 i + q 2 j + q 3 k) = (p 0 q 0 − p 1 q 1 − p 2 q 2 − p 3 q 3 ) +... i +... j +... k pq = (p 0 + p )(q 0 + q ) = (p 0 q 0 + p 0 q + q 0 p + pq )
The last product includes many different kinds of product: product of two reals, scalar product of vectors. But what is pq? Cross product? Dot product? Both! Cross product minus dot product!
pq = (p 0 q 0 − p · q + p 0 q + q 0 p + p × q )
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Every quaternion except 0 has an inverse:
q−^1 =
q∗ |q|^2
Without commutativity, quaternions are a division ring, or a non-commutative field, or a skew field. Just as complex numbers are an extension of the reals, quaternions are an extension of the complex numbers (and of the reals). If 1D numbers are the reals, and 2D numbers are the complex numbers, then 4D numbers are quaternions, and that’s all there is. (Frobenius) (Octonions are not associative.)
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
I (^) Let q be a unit quaternion, i.e. |q| = 1. I (^) It can be expressed as
q = cos
θ 2 +^ sin^
θ 2 n ˆ
I (^) Let x = 0 + x be a “pure vector”. I (^) Let x′^ = qxq∗. I (^) Then x′^ is the pure vector rot(θ, ˆ n ) x !!!
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
In analogy with complex numbers, why not use
p = cos θ + ˆ n sin θ x ′^ = p x
To explore that idea, define a map Lp(q) = pq. Note that Lp(q) can be written:
Lp(q) =
p 0 −p 1 −p 2 −p 3 p 1 p 0 −p 3 p 2 p 2 p 3 p 0 −p 1 p 3 −p 2 p 1 p 0
q 0 q 1 q 2 q 3
Note that the matrix above is orthonormal. Lp is a rotation of Euclidean 4 space!
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Although Lp(q) rotates the 4D space of quaternions, it is not a rotation of the 3D subspace of pure vectors. Some of the 3D subspace leaks into the fourth dimension. Consider an example using p = i. Is it a rotation about i of π/2?
no rotation
i
1
j
k
j j
(^1 )
i i
k k
1- i plane
j - k plane
L (^) i q iq (^) R (^) i q qi iqi L (^) i R (^) i q
2 2
2 2
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Just expand the product
qxq∗^ =
q 02 + q^21 − q 22 − q^23 2 (q 1 q 2 − q 0 q 3 ) 2 (q 1 q 3 + q 0 q 2 ) 2 (q 1 q 2 + q 0 q 3 ) q 02 − q^21 + q 22 − q^23 2 (q 2 q 3 − q 0 q 1 ) 2 (q 1 q 3 − q 0 q 2 ) 2 (q 2 q 3 + q 0 q 1 ) q 02 − q^21 − q 22 + q^23
(^) x
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
Given R = (rij ), solve expression on previous slide for quaternion elements qi Linear combinations of diagonal elements seem to solve the problem:
q^20 =
( 1 + r 11 + r 22 + r 33 )
q^21 =
( 1 + r 11 − r 22 − r 33 )
q^22 =
( 1 − r 11 + r 22 − r 33 )
q^23 =
( 1 − r 11 − r 22 + r 33 )
so take four square roots and you’re done? You have to figure the signs out. There is a better way...
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
I (^) That way, only have to worry about getting one sign right. I (^) Actually q and −q represent the same rotation, so no worries about signs. I (^) Taking the largest square root avoids division by small numbers.
Quaternions
Overview, motivation Background Definition and properties Rotation using unit quaternions Intuition Using quaternions to represent rotations Why we love quaternions.
I (^) Unit quaternions live on the unit sphere in R^4. I (^) Quaternions q and −q represent the same rotation. I (^) Inverse of rotation q is the conjugate q∗. I (^) Null rotation, the identity, is the quaternion 1.