Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Quaternions and spatial rotation
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Correspondence between quaternions and 3D rotations}}[[unit vector|Unit]] [[quaternion]]s, known as [[versor|''versors'']], provide a convenient [[mathematics|mathematical]] notation for representing spatial [[Orientation (geometry)|orientation]]s and [[rotation]]s of elements in three dimensional space. Specifically, they encode information about an [[Axis–angle representation|axis-angle rotation]] about an arbitrary axis. Rotation and orientation quaternions have applications in [[computer graphics]],<ref name="Shoemake">{{cite journal|last=Shoemake|first=Ken|year=1985|title=Animating Rotation with Quaternion Curves|url=https://www.cs.cmu.edu/~kiranb/animation/p245-shoemake.pdf|journal=Computer Graphics|volume=19|issue=3|pages=245–254|doi=10.1145/325165.325242}} Presented at [[SIGGRAPH]] '85.</ref> [[computer vision]], [[robotics]],<ref>J. M. McCarthy, 1990, [https://books.google.com/books?id=glOqQgAACAAJ&q=introduction+to+theoretical+kinematics ''Introduction to Theoretical Kinematics''], MIT Press</ref> [[navigation]], [[molecular dynamics]], [[flight dynamics]],<ref>Amnon Katz (1996) ''Computational Rigid Vehicle Dynamics'', [[Krieger Publishing]] {{isbn|978-1575240169}}</ref> [[orbital mechanics]] of [[satellite]]s,<ref>J. B. Kuipers (1999) ''Quaternions and rotation Sequences: a Primer with Applications to Orbits, Aerospace, and Virtual Reality'', [[Princeton University Press]] {{isbn|978-0-691-10298-6}}</ref> and [[Texture (crystalline)|crystallographic texture]] analysis.<ref name="Lunze">{{cite journal|author=Karsten Kunze, Helmut Schaeben|date=November 2004|title=The Bingham Distribution of Quaternions and Its Spherical Radon Transform in Texture Analysis|journal=Mathematical Geology|volume=36|issue=8|pages=917–943|bibcode=<!-- -->|doi=10.1023/B:MATG.0000048799.56445.59|id={{ResearchGatePub|226385995}} }}</ref> When used to represent rotation, unit quaternions are also called '''rotation quaternions''' as they represent the [[3D rotation group]]. When used to represent an [[Orientation (geometry)|orientation]] (rotation relative to a reference coordinate system), they are called '''orientation quaternions''' or '''attitude quaternions'''. A spatial rotation around a fixed point of <math>\theta</math> radians about a unit axis <math>(X,Y,Z)</math> that denotes the ''Euler axis'' is given by the quaternion <math>(C, X \, S, Y \, S, Z \, S)</math>, where <math>C = \cos(\theta/2)</math> and <math>S=\sin(\theta/2)</math>. Compared to [[Rotation matrix|rotation matrices]], quaternions are more compact, efficient, and [[numerically stable]]. Compared to [[Euler angles]], they are simpler to [[function composition|compose]]. However, they are not as intuitive and easy to understand and, due to the [[Periodic function|periodic nature]] of [[sine]] and cosine, rotation angles differing precisely by the natural period will be encoded into identical quaternions and recovered angles in [[radian]]s will be limited to <math>[0,2\pi]</math>. {{TOC limit|3}} == Using quaternions as rotations == {{More citations needed section|date=January 2022}}[[Image:Euler_AxisAngle.svg|thumb|right|3D visualization of a sphere and a rotation about {{Not a typo|an}} Euler axis (<math>\hat{e}</math>) by an angle of <math>\theta</math>]] In 3-dimensional space, according to [[Euler's rotation theorem]], any rotation or sequence of rotations of a rigid body or coordinate system about a fixed point is equivalent to a single rotation by a given angle <math>\theta</math> about a fixed axis (called the ''Euler axis'') that runs through the fixed point.<ref> Euclidean and non-Euclidean Geometry. Patrick J. Ryan, Cambridge University Press, Cambridge, 1987.</ref> The Euler axis is typically represented by a [[unit vector]] <math>\vec{u}</math> (<math>\hat{e}</math> in the picture). Therefore, any rotation in three dimensions can be represented as a [[Vector (mathematics and physics)|vector]] <math>\vec{u}</math> and an angle <math>\theta</math>. Quaternions give a simple way to encode this <ref>I.L. Kantor. Hypercomplex numbers, Springer-Verlag, New York, 1989. </ref> [[axis–angle representation]] using four real numbers, and can be used to apply (calculate) the corresponding rotation to a [[Position (vector)|position vector]] {{Math|(x,y,z)}}, representing a [[Point (geometry)|point]] relative to the [[Origin (mathematics)|origin]] in [[real coordinate space|{{math|'''R'''{{sup|3}}}}]]. [[Euclidean vector]]s such as {{math|(2, 3, 4)}} or {{math|(''a''{{sub|''x''}}, ''a''{{sub|''y''}}, ''a''{{sub|''z''}})}} can be rewritten as {{math|2 '''i''' + 3 '''j''' + 4 '''k'''}} or {{math|''a''{{sub|''x''}} '''i''' + ''a''{{sub|''y''}} '''j''' + ''a''{{sub|''z''}} '''k'''}}, where {{math|'''i'''}}, {{math|'''j'''}}, {{math|'''k'''}} are unit vectors representing the three [[Cartesian coordinate system|Cartesian axes]] (traditionally {{math|'''x'''}}, {{math|'''y'''}}, {{math|'''z'''}}), and also obey the multiplication rules of the fundamental quaternion units by interpreting the Euclidean vector {{math|(''a''{{sub|''x''}}, ''a''{{sub|''y''}}, ''a''{{sub|''z''}})}} as the vector part of the pure quaternion {{math|(0, ''a''{{sub|''x''}}, ''a''{{sub|''y''}}, ''a''{{sub|''z''}})}}. A rotation of angle <math>\theta</math> around the axis defined by the unit vector : <math>\mathbf{u} = (u_x, u_y, u_z) = u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}</math> can be represented by [[Conjugacy_class|conjugation]] by a unit quaternion {{math|'''q'''}}. Since the quaternion product <math>\ (0 + u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k})(0 - u_x\mathbf{i} - u_y\mathbf{j} - u_z\mathbf{k})</math> gives 1, using the [[Taylor series]] of the exponential function, the [[Pauli matrices|extension]] of [[Euler's formula]] results: : <math> \mathbf{q} = e^{\frac{\theta}{2}{(u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k})}} = \cos \frac{\theta}{2} + (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) \sin \frac{\theta}{2} = \cos \frac{\theta}{2} + \mathbf u \sin \frac{\theta}{2} </math> It can be shown<ref>Andrew J. Hanson. Visualizing Quaternions, Morgan Kaufmann Publishers, Amsterdam, 2006.</ref> that the desired rotation can be applied to an ordinary vector <math>\mathbf{p} = (p_x, p_y, p_z) = p_x\mathbf{i} + p_y\mathbf{j} + p_z\mathbf{k}</math> in 3-dimensional space, considered as the vector part of the pure quaternion <math>\mathbf{p'}</math>, by evaluating the [[Conjugacy_class|conjugation]] of {{math|{{prime|'''p'''}}}} by {{math|'''q'''}}, given by: : <math>L(\mathbf{p'}) := \mathbf{q} \mathbf{p'} \mathbf{q}^{-1} = (0, \mathbf r),</math> : <math>\mathbf r = (\cos^2\frac{\theta}{2}-\sin^2\frac{\theta}{2}||\mathbf u||^2)\mathbf p + 2\sin^2\frac{\theta}{2} (\mathbf u \cdot \mathbf p)\mathbf u + 2\cos\frac{\theta}{2}\sin\frac{\theta}{2}(\mathbf u \times \mathbf p), </math> using the [[Hamilton product]], where the vector part of the pure quaternion {{math|1=L({{prime|'''p'''}}) = (0, ''r''{{sub|''x''}}, ''r''{{sub|''y''}}, ''r''{{sub|''z''}})}} is the new position vector of the point after the rotation. In a programmatic implementation, the conjugation is achieved by constructing a pure quaternion whose vector part is {{math|'''p'''}}, and then performing the quaternion conjugation. The vector part of the resulting pure quaternion is the desired vector {{math|'''r'''}}. Clearly, <math>L</math> provides a linear transformation of the quaternion space to itself;<ref>J.H. Conway and D.A. Smith. On Quaternions and Octonions, A.K. Peters, Natick, MA, 2003.</ref> also, since <math>\mathbf q </math> is unitary, the transformation is an isometry. Also, <math>L(\mathbf q) = \mathbf q </math> and so <math>L</math> leaves vectors parallel to <math>\mathbf q</math> invariant. So, by decomposing <math>\mathbf p </math> as a vector parallel to the vector part <math>(u_x, u_y, u_z)\sin \frac{\theta}{2}</math> of <math>\mathbf q </math> and a vector normal to the vector part of <math>\mathbf q </math> and showing that the application of <math>L</math> to the normal component of <math>\mathbf p</math> rotates it, the claim is shown. So let <math>\mathbf n</math> be the component of <math>\mathbf p</math> orthogonal to the vector part of <math>\mathbf q</math> and let <math>\mathbf n_T = \mathbf n \times \mathbf u </math>. It turns out that the vector part of <math>L(0, \mathbf n)</math> is given by :<math>\left(\cos^2\frac{\theta}{2} -\sin^2\frac{\theta}{2}\right) \mathbf{n} + 2 \left(\cos\frac{\theta}{2}\sin\frac{\theta}{2} \right)\mathbf{n}_T = \cos\theta \mathbf{n} + \sin\theta \mathbf{n}_T</math>. The conjugation of {{math|{{prime|'''p'''}}}} by {{math|'''q'''}} can be expressed with fewer arithmetic operations as: : <math>\mathbf{r} = \mathbf{p} + 2\cos\frac{\theta}{2}\sin\frac{\theta}{2}(\mathbf u \times \mathbf p) + 2 \sin^2\frac{\theta}{2} \mathbf u \times (\mathbf u \times \mathbf p) .</math> A geometric fact independent of quaternions is the existence of a two-to-one mapping from physical rotations to rotational transformation matrices. If 0 ⩽ <math>\theta</math> ⩽ <math>2\pi</math>, a physical rotation about <math>\vec{u}</math> by <math>\theta</math> and a physical rotation about <math>-\vec{u}</math> by <math>2\pi-\theta</math> both achieve the same final orientation by disjoint paths through intermediate orientations. By inserting those vectors and angles into the formula for {{math|'''q'''}} above, one finds that if {{math|'''q'''}} represents the first rotation, {{math|−'''q'''}} represents the second rotation. This is a geometric proof that conjugation by {{math|'''q'''}} and by {{math|−'''q'''}} must produce the same rotational transformation matrix. That fact is confirmed algebraically by noting that the conjugation is quadratic in {{math|'''q'''}}, so the sign of {{math|'''q'''}} cancels, and does not affect the result. (See [[3D rotation group#Connection_between_SO(3)_and_SU(2)|2:1 mapping of SU(2) to SO(3)]]) If both rotations are a half-turn <math>(\theta=\pi)</math>, both {{math|'''q'''}} and {{math|−'''q'''}} will have a real coordinate equal to zero. Otherwise, one will have a positive real part, representing a rotation by an angle less than <math>\pi</math>, and the other will have a negative real part, representing a rotation by an angle greater than <math>\pi</math>. Mathematically, this operation carries the ''set'' of all "pure" quaternions {{math|'''p'''}} (those with real part equal to zero)—which constitute a 3-dimensional space among the quaternions—into itself, by the desired rotation about the axis {{math|'''''u'''''}}, by the angle {{mvar|θ}}. (Each real quaternion is carried into itself by this operation. But for the purpose of rotations in 3-dimensional space, we ignore the real quaternions.) The rotation is clockwise if our line of sight points in the same direction as <math>\vec{u}</math>. In this (which?) instance, {{math|'''q'''}} is a [[unit quaternion]] and : <math> \mathbf{q}^{-1} = e^{-\frac{\theta}{2}{(u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k})}} = \cos \frac{\theta}{2} - (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) \sin \frac{\theta}{2} .</math> It follows that conjugation by the product of two quaternions is the composition of conjugations by these quaternions: If {{math|'''p'''}} and {{math|'''q'''}} are unit quaternions, then rotation (conjugation) by {{math|'''pq'''}} is :<math>\mathbf{p q} \vec{v} (\mathbf{p q})^{-1} = \mathbf{p q} \vec{v} \mathbf{q}^{-1} \mathbf{p}^{-1} = \mathbf{p} (\mathbf{q} \vec{v} \mathbf{q}^{-1}) \mathbf{p}^{-1}</math>, which is the same as rotating (conjugating) by {{math|'''q'''}} and then by {{math|'''p'''}}. The scalar component of the result is necessarily zero. The quaternion inverse of a rotation is the opposite rotation, since <math>\mathbf{q}^{-1} (\mathbf{q} \vec{v} \mathbf{q}^{-1}) \mathbf{q} = \vec{v}</math>. The square of a quaternion rotation is a rotation by twice the angle around the same axis. More generally {{math|'''q'''{{sup|''n''}}}} is a rotation by {{mvar|n}} times the angle around the same axis as {{math|'''q'''}}. This can be extended to arbitrary real {{mvar|n}}, allowing for smooth interpolation between spatial orientations; see [[Slerp]]. Two rotation quaternions can be combined into one equivalent quaternion by the relation: : <math>\mathbf{q}' = \mathbf{q}_2 \mathbf{q}_1 </math> in which {{math|{{prime|'''q'''}}}} corresponds to the rotation {{math|'''q'''{{sub|1}}}} followed by the rotation {{math|'''q'''{{sub|2}}}}. Thus, an arbitrary number of rotations can be composed together and then applied as a single rotation. (Note that quaternion multiplication is not [[commutative]].) === Example conjugation operation === [[File:Diagonal rotation.png|250px|thumb|right|A rotation of 120° around the ''first diagonal'' permutes {{math|'''i'''}}, {{math|'''j'''}}, and {{math|'''k'''}} cyclically]] ''Conjugating'' {{math|'''p'''}} ''by'' {{math|'''q'''}} refers to the operation {{math|'''p''' ↦ '''qpq'''{{sup|−1}}}}. Consider the rotation {{mvar|f}} around the axis <math>\vec{v} = \mathbf{i} + \mathbf{j} + \mathbf{k}</math>, with a rotation angle of 120°, or {{sfrac|2{{pi}}|3}} [[radian]]s. <!-- clever! --> :<math>\alpha = \frac{2 \pi}{3}</math> [[File:Versor action on Hurwitz quaternions.svg|thumb|right|{{math|'''p''' ↦ '''q p'''}} for {{math|1='''q''' = {{sfrac|1 + ''i'' + ''j'' + ''k''|2}}}} on the unit [[3-sphere]]. Note this one-sided (namely, [[left and right (algebra)|left]]) multiplication yields a 60° rotation of quaternions]] The length of <math>\vec{v}</math> is {{sqrt|3}}, the half angle is {{sfrac|π|3}} (60°) with [[cosine]] {{sfrac|1|2}}, ({{math|1=cos 60° = 0.5}}) and [[sine]] {{sfrac|{{sqrt|3}}|2}}, ({{math|1=sin 60° ≈ 0.866}}). We are therefore dealing with a conjugation by the unit quaternion :<math>\begin{align} u &= \cos\frac{\alpha}{2} + \sin\frac{\alpha}{2}\cdot \frac{1}{\| \vec{v} \| }\vec{v}\\ &= \cos \frac{\pi}{3} + \sin \frac{\pi}{3}\cdot \frac{1}{\sqrt{3}}\vec{v}\\ &= \frac{1}{2} + \frac{\sqrt{3}}{2}\cdot \frac{1}{\sqrt{3}}\vec{v}\\ &= \frac{1}{2} + \frac{\sqrt{3}}{2}\cdot \frac{\mathbf{i}+\mathbf{j}+\mathbf{k}}{\sqrt{3}}\\ &= \frac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2} \end{align}</math> If {{mvar|f}} is the rotation function, :<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = u (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) u^{-1}</math> It can be proven that the inverse of a unit quaternion is obtained simply by [[additive inverse|changing the sign]] of its imaginary components. As a consequence, :<math>u^{-1} = \dfrac{1- \mathbf{i} - \mathbf{j} - \mathbf{k}}{2}</math> and :<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = \dfrac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2}(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) \dfrac{1 - \mathbf{i} - \mathbf{j} - \mathbf{k}}{2}</math> This can be simplified, using the ordinary rules for quaternion arithmetic, to :<math>f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = c\mathbf{i} + a\mathbf{j} + b\mathbf{k}</math> As expected, the rotation corresponds to keeping a [[cube]] held fixed at one point, and rotating it 120° about the long diagonal through the fixed point (observe how the three axes are [[cyclic permutation|permuted cyclically]]). === Quaternion-derived rotation matrix === A quaternion rotation <math>\mathbf{p'} = \mathbf{q} \mathbf{p} \mathbf{q}^{-1}</math> (with <math>\mathbf{q} = q_r + q_i \mathbf{i} + q_j \mathbf{j} + q_k \mathbf{k}</math>) can be algebraically manipulated into a [[Rotation matrix#Quaternion|matrix rotation]] <math>\mathbf{p'} = \mathbf{R p}</math>, where <math>\mathbf{R}</math> is the [[rotation matrix]] given by:<ref>{{cite web|title=comp.graphics.algorithms FAQ|url=http://www.faqs.org/faqs/graphics/algorithms-faq/|access-date=2 July 2017}}</ref> : <math>\mathbf{R} = \begin{bmatrix} 1 - 2s(q_j^2 + q_k^2) & 2s (q_i q_j - q_k q_r) & 2s (q_i q_k + q_j q_r) \\ 2s (q_i q_j + q_k q_r) & 1 - 2s(q_i^2 + q_k^2) & 2s (q_j q_k - q_i q_r) \\ 2s (q_i q_k - q_j q_r) & 2s (q_j q_k + q_i q_r) & 1 - 2s(q_i^2 + q_j^2) \end{bmatrix} </math> Here <math>s = \|q\|^{-2}</math> and if {{mvar|q}} is a unit quaternion, <math>s = 1^{-2} = 1</math>. This can be obtained by using [[vector calculus]] and [[linear algebra]] if we express <math>\mathbf p</math> and <math>\mathbf q</math> as [[Quaternion#Scalar and vector parts|scalar and vector parts]] and use the formula for the multiplication operation in the equation <math>\mathbf{p'} = \mathbf{q} \mathbf{p} \mathbf{q}^{-1}</math>. If we write <math>\mathbf p</math> as <math>\left(0,\ \mathbf p\right)</math>, <math>\mathbf p'</math> as <math>\left(0,\ \mathbf p'\right)</math> and <math>\mathbf q</math> as <math>\left(q_r,\ \mathbf v\right)</math>, where <math>\mathbf v = \left(q_i, q_j, q_k\right)</math>, our equation turns into <math>\left(0,\ \mathbf p'\right) = \left(q_r,\ \mathbf v\right) \left(0,\ \mathbf p\right) s\left(q_r,\ -\mathbf v\right)</math>. By using the formula for multiplication of two quaternions that are expressed as scalar and vector parts, :<math>\left(r_1,\ \vec{v}_1\right) \left(r_2,\ \vec{v}_2\right) = \left(r_1 r_2 - \vec{v}_1 \cdot \vec{v}_2,\ r_1\vec{v}_2 + r_2\vec{v}_1 + \vec{v}_1\times\vec{v}_2\right),</math> this equation can be rewritten as :<math>\begin{align} (0,\ \mathbf p') = &((q_r,\ \mathbf v) (0,\ \mathbf p)) s(q_r,\ -\mathbf v) \\ = &(q_r 0 - \mathbf v \cdot \mathbf p,\ q_r\mathbf p + 0\mathbf v + \mathbf v \times \mathbf p)s(q_r,\ -\mathbf v) \\ = &s(-\mathbf v \cdot \mathbf p,\ q_r\mathbf p + \mathbf v \times \mathbf p)(q_r,\ -\mathbf v) \\ = &s(-\mathbf v \cdot \mathbf p q_r - (q_r\mathbf p + \mathbf v \times \mathbf p)\cdot(-\mathbf v),\ (-\mathbf v \cdot \mathbf p)(-\mathbf v) + q_r(q_r\mathbf p + \mathbf v \times \mathbf p) + (q_r\mathbf p + \mathbf v \times \mathbf p)\times(-\mathbf v)) \\ = &s\left(-\mathbf v \cdot \mathbf p q_r + q_r\mathbf v \cdot \mathbf p,\ \mathbf v\left(\mathbf v \cdot \mathbf p\right) + q_r^2\mathbf p + q_r\mathbf v \times \mathbf p + \mathbf v \times \left(q_r \mathbf p + \mathbf v \times \mathbf p\right)\right) \\ = &\left(0,\ s\left(\mathbf v \otimes \mathbf v + q_r^2\mathbf{I} + 2 q_r[\mathbf v]_{\times} + [\mathbf v]_{\times}^2\right) \mathbf p\right), \end{align}</math> where <math>\otimes</math> denotes the [[outer product]], <math>\mathbf{I}</math> is the [[identity matrix]] and <math>[\mathbf v]_{\times}</math> is the transformation matrix that when multiplied from the right with a vector <math>\mathbf u</math> gives the [[Cross product#Conversion to matrix multiplication|cross product]] <math>\mathbf v \times \mathbf u</math>. Since <math>\mathbf p' = \mathbf{R}\mathbf p</math>, we can identify <math>\mathbf{R}</math> as <math>s\left(\mathbf v \otimes \mathbf v + q_r^2\mathbf{I} + 2 q_r[\mathbf v]_{\times} + [\mathbf v]_{\times}^2\right)</math>, which upon expansion should result in the expression written in matrix form above. === Recovering the axis-angle representation === The expression <math>\mathbf{q} \mathbf{p} \mathbf{q}^{-1}</math> rotates any [[vector quaternion]] <math>\mathbf{p}</math> around an axis given by the vector <math>\mathbf{a}</math> by the angle <math>\theta</math>, where <math>\mathbf{a}</math> and <math>\theta</math> depends on the quaternion <math>\mathbf{q} = q_r + q_i \mathbf{i} + q_j \mathbf{j} + q_k \mathbf{k}</math>. <math>\mathbf{a}</math> and <math>\theta</math> can be found from the following equations: :<math>\begin{align} (a_x, a_y, a_z) ={} &\frac{(q_i, q_j, q_k)}{\sqrt{q_i^2 + q_j^2 + q_k^2}} \\[2pt] \theta = 2 \operatorname{atan2} &\left(\sqrt{q_i^2 + q_j^2 + q_k^2},\, q_r \right), \end{align}</math> where <math>\operatorname{atan2}</math> is the [[atan2|two-argument arctangent]]. While <math>\theta = 2 \operatorname{acos} (q_r)</math> works, it is numerically unstable (inaccurate) near <math>q_r = \pm1</math> for numbers with finite precision. Care should be taken when the quaternion approaches a [[scalar quaternion|scalar]], since due to [[degeneracy (mathematics)|degeneracy]] the axis of an identity rotation is not well-defined. ===The composition of spatial rotations=== A benefit of the quaternion formulation of the composition of two rotations {{math|''R''{{sub|''B''}}}} and {{math|''R''{{sub|''A''}}}} is that it yields directly the [[Axis of rotation|rotation axis]] and angle of the composite rotation {{math|1=''R''{{sub|''C''}} = ''R''{{sub|''B''}}''R''{{sub|''A''}}}}. Let the quaternion associated with a spatial rotation {{mvar|R}} be constructed from its [[axis of rotation|rotation axis]] {{math|'''S'''}} with the rotation angle <math>\varphi</math> around this axis. The associated quaternion is given by <math display="block"> S = \cos\frac{\varphi}{2} + \mathbf{S}\sin\frac{\varphi}{2}. </math> Then the composition of the rotation {{math|''R''{{sub|''B''}}}} with {{math|''R''{{sub|''A''}}}} is the rotation {{math|1=''R''{{sub|''C''}} = ''R''{{sub|''B''}}''R''{{sub|''A''}}}} with rotation axis and angle defined by the product of the quaternions <math display="block"> A = \cos\frac{\alpha}{2} + \mathbf{A}\sin\frac{\alpha}{2} \quad \text{and} \quad B = \cos\frac{\beta}{2} + \mathbf{B}\sin\frac{\beta}{2}, </math> that is <math display="block"> C = \cos\frac{\gamma}{2} + \mathbf{C}\sin\frac{\gamma}{2} = \left(\cos\frac{\beta}{2} + \mathbf{B} \sin\frac{\beta}{2}\right) \left(\cos\frac{\alpha}{2} + \mathbf{A}\sin\frac{\alpha}{2}\right). </math> Expand this product to obtain <math display="block"> \cos\frac{\gamma}{2} + \mathbf{C}\sin\frac{\gamma}{2} = \left( \cos\frac{\beta}{2} \cos\frac{\alpha}{2} - \mathbf{B} \cdot \mathbf{A} \sin\frac{\beta}{2} \sin\frac{\alpha}{2}\right) + \left(\mathbf{B} \sin\frac{\beta}{2} \cos\frac{\alpha}{2} + \mathbf{A} \sin\frac{\alpha}{2} \cos\frac{\beta}{2} + \mathbf{B} \times \mathbf{A} \sin\frac{\beta}{2} \sin\frac{\alpha}{2} \right). </math> Divide both sides of this equation by the identity, which is the [[spherical law of cosines|law of cosines on a sphere]], <math display="block">\cos\frac{\gamma}{2} = \cos\frac{\beta}{2} \cos\frac{\alpha}{2} - \mathbf{B} \cdot \mathbf{A} \sin\frac{\beta}{2} \sin\frac{\alpha}{2},</math> and compute <math display="block"> \mathbf{C} \tan\frac{\gamma}{2} = \frac{ \mathbf{B} \tan\frac{\beta}{2} + \mathbf{A} \tan\frac{\alpha}{2} + \mathbf{B} \times \mathbf{A} \tan\frac{\beta}{2}\tan\frac{\alpha}{2} }{1 - \mathbf{B} \cdot \mathbf{A} \tan\frac{\beta}{2}\tan\frac{\alpha}{2}}. </math> This is Rodrigues' formula for the axis of a composite rotation defined in terms of the axes of the two rotations. He derived this formula in 1840 (see page 408).<ref>{{cite journal |last=Rodrigues |first=O. |year=1840 |title=Des lois géométriques qui régissent les déplacements d'un système solide dans l'espace, et la variation des coordonnées provenant de ses déplacements considérés indépendamment des causes qui peuvent les produire |url=http://www.numdam.org/item/JMPA_1840_1_5__380_0/ |journal=Journal de Mathématiques Pures et Appliquées |series=Série 1 |volume=5 |pages=380–440}} :Translated in {{cite arXiv |eprint=2211.07787 |last1=Friedberg |first1=Richard |title=Rodrigues, Olinde: "Des lois géométriques qui régissent les déplacements d'un système solide...", translation and commentary |date=2022 |class=math.HO }}</ref> The three rotation axes {{math|'''A'''}}, {{math|'''B'''}}, and {{math|'''C'''}} form a spherical triangle and the dihedral angles between the planes formed by the sides of this triangle are defined by the rotation angles. Hamilton<ref name="Hamilton">[[William Rowan Hamilton]] (1844 to 1850) [http://www.maths.tcd.ie/pub/HistMath/People/Hamilton/OnQuat/ On quaternions or a new system of imaginaries in algebra], [[Philosophical Magazine]], link to David R. Wilkins collection at [[Trinity College, Dublin]]</ref> presented the component form of these equations showing that the quaternion product computes the third vertex of a spherical triangle from two given vertices and their associated arc-lengths, which is also defines an algebra for points in [[Elliptic geometry]]. ====Axis–angle composition==== <!--While this isn't directly about quaternions, and should have its own page, I can only find the above formula on this page. The below is mostly algebraic rearrangement of the above--> The normalized rotation axis, removing the <math display="inline">\cos\frac{\gamma}{2}</math> from the expanded product, leaves the vector which is the rotation axis, times some constant. Care should be taken normalizing the axis vector when <math>\gamma</math> is <math>0</math> or <math>k 2\pi</math> where the vector is near <math>0</math>; which is identity, or 0 rotation around any axis. <math display="block">\begin{align} \gamma &= 2\cos^{-1}\left(\cos\frac{\beta}{2} \cos\frac{\alpha}{2} - \mathbf{B} \cdot \mathbf{A} \sin\frac{\beta}{2} \sin\frac{\alpha}{2}\right) \\ \mathbf{D} &= \mathbf{B} \sin\frac{\beta}{2} \cos\frac{\alpha}{2} + \mathbf{A} \sin\frac{\alpha}{2} \cos\frac{\beta}{2} + \mathbf{B} \times \mathbf{A} \sin\frac{\beta}{2} \sin\frac{\alpha}{2} \end{align}</math> Or with angle addition [[trigonometric substitution]]s... <math display="block">\begin{align} \gamma &= 2 \cos^{-1} \left(\left(1 - \mathbf{A} \cdot \mathbf{B}\right) \cos\frac{\beta - \alpha}{2} + \left(1 + \mathbf{A}\cdot \mathbf{B}\right) \cos\frac{\beta + \alpha}{2}\right) \\ \mathbf{D} &= \left(\sin\frac{\beta + \alpha}{2} + \sin\frac{\beta - \alpha}{2}\right) \mathbf{A} + \left(\sin\frac{\beta + \alpha}{2} - \sin\frac{\beta - \alpha}{2}\right) \mathbf{B} + \left(\cos\frac{\beta - \alpha}{2} - \cos\frac{\beta + \alpha}{2}\right) \mathbf{B} \times \mathbf{A} \end{align}</math> finally normalizing the rotation axis: <math display="inline">\frac{\mathbf{D}}{2 \sin\frac{1}{2}\gamma}</math> or <math display="inline">\frac{\mathbf{D}}{\|\mathbf{D}\|}</math>. === Differentiation with respect to the rotation quaternion === The rotated quaternion {{math|1='''p' = q p q'''{{sup|−1}}}} needs to be differentiated with respect to the rotating quaternion {{math|'''q'''}}, when the rotation is estimated from numerical optimization. The estimation of rotation angle is an essential procedure in 3D object registration or camera calibration. For unitary {{math|'''q'''}} and pure imaginary {{math|'''p'''}}, that is for a rotation in 3D space, the derivatives of the rotated quaternion can be represented using [[matrix calculus]] notation as :<math>\begin{align} \frac{\partial \mathbf{p'}}{\partial \mathbf{q}} \equiv \left[\frac{\partial \mathbf{p'}}{\partial q_0},\frac{\partial \mathbf{p'}}{\partial q_x},\frac{\partial \mathbf{p'}}{\partial q_y},\frac{\partial \mathbf{p'}}{\partial q_z} \right] = \left[ \mathbf{pq}-(\mathbf{pq})^*,(\mathbf{pqi})^*-\mathbf{pqi},(\mathbf{pqj})^*-\mathbf{pqj},(\mathbf{pqk})^*-\mathbf{pqk} \right]. \end{align}</math> A derivation can be found in.<ref>{{Citation|last=Lee|first=Byung-Uk|chapter=Differentiation with Quaternions, Appendix B|date=1991|chapter-url=http://home.ewha.ac.kr/~bulee/quaternion.pdf|type=Ph. D. thesis |title=Stereo Matching of Skull Landmarks|publisher=Stanford University|pages=57–58}}</ref> == Background == ===Quaternions=== {{Main|Quaternions}} The [[complex numbers]] can be defined by introducing an abstract symbol {{math|'''i'''}} which satisfies the usual rules of algebra and additionally the rule {{math|1='''i'''{{sup|2}} = −1}}. This is sufficient to reproduce all of the rules of complex number arithmetic: for example: : <math>(a+b\mathbf{i})(c+d\mathbf{i}) = ac + ad\mathbf{i} + b\mathbf{i}c + b\mathbf{i}d\mathbf{i} = ac + ad\mathbf{i} + bc\mathbf{i} + bd\mathbf{i}^2 = (ac - bd) + (bc + ad) \mathbf{i}.</math> In the same way the quaternions can be defined by introducing abstract symbols {{math|'''i'''}}, {{math|'''j'''}}, {{math|'''k'''}} which satisfy the rules {{math|1='''i'''{{sup|2}} = '''j'''{{sup|2}} = '''k'''{{sup|2}} = '''i j k''' = −1}} and the usual algebraic rules ''except'' the [[commutative law]] of multiplication (a familiar example of such a noncommutative multiplication is [[matrix multiplication]]). From this all of the rules of quaternion arithmetic follow, such as the [[Quaternion#Multiplication of basis elements|rules on multiplication of quaternion basis elements]]. Using these rules, one can show that: : <math>\begin{align} &(a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}) (e + f\mathbf{i} + g\mathbf{j} + h\mathbf{k}) = \\ &(ae - bf - cg - dh) + (af + be + ch - dg) \mathbf{i} + (ag - bh + ce + df) \mathbf{j} + (ah + bg - cf + de) \mathbf{k}. \end{align}</math> The imaginary part <math>b\mathbf{i} + c\mathbf{j} + d\mathbf{k}</math> of a quaternion behaves like a vector <math>\vec{v} = (b,c,d)</math> in three-dimensional [[vector space]], and the real part {{mvar|a}} behaves like a [[scalar (mathematics)|scalar]] in {{math|'''R'''}}. When quaternions are used in geometry, it is more convenient to define them as [[Classical Hamiltonian quaternions#Quaternion|a scalar plus a vector]]: : <math>a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k} = a + \vec{v}.</math> Some might find it strange to add a ''number'' to a ''vector'', as they are objects of very different natures, or to ''multiply'' two vectors together, as this operation is usually undefined. However, if one remembers that it is a mere notation for the real and imaginary parts of a quaternion, it becomes more legitimate. In other words, the correct reasoning is the addition of two quaternions, one with zero vector/imaginary part, and another one with zero scalar/real part: :<math>q_1 = s + \vec{v} = \left(s, \vec{0}\right) + \left(0, \vec{v}\right).</math> We can express quaternion multiplication in the modern language of vector [[cross product|cross]] and [[dot product]]s (which were actually inspired by the quaternions in the first place<ref>{{cite journal|last1=Altmann|first1=Simon L.|title=Hamilton, Rodrigues, and the Quaternion Scandal|journal=Mathematics Magazine|volume=62|issue=5|page=306|doi=10.2307/2689481|jstor=2689481|year=1989}}</ref>). When multiplying the vector/imaginary parts, in place of the rules {{math|1='''i'''{{sup|2}} = '''j'''{{sup|2}} = '''k'''{{sup|2}} = '''ijk''' = −1}} we have the quaternion multiplication rule: : <math>\vec{v} \vec{w} = - \vec{v} \cdot \vec{w} + \vec{v} \times \vec{w},</math> where: * <math>\vec{v} \vec{w}</math> is the resulting quaternion, * <math>\vec{v} \times \vec{w}</math> is vector cross product (a vector), * <math>\vec{v} \cdot \vec{w}</math> is vector scalar product (a scalar). Quaternion multiplication is noncommutative (because of the cross product, which [[anticommutative property|anti-commutes]]), while scalar–scalar and scalar–vector multiplications commute. From these rules it follows immediately that (see {{slink| Quaternions|Quaternions and three-dimensional geometry}}): :<math>q_1 q_2 = \left(s + \vec{v}\right) \left(t + \vec{w}\right) = \left(s t - \vec{v} \cdot \vec{w}\right) + \left(s \vec{w} + t \vec{v} + \vec{v} \times \vec{w}\right).</math> The (left and right) multiplicative inverse or reciprocal of a nonzero quaternion is given by the conjugate-to-norm ratio ([[Quaternion#Conjugation, the norm, and reciprocal|see details]]): :<math>q_1^{-1} = \left(s + \vec{v}\right)^{-1} = \frac{\left(s + \vec{v}\right)^*}{\lVert s + \vec{v} \rVert^2} = \frac{s - \vec{v}}{s^2 + \lVert \vec{v} \rVert^2},</math> as can be verified by direct calculation (note the similarity to the [[multiplicative inverse#Complex numbers|multiplicative inverse of complex numbers]]). ===Rotation identity=== {{Main|Rodrigues' rotation formula}} Let <math>\vec{u}</math> be a unit vector (the rotation axis) and let <math>q = \cos \frac{\alpha}{2} + \vec{u} \sin \frac{\alpha}{2}</math>. Our goal is to show that :<math>\vec{v}' = q \vec{v} q^{-1} = \left( \cos \frac{\alpha}{2} + \vec{u} \sin \frac{\alpha}{2} \right) \, \vec{v} \, \left( \cos \frac{\alpha}{2} - \vec{u} \sin \frac{\alpha}{2} \right)</math> yields the vector <math>\vec{v}</math> rotated by an angle <math>\alpha</math> around the axis <math>\vec{u}</math>. Expanding out (and bearing in mind that <math>\vec{u}\vec{v} = \vec{u} \times \vec{v} - \vec{u} \cdot \vec{v}</math>), we have :<math>\begin{align} \vec{v}' &= \vec{v} \cos^2 \frac{\alpha}{2} + \left(\vec{u}\vec{v} - \vec{v}\vec{u}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \vec{u}\vec{v}\vec{u} \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \left(\left(\vec{u} \times \vec{v}\right) - \left(\vec{u} \cdot \vec{v}\right)\right)\vec{u} \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \left(\left(\vec{u} \times \vec{v}\right)\vec{u} - \left(\vec{u} \cdot \vec{v}\right)\vec{u}\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \left(\left(\left(\vec{u} \times \vec{v}\right) \times \vec{u} - \left(\vec{u} \times \vec{v}\right) \cdot \vec{u}\right) - \left(\vec{u} \cdot \vec{v}\right)\vec{u}\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \left(\left(\vec{v} - \left(\vec{u} \cdot \vec{v}\right)\vec{u}\right) - 0 - \left(\vec{u} \cdot \vec{v}\right)\vec{u}\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} - \left(\vec{v} - 2 \vec{u} \left(\vec{u} \cdot \vec{v}\right)\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} + \left(2 \vec{u} \left(\vec{u} \cdot \vec{v}\right) - \vec{v}\right) \sin^2 \frac{\alpha}{2} \\[6pt] \end{align}</math> If we let <math>\vec{v}_{\bot}</math> and <math>\vec{v}_{\|}</math> equal the components of <math>\vec{v}</math> perpendicular and parallel to <math>\vec{u}</math> respectively, then <math>\vec{v} = \vec{v}_{\bot} + \vec{v}_{\|}</math> and <math>\vec{u} \left(\vec{u} \cdot \vec{v}\right) = \vec{v}_{\|}</math>, leading to :<math>\begin{align} \vec{v}' &= \vec{v} \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} + \left(2 \vec{u} \left(\vec{u} \cdot \vec{v}\right) - \vec{v}\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \left(\vec{v}_{\|} + \vec{v}_{\bot}\right) \cos^2 \frac{\alpha}{2} + 2 \left(\vec{u} \times \vec{v}\right) \sin \frac{\alpha}{2} \cos \frac{\alpha}{2} + \left(\vec{v}_{\|} - \vec{v}_{\bot}\right) \sin^2 \frac{\alpha}{2} \\[6pt] &= \vec{v}_{\|} \left(\cos^2 \frac{\alpha}{2} + \sin^2 \frac{\alpha}{2}\right) + \left(\vec{u} \times \vec{v}\right) \left(2 \sin \frac{\alpha}{2} \cos \frac{\alpha}{2}\right) + \vec{v}_{\bot} \left(\cos^2 \frac{\alpha}{2} - \sin^2 \frac{\alpha}{2}\right) \\[6pt] \end{align}</math> Using the [[List of trigonometric identities|trigonometric pythagorean and double-angle identities]], we then have :<math>\begin{align} \vec{v}' &= \vec{v}_{\|} \left(\cos^2 \frac{\alpha}{2} + \sin^2 \frac{\alpha}{2}\right) + \left(\vec{u} \times \vec{v}\right) \left(2 \sin \frac{\alpha}{2} \cos \frac{\alpha}{2}\right) + \vec{v}_{\bot} \left(\cos^2 \frac{\alpha}{2} - \sin^2 \frac{\alpha}{2}\right) \\[6pt] &= \vec{v}_{\|} + \left(\vec{u} \times \vec{v}\right) \sin \alpha + \vec{v}_\bot \cos \alpha \end{align}</math> This is the [[Rodrigues' rotation formula|formula of a rotation]] by <math>\alpha</math> around the {{vec|''u''}} axis. == Quaternion rotation operations == A very formal explanation of the properties used in this section is given by Altman.<ref>Simon L. Altman (1986) ''Rotations, Quaternions, and Double Groups'', Dover Publications (see especially Ch. 12).</ref> ===The hypersphere of rotations=== {{main|3D rotation group}} ====Visualizing the space of rotations==== Unit quaternions represent the [[group (mathematics)|group]] of Euclidean [[rotation (mathematics)|rotations]] in [[three-dimensional space|three dimensions]] in a very straightforward way. The correspondence between rotations and quaternions can be understood by first visualizing the space of rotations itself. [[File:Space of rotations.png|250px|thumb|right|Two separate rotations, differing by both angle and axis, in the space of rotations. Here, the length of each axis vector is relative to the respective magnitude of the rotation about that axis.]] In order to visualize the space of rotations, it helps to consider a simpler case. Any rotation in three dimensions can be described by a rotation by some [[Angle of rotation|angle]] about some [[Axis of rotation|axis]]; for our purposes, we will use an axis ''vector'' to establish [[Orientation (vector space)|handedness]] for our angle. Consider the special case in which the axis of rotation lies in the ''xy'' plane. We can then specify the axis of one of these rotations by a point on a circle through which the vector crosses, and we can select the radius of the circle to denote the [[angle of rotation]]. Similarly, a rotation whose axis of rotation lies in the ''xy'' plane can be described as a point on a sphere of ''fixed'' radius in ''three'' dimensions. Beginning at the north pole of a sphere in three-dimensional space, we specify the point at the north pole to be the identity rotation (a zero angle rotation). Just as in the case of the identity rotation, no axis of rotation is defined, and the angle of rotation (zero) is irrelevant. A rotation having a very small rotation angle can be specified by a slice through the sphere parallel to the ''xy'' plane and very near the north pole. The circle defined by this slice will be very small, corresponding to the small angle of the rotation. As the rotation angles become larger, the slice moves in the negative {{mvar|z}} direction, and the circles become larger until the equator of the sphere is reached, which will correspond to a rotation angle of 180 degrees. Continuing southward, the radii of the circles now become smaller (corresponding to the absolute value of the angle of the rotation considered as a negative number). Finally, as the south pole is reached, the circles shrink once more to the identity rotation, which is also specified as the point at the south pole. Notice that a number of characteristics of such rotations and their representations can be seen by this visualization. The space of rotations is continuous, each rotation has a neighborhood of rotations which are nearly the same, and this neighborhood becomes flat as the neighborhood shrinks. Also, each rotation is actually represented by two antipodal points on the sphere, which are at opposite ends of a line through the center of the sphere. This reflects the fact that each rotation can be represented as a rotation about some axis, or, equivalently, as a negative rotation about an axis pointing in the opposite direction (a so-called [[Double covering group|double cover]]). The "latitude" of a circle representing a particular rotation angle will be half of the angle represented by that rotation, since as the point is moved from the north to south pole, the latitude ranges from zero to 180 degrees, while the angle of rotation ranges from 0 to 360 degrees. (the "longitude" of a point then represents a particular axis of rotation.) Note however that this set of rotations is not closed under composition. Two successive rotations with axes in the ''xy'' plane will not necessarily give a rotation whose axis lies in the ''xy'' plane, and thus cannot be represented as a point on the sphere. This will not be the case with a general rotation in 3-space, in which rotations do form a closed set under composition. [[File:Hypersphere of rotations.png|250px|thumb|right|The sphere of rotations for the rotations that have a "horizontal" axis (in the ''xy'' plane).]] This visualization can be extended to a general rotation in 3-dimensional space. The identity rotation is a point, and a small angle of rotation about some axis can be represented as a point on a sphere with a small radius. As the angle of rotation grows, the sphere grows, until the angle of rotation reaches 180 degrees, at which point the sphere begins to shrink, becoming a point as the angle approaches 360 degrees (or zero degrees from the negative direction). This set of expanding and contracting spheres represents a [[3-sphere|hypersphere in four dimensional space]] (a 3-sphere). Just as in the simpler example above, each rotation represented as a point on the hypersphere is matched by its antipodal point on that hypersphere. The "latitude" on the hypersphere will be half of the corresponding angle of rotation, and the neighborhood of any point will become "flatter" (i.e. be represented by a 3-D Euclidean space of points) as the neighborhood shrinks. This behavior is matched by the set of unit quaternions: A general quaternion represents a point in a four dimensional space, but constraining it to have unit magnitude yields a three-dimensional space equivalent to the surface of a hypersphere. The magnitude of the unit quaternion will be unity, corresponding to a hypersphere of unit radius. The vector part of a unit quaternion represents the radius of the 2-sphere corresponding to the axis of rotation, and its magnitude is the sine of half the angle of rotation. Each rotation is represented by two unit quaternions of opposite sign, and, as in the space of rotations in three dimensions, the quaternion product of two unit quaternions will yield a unit quaternion. Also, the space of unit quaternions is "flat" in any infinitesimal neighborhood of a given unit quaternion. ====Parameterizing the space of rotations==== We can parameterize the surface of a sphere with two coordinates, such as latitude and longitude. But latitude and longitude are ill-behaved ([[degeneracy (mathematics)|degenerate]] as described by the [[hairy ball theorem]]) at the north and south poles, though the poles are not intrinsically different from any other points on the sphere. At the poles (latitudes +90° and −90°), the longitude becomes meaningless. It can be shown that no two-parameter coordinate system can avoid such degeneracy. We can avoid such problems by embedding the sphere in three-dimensional space and parameterizing it with three Cartesian coordinates {{math|(''w'', ''x'', ''y'')}}, placing the north pole at {{math|1=(''w'', ''x'', ''y'') = (1, 0, 0)}}, the south pole at {{math|1=(''w'', ''x'', ''y'') = (−1, 0, 0)}}, and the equator at {{math|1=''w'' = 0}}, {{math|1=''x''{{sup|2}} + ''y''{{sup|2}} = 1}}. Points on the sphere satisfy the constraint {{math|1=''w''{{sup|2}} + ''x''{{sup|2}} + ''y''{{sup|2}} = 1}}, so we still have just two [[degrees of freedom (physics and chemistry)|degrees of freedom]] though there are three coordinates. A point {{math|(''w'', ''x'', ''y'')}} on the sphere represents a rotation in the ordinary space around the horizontal axis directed by the vector {{math|(''x'', ''y'', 0)}} by an angle <math>\alpha= 2 \cos^{-1} w = 2 \sin^{-1} \sqrt{x^2+y^2}</math>. In the same way the hyperspherical space of 3D rotations can be parameterized by three angles ([[Euler angles]]), but any such parameterization is degenerate at some points on the hypersphere, leading to the problem of [[gimbal lock]]. We can avoid this by using four Euclidean coordinates {{math|''w'', ''x'', ''y'', ''z''}}, with {{math|1=''w''{{sup|2}} + ''x''{{sup|2}} + ''y''{{sup|2}} + ''z''{{sup|2}} = 1}}. The point {{math|(''w'', ''x'', ''y'', ''z'')}} represents a rotation around the axis directed by the vector {{math|(''x'', ''y'', ''z'')}} by an angle <math>\alpha = 2 \cos^{-1} w = 2 \sin^{-1} \sqrt{x^2+y^2+z^2}.</math> == Explaining quaternions' properties with rotations == === Non-commutativity === [[File:Non-commutative rotation of dice.png|thumb|Non-commutative rotation of dice]] The multiplication of quaternions is [[non-commutative]]. This fact explains how the {{math|'''p''' ↦ '''q p q'''{{sup|−1}}}} formula can work at all, having {{math|1='''q q'''{{sup|[[multiplicative inverse|−1]]}} = 1}} by definition. Since the multiplication of unit quaternions corresponds to the composition of three-dimensional rotations, this property can be made intuitive by showing that three-dimensional rotations are not commutative in general. The figure to the right illustrates this with dice. Use the right hand to create a pair of 90 degree rotations. Both dice are initially configured as shown in the upper left-hand corner (with 1 dot on the top face.) Path A begins with a rotation about the {{math|–''y''}} axis (using the [[Right-hand_rule#Rotations|right-hand rule]].), followed by a rotation about the {{math|+''z''}} axis, resulting in the configuration shown in the lower left corner (5 dots on the top face.) Path B reverses the order of operations, resulting with 3 dots on top. Alternatively, set two books next to each other. Rotate one of them 90 degrees clockwise around the {{mvar|z}} axis, then flip it 180 degrees around the {{mvar|x}} axis. Take the other book, flip it 180° around {{mvar|x}} axis first, and 90° clockwise around {{mvar|z}} later. The two books do not end up parallel. This shows that, in general, the composition of two different rotations around two distinct spatial axes will not commute. === Orientation === The [[vector cross product]], used to define the axis–angle representation, does confer an [[orientation (vector space)|orientation]] ("handedness") to space: in a three-dimensional vector space, the three vectors in the equation {{math|1='''a''' × '''b''' = '''c'''}} will always form a right-handed set (or a left-handed set, depending on how the cross product is defined), thus fixing an orientation in the vector space. Alternatively, the dependence on orientation is expressed in referring to such <math>\vec{u}</math> that specifies a rotation as to ''[[axial vector]]s''. In quaternionic formalism the choice of an orientation of the space corresponds to order of multiplication: {{math|1='''ij''' = '''k'''}} but {{math|1='''ji''' = −'''k'''}}. If one reverses the orientation, then the formula above becomes {{math|'''p''' ↦ '''q'''{{sup|−1}} '''p q'''}}, i.e., a unit {{math|'''q'''}} is replaced with the conjugate quaternion – the same behaviour as of axial vectors. == Alternative conventions == It is reported<ref name="sommer">{{Citation | last=Sommer | first=H. |date=2018 | title=Why and How to Avoid the Flipped Quaternion Multiplication | journal=Aerospace | volume=5 | issue=3 | pages=72 | issn=2226-4310 | doi=10.3390/aerospace5030072 | arxiv=1801.07478 | bibcode=2018Aeros...5...72S | doi-access=free }}</ref> that the existence and continued usage of an alternative quaternion convention in the aerospace and, to a lesser extent, robotics community is incurring a ''significant and ongoing cost''{{sic}}. This alternative convention is proposed by [[Malcolm D. Shuster|Shuster M.D.]] in <ref>{{Citation | last=Shuster | first=M.D | date=1993 | title=A Survey of attitude representations | journal=Journal of the Astronautical Sciences | volume=41 | issue=4 | pages=439–517 | issn=0021-9142 | bibcode=1993JAnSc..41..439S }}</ref> and departs from tradition by reversing the definition for multiplying quaternion basis elements such that under Shuster's convention, <math> \mathbf{i} \mathbf{j} = -\mathbf{k}</math> whereas Hamilton's definition is <math> \mathbf{i}\mathbf{j} = \mathbf{k}</math>. This convention is also referred to as "JPL convention" for its use in some parts of [[NASA|NASA's]] [[Jet Propulsion Laboratory]]. Under Shuster's convention, the formula for multiplying two quaternions is altered such that :<math>\left(r_1,\ \vec{v}_1\right) \left(r_2,\ \vec{v}_2\right) = \left(r_1 r_2 - \vec{v}_1\cdot\vec{v}_2,\ r_1\vec{v}_2 + r_2\vec{v}_1 \mathbin{\color{red}\mathbf{-}} \vec{v}_1\times\vec{v}_2\right), \qquad \text{(Alternative convention, usage discouraged!)}</math> The formula for rotating a vector by a quaternion is altered to be :<math>\begin{align} \mathbf p'_\text{alt} ={} &(\mathbf v \otimes \mathbf v + q_r^2\mathbf{I} \mathbin{\color{red}\mathbf{-}} 2 q_r[\mathbf v]_{\times} + [\mathbf v]_{\times}^2) \mathbf p & \text{(Alternative convention, usage discouraged!)} \\ = &\ (\mathbf{I} \mathbin{\color{red}\mathbf{-}} 2 q_r[\mathbf v]_{\times} + 2[\mathbf v]_{\times}^2) \mathbf p & \end{align}</math> To identify the changes under Shuster's convention, see that the sign before the cross product is flipped from plus to minus. Finally, the formula for converting a quaternion to a rotation matrix is altered to be :<math>\begin{align} \mathbf{R}_{alt} &= \mathbf{I} \mathbin{\color{red}\mathbf{-}} 2 q_r[\mathbf v]_{\times} + 2[\mathbf v]_{\times}^2 \qquad \text{(Alternative convention, usage discouraged!)} \\ &= \begin{bmatrix} 1 - 2s (q_j^2 + q_k^2) & 2 (q_i q_j + q_k q_r) & 2 (q_i q_k - q_j q_r) \\ 2 (q_i q_j - q_k q_r) & 1 - 2s (q_i^2 + q_k^2) & 2 (q_j q_k + q_i q_r) \\ 2 (q_i q_k + q_j q_r) & 2 (q_j q_k - q_i q_r) & 1 - 2s (q_i^2 + q_j^2) \end{bmatrix} \end{align}</math> which is exactly the [[transpose]] of the rotation matrix converted under the traditional convention. === Software applications by convention used === The table below groups applications by their adherence to either quaternion convention:<ref name="sommer" /> {| class="wikitable" |+ ! scope="col" style="width: 20em;" | Hamilton multiplication convention ! scope="col" style="width: 20em;" | Shuster multiplication convention |- style="vertical-align:top;" | {{bulleted list | [[Wolfram Mathematica]] | [[MATLAB]] Robotics System Toolbox | MATLAB Aerospace Toolbox{{refn|The MATLAB Aerospace Toolbox uses the Hamilton multiplication convention, however because it applies *passive* rather than *active* rotations, the quaternions listed are in effect active rotations using the Shuster convention.<ref>{{Cite web|url=https://www.mathworks.com/help/aerotbx/ug/quatrotate.html|title=MATLAB Aerospace Toolbox quatrotate}}</ref>}} | [[Robot Operating System|ROS]] | [[Eigen (C++ library)|Eigen]] | Boost quaternions | Quaternion.js | Ceres Solver | [[SciPy]] spatial.transform.Rotation library | [[SymPy]] symbolic mathematics library | [https://github.com/moble/quaternion numpy-quaternion] library | [[Universal Scene Description]] }} | {{bulleted list | Microsoft [[DirectX]] Math Library }} |} While use of either convention does not impact the capability or correctness of applications thus created, the authors of <ref name="sommer" /> argued that the Shuster convention should be abandoned because it departs from the much older quaternion multiplication convention by Hamilton and may never be adopted by the mathematical or theoretical physics areas. == Comparison with other representations of rotations == === Advantages of quaternions === The representation of a rotation as a quaternion (4 numbers) is more compact than the representation as an [[orthogonal matrix]] (9 numbers). Furthermore, for a given axis and angle, one can easily construct the corresponding quaternion, and conversely, for a given quaternion one can easily read off the axis and the angle. Both of these are much harder with matrices or [[Euler angles]]. In [[video game]]s and other applications, one is often interested in "smooth rotations", meaning that the scene should slowly rotate and not in a single step. This can be accomplished by choosing a [[curve]] such as the [[slerp|spherical linear interpolation]] in the quaternions, with one endpoint being the identity transformation 1 (or some other initial rotation) and the other being the intended final rotation. This is more problematic with other representations of rotations. When composing several rotations on a computer, rounding errors necessarily accumulate. A quaternion that is slightly off still represents a rotation after being normalized: a matrix that is slightly off may not be [[Orthogonal matrix|orthogonal]] any more and is harder to convert back to a proper orthogonal matrix. Quaternions also avoid a phenomenon called [[gimbal lock]] which can result when, for example in [[flight dynamics|pitch/yaw/roll rotational systems]], the pitch is rotated 90° up or down, so that yaw and roll then correspond to the same motion, and a degree of freedom of rotation is lost. In a [[gimbal]]-based aerospace [[inertial navigation system]], for instance, this could have disastrous results if the aircraft is in a steep dive or ascent. === Conversion to and from the matrix representation === ==== From a quaternion to an orthogonal matrix ==== The [[orthogonal matrix]] corresponding to a rotation by the unit quaternion {{math|1='''z''' = ''a'' + ''b'' '''i''' + ''c'' '''j''' + ''d'' '''k'''}} (with {{math|1={{abs| '''z''' }} = 1}}) when post-multiplying with a column vector is given by :<math>R = \begin{pmatrix} a^2 + b^2 - c^2 - d^2 & 2bc - 2ad & 2bd + 2ac \\ 2bc + 2ad & a^2 - b^2 + c^2 - d^2 & 2cd - 2ab \\ 2bd - 2ac & 2cd+2ab & a^2 -b^2 -c^2 + d^2 \\ \end{pmatrix}.</math> This rotation matrix is used on vector {{mvar|w}} as <math>w_\text{rotated} = R \cdot w</math>. The quaternion representation of this rotation is given by: :<math>\begin{bmatrix} 0\\ w_\text{rotated} \end{bmatrix} = z \begin{bmatrix} 0 \\ w\end{bmatrix} z^*,</math> where <math>z^*</math> is the conjugate of the quaternion <math> z </math>, given by <math> \mathbf{z}^* = a - b\mathbf{i} - c\mathbf{j} - d\mathbf{k}</math> Also, quaternion multiplication is defined as (assuming {{mvar|a}} and {{mvar|b}} are quaternions, like {{mvar|z}} above): <math>ab = \left(a_0 b_0 - \vec{a} \cdot \vec{b}; a_0 \vec{b} + b_0 \vec{a} + \vec{a} \times \vec{b}\right)</math> where the order {{mvar|a}}, {{mvar|b}} is important since the cross product of two vectors is not commutative. A more efficient calculation in which the quaternion does not need to be unit normalized is given by<ref>Alan Watt and Mark Watt (1992) ''Advanced Animation and Rendering Techniques: Theory and Practice'', [[ACM Press]] {{isbn|978-0201544121}}</ref> :<math>R = \begin{pmatrix} 1 - cc - dd & bc - ad & bd + ac \\ bc + ad & 1 - bb - dd & cd - ab \\ bd - ac & cd + ab & 1 - bb - cc \\ \end{pmatrix},</math> where the following intermediate quantities have been defined: :<math>\begin{alignat}{2} & \ \ s = 2/(a \cdot a + b \cdot b + c \cdot c + d \cdot d), \\ & \begin{array}{lll} bs = b \cdot s, & cs = c \cdot s, & ds = d \cdot s, \\ ab = a \cdot bs, & ac = a \cdot cs, & ad = a \cdot ds, \\ bb = b \cdot bs, & bc = b \cdot cs, & bd = b \cdot ds, \\ cc = c \cdot cs, & cd = c \cdot ds, & dd = d \cdot ds . \\ \end{array} \end{alignat}</math> ==== From an orthogonal matrix to a quaternion ==== One must be careful when converting a rotation matrix to a quaternion, as several straightforward methods tend to be unstable when the [[Trace (linear algebra)|trace]] (sum of the diagonal elements) of the rotation matrix is zero or very small. For a stable method of converting an orthogonal matrix to a quaternion, see the [[Rotation matrix#Quaternion]]. ==== Fitting quaternions ==== The above section described how to recover a quaternion {{math|'''q'''}} from a {{math|3 × 3}} [[rotation matrix]] {{mvar|Q}}. Suppose, however, that we have some matrix {{mvar|Q}} that is not a pure rotation—due to [[round-off error]]s, for example—and we wish to find the quaternion {{math|'''q'''}} that most accurately represents {{mvar|Q}}. In that case we construct a symmetric {{math|4 × 4}} matrix :<math> K = \frac{1}{3} \begin{bmatrix} Q_{xx}-Q_{yy}-Q_{zz} & Q_{yx}+Q_{xy} & Q_{zx}+Q_{xz} & Q_{zy}-Q_{yz} \\ Q_{yx}+Q_{xy} & Q_{yy}-Q_{xx}-Q_{zz} & Q_{zy}+Q_{yz} & Q_{xz}-Q_{zx} \\ Q_{zx}+Q_{xz} & Q_{zy}+Q_{yz} & Q_{zz}-Q_{xx}-Q_{yy} & Q_{yx}-Q_{xy} \\ Q_{zy}-Q_{yz} & Q_{xz}-Q_{zx} & Q_{yx}-Q_{xy} & Q_{xx}+Q_{yy}+Q_{zz} \end{bmatrix} , </math> and find the [[eigenvector]] {{math|(''x'', ''y'', ''z'', ''w'')}} corresponding to the largest eigenvalue (that value will be 1 if and only if {{mvar|Q}} is a pure rotation). The quaternion so obtained will correspond to the rotation closest to the original matrix {{mvar|Q}} {{Dubious|date=December 2009}}.<ref>{{Citation | last=Bar-Itzhack | first=Itzhack Y. | date=Nov–Dec 2000 | title=New method for extracting the quaternion from a rotation matrix | journal=Journal of Guidance, Control and Dynamics | volume=23 | issue=6 | pages=1085–1087 | issn=0731-5090 | doi=10.2514/2.4654 | bibcode=2000JGCD...23.1085B }}</ref> === Performance comparisons === This section discusses the performance implications of using quaternions versus other methods (axis/angle or rotation matrices) to perform rotations in 3D. ==== Results ==== {| class="wikitable" |+ Storage requirements |- ! Method ! Storage |- | [[Rotation matrix]] | 9 or 6 (see below) |- | [[Quaternion]] | 4 or 3 (see below) |- | [[Axis–angle representation|Angle–axis]] | 4 or 3 (see below) |} Only three of the quaternion components are independent, as a rotation is represented by a unit quaternion. For further calculation one usually needs all four elements, so all calculations would suffer additional expense from recovering the fourth component. Likewise, angle–axis can be stored in a three-component vector by multiplying the unit direction by the angle (or a function thereof), but this comes at additional computational cost when using it for calculations. Similarly, a rotation matrix requires orthogonal basis vectors, so in 3D space the third vector can unambiguously be calculated from the first two vectors with a cross product (though there is ambiguity in the sign of the third vector if [[improper rotation]]s are allowed). {| class="wikitable" |+ Performance comparison of rotation chaining operations |- ! Method !! # multiplies !! # add/subtracts !! total operations |- | Rotation matrices || 27 || 18 || 45 |- | Quaternions || 16 || 12 || 28 |} {| class="wikitable" |+ Performance comparison of vector rotating operations<ref>Eberly, D., Rotation Representations and performance issues</ref><ref>{{Cite web|url=https://bitbucket.org/eigen/eigen/src/4111270ba6e10882f8a8c571dbb660c8e9150138/Eigen/src/Geometry/Quaternion.h?at=default&fileviewer=file-view-default#Quaternion.h-469|title=Bitbucket|website=bitbucket.org}}</ref> |- ! colspan=2 | Method ! # multiplies !! # add/subtracts !! # sin/cos !! total operations |- | colspan=2 | Rotation matrix | 9 || 6 || 0 || 15 |- | rowspan=2 | Quaternions * | Without intermediate matrix | 15 || 15 || 0 || 30 |- | With intermediate matrix | 21 || 18 || 0 || 39 |- | rowspan=2 | Angle–axis | Without intermediate matrix | 18 | 13 | 2 | 31 + 2 |- | With intermediate matrix | 21 | 16 | 2 | 37 + 2 |} <nowiki>*</nowiki> Quaternions can be implicitly converted to a rotation-like matrix (12 multiplications and 12 additions/subtractions), which levels the following vectors rotating cost with the rotation matrix method. ==== Used methods ==== There are three basic approaches to rotating a vector {{vec|''v''}}: # Compute the matrix product of a {{math|3 × 3}} [[rotation matrix]] {{mvar|R}} and the original {{math|3 × 1}} [[column vector|column]] matrix representing {{vec|''v''}}. This requires 3 × (3 multiplications + 2 additions) = 9 multiplications and 6 additions, the most efficient method for rotating a vector. # A rotation can be represented by a unit-length quaternion {{math|1='''q''' = (''w'', {{vec|''r''}})}} with scalar (real) part {{mvar|w}} and vector (imaginary) part {{vec|''r''}}. The rotation can be applied to a 3D vector {{vec|''v''}} via the formula <math> \vec{v}_\text{new}=\vec{v} + 2\vec{r} \times (\vec{r} \times \vec{v} + w \vec{v})</math>. This requires only 15 multiplications and 15 additions to evaluate (or 18 multiplications and 12 additions if the factor of 2 is done via multiplication.) This formula, originally thought to be used with axis/angle notation (Rodrigues' formula), can also be applied to quaternion notation. This yields the same result as the less efficient but more compact formula of quaternion multiplication <math> \vec{v}_\text{new} = q \vec{v} q^{-1}</math>. # Use the [[Rotation matrix#Angle-Axis representation and quaternion representation|angle/axis formula]] to convert an angle/axis to a [[rotation matrix]] {{mvar|R}} then multiplying with a vector, or, similarly, use a formula to convert quaternion notation to a rotation matrix, then multiplying with a vector. Converting the angle/axis to {{mvar|R}} costs 12 multiplications, 2 function calls (sin, cos), and 10 additions/subtractions; from item 1, rotating using {{mvar|R}} adds an additional 9 multiplications and 6 additions for a total of 21 multiplications, 16 add/subtractions, and 2 function calls (sin, cos). Converting a quaternion to {{mvar|R}} costs 12 multiplications and 12 additions/subtractions; from item 1, rotating using {{mvar|R}} adds an additional 9 multiplications and 6 additions for a total of 21 multiplications and 18 additions/subtractions. {| class="wikitable" |+ Performance comparison of n vector rotating operations |- ! colspan=2 | Method ! # multiplies ! # add/subtracts ! # sin/cos ! total operations |- | colspan=2 | Rotation matrix | 9{{mvar|n}} || 6{{mvar|n}} || 0 || 15{{mvar|n}} |- | rowspan=2 | Quaternions * | Without intermediate matrix | 15{{mvar|n}} || 15{{mvar|n}} || 0 || 30{{mvar|n}} |- | With intermediate matrix | 9{{mvar|n}} + 12 || 6{{mvar|n}} + 12 || 0 || 15{{mvar|n}} + 24 |- | rowspan=2 | Angle–axis | Without intermediate matrix | 18{{mvar|n}} | 12{{mvar|n}} + 1 | 2 | 30{{mvar|n}} + 3 |- | With intermediate matrix | 9{{mvar|n}} + 12 | 6{{mvar|n}} + 10 | 2 | 15{{mvar|n}} + 24 |} == Pairs of unit quaternions as rotations in 4D space == A pair of unit quaternions <math>\mathbf{z}_{\rm{L}} = a_{\rm{L}} + b_{\rm{L}}i + c_{\rm{L}}j + d_{\rm{L}}k</math> and <math>\mathbf{z}_{\rm{R}} = a_{\rm{R}} + b_{\rm{R}}i + c_{\rm{R}}j + d_{\rm{R}}k</math> can represent any [[Rotations in 4-dimensional Euclidean space|rotation in 4D space]]. Given a four-dimensional vector <math>\vec{v}</math>, expressed as a quaternion <math>\vec{v} = w + xi + yj + zk</math>, we can rotate it as follows: :<math>f\left(\vec{v}\right) = \mathbf{z}_{\rm{L}} \vec{v} \mathbf{z}_{\rm{R}} = M_{\rm{L}}M_{\rm{R}} \vec{v} = \begin{pmatrix} a_{\rm{L}}&-b_{\rm{L}}&-c_{\rm{L}}&-d_{\rm{L}}\\ b_{\rm{L}}& a_{\rm{L}}&-d_{\rm{L}}& c_{\rm{L}}\\ c_{\rm{L}}& d_{\rm{L}}& a_{\rm{L}}&-b_{\rm{L}}\\ d_{\rm{L}}&-c_{\rm{L}}& b_{\rm{L}}& a_{\rm{L}} \end{pmatrix} \begin{pmatrix} a_{\rm{R}}&-b_{\rm{R}}&-c_{\rm{R}}&-d_{\rm{R}}\\ b_{\rm{R}}& a_{\rm{R}}& d_{\rm{R}}&-c_{\rm{R}}\\ c_{\rm{R}}&-d_{\rm{R}}& a_{\rm{R}}& b_{\rm{R}}\\ d_{\rm{R}}& c_{\rm{R}}&-b_{\rm{R}}& a_{\rm{R}} \end{pmatrix} \begin{pmatrix}w\\x\\y\\z\end{pmatrix}, </math> where the matrices <math>M_{\rm{L}}</math> and <math>M_{\rm{R}}</math> represent left and right quaternion multiplications, respectively. Together, these matrices form an [[Rotations in 4-dimensional Euclidean space#Isoclinic decomposition|isoclinic decomposition]] of a rotation in <math>\mathbb{R}^4</math>. Since quaternion multiplication is [[associative]], we have: :<math>(\mathbf{z}_{\rm{L}} \vec{v}) \mathbf{z}_{\rm{R}} = M_{\rm{R}}M_{\rm{L}}\vec{v} = M_{\rm{L}}M_{\rm{R}}\vec{v} = \mathbf{z}_{\rm{L}} (\vec{v} \mathbf{z}_{\rm{R}})</math>. Thus, the two matrices <math>M_{\rm{L}}</math> and <math>M_{\rm{R}}</math> must commute. This implies the existence of two commuting [[subgroup]]s within the group of four-dimensional rotations. An arbitrary four-dimensional rotation has six degrees of freedom, with each matrix contributing three of these six degrees of freedom. Since the generators of the four-dimensional rotations can be represented by pairs of quaternions (as follows), all four-dimensional rotations can also be represented. :<math>\begin{align} \mathbf{z}_{\rm{L}} \vec{v} \mathbf{z}_{\rm{R}} &= \begin{pmatrix} 1 &-dt_{ab}&-dt_{ac}&-dt_{ad}\\ dt_{ab}&1 &-dt_{bc}&-dt_{bd}\\ dt_{ac}& dt_{bc}&1 &-dt_{cd}\\ dt_{ad}& dt_{bd}& dt_{cd}&1 \end{pmatrix} \begin{pmatrix} w\\ x\\ y\\ z \end{pmatrix} \\[3pt] \mathbf{z}_{\rm{L}} &= 1+{dt_{ab}+dt_{cd}\over 2}i+{dt_{ac}-dt_{bd}\over 2}j+{dt_{ad}+dt_{bc}\over 2}k \\[3pt] \mathbf{z}_{\rm{R}} &= 1+{dt_{ab}-dt_{cd}\over 2}i+{dt_{ac}+dt_{bd}\over 2}j+{dt_{ad}-dt_{bc}\over 2}k \end{align}</math> == See also == {{cols|colwidth=16em}} *[[Anti-twister mechanism]] *[[Binary polyhedral group]] *[[Biquaternion]] *[[Charts on SO(3)]] *[[Clifford algebra]]s *[[Conversion between quaternions and Euler angles]] *[[Covering space]] *[[Dual quaternion]] *[[Applications of dual quaternions to 2D geometry]] *[[Elliptic geometry#Elliptic space|Elliptic geometry]] *[[Rotation formalisms in three dimensions]] *[[Rotation (mathematics)]] *[[Spin group]] *[[Slerp]], spherical linear interpolation *[[Olinde Rodrigues]] *[[William Rowan Hamilton]] {{colend}} == References == {{Reflist}} == Further reading == *{{cite journal|first1=Carl|last1=Grubin |year=1970|title=Derivation of the quaternion scheme via the Euler axis and angle |doi=10.2514/3.30149|journal= Journal of Spacecraft and Rockets|volume=7 |number=10|pages=1261–1263|bibcode=1970JSpRo...7.1261G}} *{{cite journal|first1=E. P. |last1= Battey-Pratt |first2=T. J. |last2= Racey| year=1980 |title =Geometric Model for Fundamental Particles |journal=International Journal of Theoretical Physics |volume=19 |number=6 |pages= 437–475 | bibcode=1980IJTP...19..437B|doi=10.1007/BF00671608|s2cid= 120642923 }} *{{cite journal|first1=M. |last1=Arribas |first2=A. |last2=Elipe |first3=M. | last3=Palacios |title=Quaternions and the rotations of a rigid body |year=2006|journal=Celest. Mech. Dyn. Astron. |volume=96 |issue=3–4 |pages=239–251|doi=10.1007/s10569-006-9037-6|bibcode=2006CeMDA..96..239A|s2cid=123591599 }} == External links and resources == * {{cite web|first1=Ken|last1=Shoemake|url=http://www.cs.ucr.edu/~vbz/resources/quatut.pdf|url-status=live|archive-url=https://web.archive.org/web/20200503045740/http://www.cs.ucr.edu/~vbz/resources/quatut.pdf|archive-date=2020-05-03|title=Quaternions}} * {{cite web |url=http://rosettacode.org/wiki/Simple_Quaternion_type_and_operations|title= Simple Quaternion type and operations in over seventy-five computer languages}} on [[Rosetta Code]] * {{cite web|first1=John C. |last1=Hart|url=http://graphics.stanford.edu/courses/cs348c-95-fall/software/quatdemo |title=Quaternion Demonstrator}} * {{cite web |url= http://web.mit.edu/2.998/www/QuaternionReport1.pdf|first1=Eik B. |last1= Dam | first2=Martin |last2=Koch |first3=Martin| last3=Lillholm|title= Quaternions, Interpolation and Animation|year=1998}} * {{cite web |url=http://www.cs.unc.edu/techreports/01-014.pdf | first1= Vicci |last1=Leandra|title=Quaternions and Rotations in 3-Space: The Algebra and its Geometric Interpretation|year=2001}} * {{cite web |url=http://world.std.com/~sweetser/quaternions/ps/cornellcstr75-245.pdf|last1= Howell|first1= Thomas|last2= Lafon|first2= Jean-Claude |title= The Complexity of the Quaternion Product, TR75-245|year=1975|publisher=Cornell University}} * {{cite web|url=http://people.csail.mit.edu/bkph/articles/Quaternions.pdf |first1= Berthold K.P. |last1= Horn|author-link=Berthold K.P. Horn |title= Some Notes on Unit Quaternions and Rotation|year= 2001}} * {{cite thesis|url=http://home.ewha.ac.kr/~bulee/quaternion.pdf |first1= Byung-Uk |last1=Lee |title= Unit Quaternion Representation of Rotation - Appendix A, Differentiation with Quaternions - Appendix B |type=Ph. D. Thesis|date=1991|publisher=Stanford University}} * {{cite web|url=http://www.wetsavannaanimals.net/wordpress/some-examples-of-connected-lie-groups/|url-status=live|archive-url=https://web.archive.org/web/20181215191041/http://www.wetsavannaanimals.net/wordpress/some-examples-of-connected-lie-groups/|archive-date=2018-12-15|first1=Rod|last1=Vance|title=Some examples of connected Lie groups}} *{{cite web|url=https://eater.net/quaternions |title= Visual representation of quaternion rotation}} [[Category:Quaternions]] [[Category:Rotation in three dimensions]] [[Category:Rigid bodies mechanics]] [[Category:3D computer graphics]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Bulleted list
(
edit
)
Template:Citation
(
edit
)
Template:Cite arXiv
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite thesis
(
edit
)
Template:Cite web
(
edit
)
Template:Colend
(
edit
)
Template:Cols
(
edit
)
Template:Dubious
(
edit
)
Template:Fix
(
edit
)
Template:Isbn
(
edit
)
Template:Main
(
edit
)
Template:Math
(
edit
)
Template:More citations needed section
(
edit
)
Template:Mvar
(
edit
)
Template:Not a typo
(
edit
)
Template:Reflist
(
edit
)
Template:Sfrac
(
edit
)
Template:Short description
(
edit
)
Template:Sic
(
edit
)
Template:Slink
(
edit
)
Template:Sqrt
(
edit
)
Template:TOC limit
(
edit
)
Template:Vec
(
edit
)