Quaternions and 3D Rotations

Quaternions and 3D Rotations

Quaternions and 3D Rotations Jeanette Schofield April 7, 2011 Contents 1 Quaternions: Definition and Basic Properties 3 1.1 Equality . 4 1.2 Addition . 4 1.2.1 Closed Under Addition . 4 1.2.2 Additive Identity . 4 1.2.3 Additive Inverse . 5 1.2.4 Commutative Under Addition . 5 1.2.5 Associative Under Addition . 5 1.3 Multiplication . 6 1.3.1 Scalar Multiplication . 6 1.3.2 Multiplication of Two Quaternions . 6 1.3.3 Associative Under Multiplication . 6 1.3.4 Implications of i2 = j2 = k2 = ijk = −1................. 7 1.3.5 Multiplication of Two Quaternions Revisited . 8 1.3.6 Closed Under Multiplication . 9 1.3.7 Multiplicative Identity . 9 1.3.8 Conjugate . 10 1.3.9 Norm . 10 1.3.10 Multiplicative Inverse . 10 1.4 Multiplication is Distributive over Addition . 11 1.5 Remarks on Quaternion Multiplication and Commutativity . 12 1.6 Summary of Algebraic Properties . 13 2 Quaternions and Rotations 14 2.1 Rotations in Three-Space . 14 2.2 Proof: w = qvq∗ ................................. 15 2.3 Expanding w = qvq∗ ............................... 20 2.4 Rotation Algorithm . 21 2.5 Examples . 22 2.5.1 Example 1 . 22 2.5.2 Example 2 . 23 3 Rotating a Coordinate Frame S into Another Coordinate Frame S0 26 3.1 Generalized Two Axis-Angle Rotation Method . 26 3.2 Two Axis-Angle Rotation Method Using Quaternions . 27 1 3.2.1 Example . 28 A Some Useful Equations 31 A.1 The Dot and Cross Product of Two Vectors . 31 A.1.1 The Dot Product . 31 A.1.2 The Cross Product . 31 A.2 Useful Relationships . 31 A.2.1 Proof: If v is ? to w, kv + wk2 = kvk2 + kwk2 . 32 B Source Code for the Two Axis-Angle Frame Rotation Method 33 B.1 C++ Code Listing . 33 2 Chapter 1 Quaternions: Definition and Basic Properties Quaternions may be thought of as 4-tuples of real numbers: q = (q0; q1; q2; q3). Equivalently, quaternions may also be written in the form q = q0 + q1i + q2j + q3k (1.0.0.1) where i = (0; 1; 0; 0) j = (0; 0; 1; 0) (1.0.0.2) k = (0; 0; 0; 1) are themselves 4-tuples which satisfy the following relations i2 = j2 = k2 = ijk = −1: (1.0.0.3) 3 In R , a vector is defined as v = vxi + vyj + vzk where i, j, and k are vectors of the form i = (1; 0; 0) j = (0; 1; 0) k = (0; 0; 1): 3 4 Any vector in R can be mapped to R by (vx; vy; vz) 7! (0; vx; vy; vz) This mapping is often represented by v = 0 + v = v. By convention, the i, j, and k components of a quaternion are usually written as vectors. Thus, any quaternion q may be written as q = q0 + q = q0 + q1i + q2j + q3k (1.0.0.4) where i2 = j2 = k2 = ijk = −1: (1.0.0.5) Here, q0 is referred as the scalar part of the quaternion and q = q1i + q2j + q3k is referred to 3 as the vector part of the quaternion. The quaternions form a non-commutative division ring. This means that quaternions have all the properties of a field except that quaternions are not commutative under multi- plication. A discussion of the various properties of quaternions follows. 1.1 Equality Two quaternions, p = p0 + p1i + p2j + p3k and q = q0 + q1i + q2j + q3k are considered equal if and only if their corresponding scalar components are equal: p0 = q0 p1 = q1 p2 = q2 p3 = q3: 1.2 Addition Two quaternions, p = p0 + p1i + p2j + p3k and q = q0 + q1i + q2j + q3k, can be added together by combining their corresponding scalar and vector components: p + q = (p0 + p1i + p2j + p3k) + (q0 + q1i + q2j + q3k) = (p0 + q0) + (p1 + q1)i + (p2 + q2)j + (p3 + q3)k: The following subsections discuss various properties of the quaternions under addition. 1.2.1 Closed Under Addition The addition of two quaternions, p = p0 + p1i + p2j + p3k and q = q0 + q1i + q2j + q3k, will result in a third quaternion, r = r0 + r1i + r2j + r3k: p + q = p0 + p1i + p2j + p3k + q0 + q1i + q2j + q3k = (p0 + q0) + (p1 + q1)i + (p2 + q2)j + (p3 + q3)k = r0 + r1i + r2j + r3k = r: 1.2.2 Additive Identity The additive identity for quaternions is the zero quaternion, 0 = 0 + 0i + 0j + 0k: q + 0 = q0 + q1i + q2j + q3k + 0 + 0i + 0j + 0k = (q0 + 0) + (q1 + 0)i + (q2 + 0)j + (q3 + 0)k = q0 + q1i + q2j + q3k = q: 4 1.2.3 Additive Inverse The additive inverse for a quaternion q = q0 + q1i + q2j + q3k is given by −q = −q0 − q1i − q2j − q3k: q + (−q) = (q0 + q1i + q2j + q3k) + (−q0 − q1i − q2j − q3k) = (q0 − q0) + (q1 − q1)i + (q2 − q2)j + (q3 − q3)k = 0: 1.2.4 Commutative Under Addition Commutativity means that the order in which two quaternions are added together does not matter. Thus, for any two quaternions, p = p0 + p1i + p2j + p3k and q = q0 + q1i + q2j + q3k, p + q = (p0 + p1i + p2j + p3k) + (q0 + q1i + q2j + q3k) = (p0 + q0) + (p1 + q1)i + (p2 + q2)j + (p3 + q3)k = (q0 + p0) + (q1 + p1)i + (q2 + p2)j + (q3 + p3)k = (q0 + q1i + q2j + q3k) + (p0 + p1i + p2j + p3k) = q + p: 1.2.5 Associative Under Addition Associativity means given any three quaternions under addition, the order in which they are grouped together does not matter. For any three quaternions, p = p0 + p1i + p2j + p3k, q = q0 + q1i + q2j + q3k, and r = r0 + r1i + r2j + r3k, observe that (p + q) + r = (p0 + q0) + (p1 + q1)i + (p2 + q2)j + (p3 + q3)k + r0 + r1i + r2j + r3k = (p0 + q0) + r0 + (p1 + q1) + r1 i + (p2 + q2) + r2 j + (p3 + q3) + r3 k: Because the real numbers are associative under addition, the scalar componenets can be manipulated. Thus, (p + q) + r = p0 + (q0 + r0) + p1 + (q1 + r1) i + p2 + (q2 + r2) j + p3 + (q3 + r3) k = p0 + p1i + p2j + p3k + (q0 + r0) + (q1 + r1)i + (q2 + r2)j +(q3 + r3)k = p + (q + r): To summarize, the associativity of quaternions under addition means that the order in which three or more quaternions are combined does not matte; i.e. (p + q) + r = p + (q + r). 5 1.3 Multiplication For quaternions, there are two types of multiplication to discuss: scalar multiplication and the muiltiplication of two quaternions. Scalar multiplication involves the multiplication of a quaternion q = q0 +q1i+q2j+q3k by any scalar s 2 R. The multiplication of two quaternions involves multiplying two quaternions p = p0 + p1i + p2j + p3k and q = q0 + q1i + q2j + q3k. Various properties of quaternions that deal with multiplication will also be discussed in this section. 1.3.1 Scalar Multiplication Multiplication of a quaternion q = q0 + q1i + q2j + q3k by a scalar s is defined as sq = sq0 + sq = sq0 + sq1i + sq2j + sq3k: 1.3.2 Multiplication of Two Quaternions The multiplication of two quaternions, p = p0 + p and q = q0 + q, is defined as pq = (p0 + p)(q0 + q) = p0q0 + p0q + q0p + pq: (1.3.2.1) At this point is in unclear how to expand the term "pq." This will be revisted in a later section. 1.3.3 Associative Under Multiplication Quaternions are associative under multiplication. This means that for any three quaternions, p = p0 + p1i + p2j + p3k, q = q0 + q1i + q2j + q3k, and r = r0 + r1i + r2j + r3k, the order in which the quaternions are grouped together under multiplication does not matter: (pq)r = (p0q0 + p0q + q0p + pq)(r0 + r) = p0q0r0 + p0q0r + p0r0q + p0qr + q0r0p + q0pr + r0pq + pqr: Factoring p0 out of the first four terms and p out of the last four terms, (pq)r = p0(q0r0 + q0r + r0q + qr) + p(q0r0 + q0r + r0q + qr) = (p0 + p)(q0r0 + q0r + r0q + qr): By definition, qr = q0r0 + q0r + r0q + qr. Thus, (pq)r = p(qr) (1.3.3.1) and it has been shown that quaternions are associative under multiplication. 6 1.3.4 Implications of i2 = j2 = k2 = ijk = −1 The relationships i2 = j2 = k2 = ijk = −1 must always hold; some important relationships that follow from these statements will now be derived. Since i2 = ii = ijk = −1, this implies that i = jk: (1.3.4.1) Similarly, since k2 = kk = ijk = −1, then k = ij: (1.3.4.2) Using equation (1.3.4.2) and multiplying by j on the right, k(j) = ij(j) kj = i(jj) = i(j2) = i(−1) = −i so i = −kj: (1.3.4.3) From equations (1.3.4.1) and (1.3.4.3), the following relationships can be found for i: i = jk = −kj: Using equation (1.3.4.1) and multiplying on the left by j, (j)i = (j)jk ji = (jj)k = (j2)k = (−1)k = −k so k = −ji: (1.3.4.4) From equation (1.3.4.2) and (1.3.4.4), the following relationships are found for k: k = ij = −ji: Using equation (1.3.4.4) and multiplying on the right by i, k(i) = −ji(i) ki = −j(ii) = −j(i2) = −j(−1) = j: Thus, j = ki: (1.3.4.5) Using equation (1.3.4.2) and multiplying on the left by i, (i)k = (i)ij 7 ik = (ii)j = (i2)j = (−1)j = −j: Hence, j = −ik: (1.3.4.6) From equations (1.3.4.5) and (1.3.4.6), the following relationships are found for j: j = ki = −ik: To summarize, when multiplying two quaternions together, the relationships i2 = j2 = k2 = ijk = −1 must always hold.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    39 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us