A unit quaternion, known as a versor, provides a convenient mathematical notation for representing the spatial orientation and rotation of an element in three-dimensional space. Specifically, it encodes information about an axis-angle rotation about an arbitrary axis. Rotation and orientation quaternions have applications in computer graphics, computer vision, robotics, navigation, molecular mechanics, flight mechanics, satellite orbital mechanics, and crystallography. When used to represent rotation, the unit quaternion is also called the rotation quaternion. 3D rotation group. When used to represent orientation (rotation about a reference frame), they are called orientation quaternions or pose quaternions. Spatial rotation around a fixed point θ {\displaystyle \theta } radians around unit axis ( X , Y , Z. ) {\displaystyle (X,Y,Z)} Denoting the Euler axis is given by the quaternion ( C. , X S. , Y S. , Z. S. ) {\displaystyle (C,X\,S,Y\,S,Z\,S)} , where C. = cos ⁡ ( θ / 2 ) {\displaystyle C=\cos(\theta /2)} and S. = sin ⁡ ( θ / 2 ) {\displaystyle S=\sin(\theta /2)} . Compared to rotation matrices, quaternions are more compact, efficient, and numerically stable. Easier to construct than Euler angles. However, these are not intuitive and easy to understand, and due to the periodic nature of the sine and cosine, rotation angles that differ exactly by natural period are encoded into the same quaternion, and the recovered angle in radians is It is limited as follows. [ 0 , 2 Pi ] {\displaystyle [0,2\pi ]} .

Scholarly Articles

Using quaternions as rotations

= Example conjugation operation =

= Quaternion-derived rotation matrix =

= Recovering the axis-angle representation =

= The composition of spatial rotations =

The advantage of formulating the composition of two rotations RB and RA in quaternions is that the rotation axis and angle of the composite rotation RC = RBRA are directly available. Suppose we want to construct a quaternion associated with a spatial rotation R using rotation angles from its rotation axis S. φ {\displaystyle \varphi} centered around this axis. The relevant quaternions are given by: In this case, the composition of the rotations RB and RA is the rotation RC = RBRA where the rotation axis and angle are defined by the product of the quaternions. That is Deploying this product Divide both sides of this equation by the identity. This is the cosine law on the sphere. and calculate This is Rodriguez's formula for the axis of compound rotation defined in terms of two axes of rotation. He derived this formula in his 1840 (see page 408). The three axes of rotation A, B, and C form a spherical triangle, and the dihedral angle between the planes formed by the sides of this triangle is defined by the rotation angle. Hamilton presents a component form of these equations in which the quaternion product computes his third vertex of a spherical triangle from his two vertices and their associated arc lengths given, which in elliptic geometry is We showed that we also define the algebra of points.

== Axis–angle composition ==

normalized axis of rotation, cos ⁡ γ 2 {\textstyle \cos {\frac {\gamma }{2}}} The expanded product leaves a vector that is the axis of rotation multiplied by some constant. Be careful with normalizing the axis vectors. γ {\displaystyle \gamma } teeth 0 {\displaystyle 0} or k 2 Pi {\displaystyle k2\pi } where the vector is near 0 {\displaystyle 0} ; which means identity, i.e. 0 rotation about any axis. Or use the angle addition trigonometric permutation... Finally, normalize the rotation axis. D. 2 sin ⁡ 1 2 γ {\textstyle {\frac {\mathbf {D} }{2\sin {\frac {1}{2}}\gamma }}} or D. ‖ D. ‖ {\textstyle {\frac {\mathbf {D} }{\|\mathbf {D} \|}}} .

= Differentiation with respect to the rotation quaternion =

= Quaternions =

= Rotation identity =

Quaternion rotation operations

A very formal description of the properties used in this section is provided by Altman.

== Visualizing the space of rotations ==

== Parameterizing the space of rotations ==

You can parameterize the surface of a sphere using two coordinates, such as latitude and longitude. However, while the north and south poles are not inherently different from any other point on the sphere, latitude and longitude malfunction (degenerate) at the north and south poles. At the poles (latitude +90° and -90°) the longitude becomes meaningless. It turns out that a two-parameter coordinate system cannot avoid such degeneracy. Such a problem is to embed a sphere in 3-dimensional space, parameterize it with three Cartesian coordinates (w, x, y), and place the north pole at (w, x, y) = (1, 0, 0). can be avoided by The south pole is at (w, x, y) = (−1, 0, 0), the equator is at w = 0, x2 + y2 = 1. A point on the sphere satisfies the constraint w2 + x2 + y2 = 1. So even though we have three coordinates, we still only have two degrees of freedom. A point (w, x, y) on the sphere represents a rotation in normal space about the horizontal axis by the angle specified by the vector (x, y, 0). α = 2 cos − 1 ⁡ w = 2 sin − 1 ⁡ X 2 + y 2 {\displaystyle \alpha =2\cos ^{-1}w=2\sin ^{-1}{\sqrt {x^{2}+y^{2}}}} . Similarly, the hypersphere space of the 3D rotation can be parameterized by three angles (Eulerian angles), but such a parameterization is degenerate at some points on the hypersphere, causing gimbal lock problems. This can be avoided by using four Euclidean coordinates w, x, y, z (w2 + x2 + y2 + z2 = 1). The point (w, x, y, z) is the vector (x, y, z) by angle α = 2 cos − 1 ⁡ w = 2 sin − 1 ⁡ X 2 + y 2 + z 2 . {\displaystyle \alpha =2\cos ^{-1}w=2\sin ^{-1}{\sqrt {x^{2}+y^{2}+z^{2}}}.}

= Non-commutativity =

Quaternion multiplication is noncommutative. This fact explains how the formula for p ↦ q p q−1, where q q−1 = 1 by definition, works. Since unit quaternion multiplication corresponds to composition of 3D rotations, we can intuitively understand this property by showing that 3D rotations are not commutative in general. Place the two books next to each other. Rotate one of them 90 degrees clockwise around the Z axis, then flip it 180 degrees around the X axis. Take the other book and flip it 180 degrees around the x-axis first, then 90 degrees clockwise around the z-axis. These two books of his are not parallel after all. This indicates that, in general, the composition of his two different rotations about two different spatial axes does not commute.

= Orientation =

The cross product of the vectors used to define the axis and angle expressions gives the orientation (“handedness”) in space. In a three-dimensional vector space, the three vectors in the equation a × b = c are always pointing to the right. Use a -handedness set (left-handedness set, depending on how the cross product is defined) to fix the orientation in vector space. Alternatively, directional dependence is expressed with reference to such. you → {\displaystyle {\vec {u}}} Specifies a rotation about an axis vector. In quaternion form, the choice of spatial orientation corresponds to the order of multiplication: ij = k, but ji = −k. Reversing the direction, the above expression becomes p ↦ q−1 p q. That is, the unit q is replaced by a conjugate quaternion. This is the same behavior as for axis vectors.

Alternative conventions

= Software applications by convention used =

The table below groups applications according to their adherence to one of the quaternion rules. The use of either rule has no effect on the functionality or correctness of applications written in this way, but the authors of Schuster's rule deviate from Hamilton's much older quaternion multiplication rule. and should be abandoned as it may never be adopted by any mathematical or theoretical method. physics field.

= Advantages of quaternions =

Representing the rotation as a quaternion (4 numbers) is more compact than as an orthogonal matrix (9 numbers). Moreover, for a given axis and angle, we can easily construct the corresponding quaternion, and conversely, for a given quaternion, we can easily read the axis and angle. Both of these are much more difficult with matrices and Euler angles. Video games and other applications are often interested in "smooth rotation". This means that the scene rotates slowly instead of in one step. This can be achieved by choosing a curve such as a quaternion spherical linear interpolation. One end point is the identity transformation 1 (or other initial rotation), the other end point is the desired final rotation. This is even more of an issue with other representations of rotation. Composing multiple rotations on a computer inevitably accumulates rounding errors. A slightly off quaternion represents a rotation even after being normalized. Slightly misaligned matrices may no longer be orthogonal and will be difficult to transform back into a properly orthogonal matrix. Quaternions also avoid a phenomenon called gimbal lock, which can occur when pitch is rotated 90° up or down, for example in a pitch/yaw/roll rotation system. As a result, yaw and roll correspond to the same motion, and rotational freedom is lost. For example, in a gimbal-based aerospace inertial navigation system, this can have disastrous consequences if the aircraft is plummeting or climbing.

== From a quaternion to an orthogonal matrix ==

== From an orthogonal matrix to a quaternion ==

Some simple methods tend to be unstable if the rotation matrix trace (the sum of the diagonal elements) is zero or very small, so be careful when converting the rotation matrix to a quaternion . See Rotation matrices#Quaternions for a stable way to convert orthogonal matrices to quaternions.

== Fitting quaternions ==

= Performance comparisons =

This section discusses the performance implications of using quaternions and other methods (axis/angles or rotation matrices) to perform rotations in 3D.

== Results ==

Rotations are expressed in unit quaternions, so only three of the quaternion components are independent. Further calculations usually require all four elements, so every calculation incurs the additional cost of retrieving his fourth element. Similarly, the angular axis can be stored in a 3-component vector by multiplying the unit direction by the angle (or a function thereof), but using this in the computation incurs additional computational cost. * Quaternions can be implicitly converted to rotation-like matrices (12 multiplications and 12 additions/subtractions). This smoothes the rotation cost of the vector below using the rotation matrix method.

== Used methods ==

There are three basic approaches to rotating the vector v→. Compute the matrix product of the 3 × 3 rotation matrix R and the original 3 × 1 column matrix representing v→. This requires 3 × (3 multiplications + 2 additions) = 9 multiplications and 6 additions, and is the most efficient way to rotate a vector. A rotation can be represented by a unit length quaternion q = (w, r→) with a scalar (real) part w and a vector (imaginary) part r→. A rotation can be applied to a 3D vector v→ using the formula: v → new = v → + 2 r → × ( r → × v → + w v → ) {\displaystyle {\vec {v}}_{\text{new}}={\vec {v}}+2{\vec {r}}\times ({\vec {r}}\times {\vec {v}}+w{\vec {v}})} . This requires only 15 multiplications and 15 additions to evaluate (or 18 multiplications and 12 additions if the factor of 2 is done by multiplication). This formula was originally thought to be used in axis/angle notation (Rodriguez's formula), but it can also be: Applies to quaternion notation. This gives the same result as the less efficient quaternion multiplication formula. v → new = q v → q − 1 {\displaystyle {\vec {v}}_{\text{new}}=q{\vec {v}}q^{-1}} . Use the angle/axis formula to convert the angle/axis to a rotation matrix R and then multiply it with the vector, or similarly use the formula to convert the quaternion notation to a rotation matrix and then the vector and Multiply. Converting an angle/axis to R requires 12 multiplications, 2 function calls (sin, cos), and 10 additions/subtractions. From item 1, rotating with R adds 9 more multiplications and 6 additions for a total of 21 multiplications, 16 additions/subtractions, and 2 function calls (sin, cos) is done. Converting a quaternion to R requires 12 multiplications and 12 additions/subtractions. From item 1, rotating with R adds another 9 multiplications and 6 additions for a total of 21 multiplications and 18 additions/subtractions.

Pairs of unit quaternions as rotations in 4D space

Further reading

Karl Groovin (1970). "Derivation of quaternion schemes with Euler axes and angles". Journal of spaceships and rockets. 7(10):1261–1263. Bibcode: 1970JSpRo...7.1261G. Doi: 10.2514/3.30149. Batty Pratt, E.P. Lacy, T.J. (1980). "Geometric model of elementary particles". International Journal of Theoretical Physics. 19(6):437–475. Bibcode: 1980IJTP...19..437B. Doi: 10.1007/BF00671608. S2CID 120642923. Arrivas, M. Elipe, A. Palacios, M. (2006). "Quaternions and Rotations of Rigid Bodies". Celeste. Mecha. Ding. Astron. 96(3-4):239-251. Bibcode: 2006CeMDA..96..239A. Doi: 10.1007/s10569-006-9037-6. S2CID 123591599.

External links and resources

Shoemaker, Ken. "Quaternions" (PDF). Archived (PDF) from the original on May 3, 2020. "Simple quaternion types and operations in over 75 computer languages". About the Rosetta Code Hart, John C. "The Quaternion Demonstrator". Dam, Eike B. Koch, Martin. Lilholm, Martin (1998). "Quaternions, Interpolation, and Animation" (PDF). Leandra, Vic (2001). "Quaternions and Rotations in Three Spaces: Algebras and Their Geometric Interpretations" (PDF). Howell, Thomas. Lafon, Jean-Claude (1975). "The Quaternion Product Complexity, TR75-245" (PDF). Cornell University. Horn, Bertolt K.P. (2001). "Notes on Unit Quaternions and Rotations" (PDF). Byeong-wook Lee (1991) Unit Quaternion Representation of Rotation - Appendix A, Derivatives with Quaternions - Appendix B (PDF) (Doctoral Thesis). Stanford University. Vance, Rod. "Some examples of connected Lie groups". Archived from the original on 2018-12-15. "Visual Representation of Quaternion Rotation".

Science News



Definition & Meaning



  • the cardinal number that is the sum of three and one




  • pertaining to or involving or having the nature of space



  • the act of rotating as if on an axis (mathematics a single complete turn (axial or orbital a planned recurrent sequence (of crops or personnel etc.


Related Topics

3-sphere 3D rotation group ACM Press Additive inverse Angle of rotation Anti-twister mechanism Anticommutative property Applications of dual quaternions to 2D geometry ArXiv (identifier) Atan2 Axial vector Axis of rotation Axis–angle representation Berthold K.P. Horn Bibcode (identifier) Binary polyhedral group Biquaternion Cartesian coordinate system Charts on SO(3) Classical Hamiltonian quaternions Clifford algebra Column vector Commutative Commutative law Complex numbers Computer graphics Computer vision Conjugate element (field theory) Conversion between quaternions and Euler angles Cosine Covering space Cross product Cube Curve Cyclic permutation Degeneracy (mathematics) Degrees of freedom (physics and chemistry) DirectX Doi (identifier) Dot product Double covering group Dual quaternion Eigen (C++ library) Eigenvector Elliptic geometry Euclidean vector Euler's formula Euler's rotation theorem Euler angles Flight dynamics Function composition Gimbal Gimbal lock Group (mathematics) Hamilton product ISBN (identifier) ISSN (identifier) Identity matrix Inertial navigation system JSTOR (identifier) Jet Propulsion Laboratory Krieger Publishing Co. Left and right (algebra) Linear algebra List of trigonometric identities MATLAB Malcolm D. Shuster Mathematics Matrix calculus Matrix multiplication Molecular dynamics Multiplicative inverse NASA Navigation Non-commutative Numerically stable Olinde Rodrigues Orbital mechanics Orientation (geometry) Orientation (vector space) Origin (mathematics) Orthogonal matrix Outer product Pauli matrices Periodic function Philosophical Magazine Point (geometry) Position (vector) Princeton University Press Quaternion Quaternions Radian Real coordinate space Robot Operating System Robotics Rodrigues' rotation formula Rosetta Code Rotation Rotation (mathematics) Rotation formalisms in three dimensions Rotation matrix Rotations in 4-dimensional Euclidean space Round-off error S2CID (identifier) SIGGRAPH Satellite Scalar (mathematics) Scalar quaternion SciPy Sic Sine Slerp Spherical law of cosines Spin group Subgroup SymPy Texture (crystalline) Three-dimensional space Trace (linear algebra) Transpose Trigonometric substitution Trinity College, Dublin Unit quaternion Unit vector Vector (mathematics and physics) Vector calculus Vector cross product Vector quaternion Vector space Versor Video game William Rowan Hamilton Wolfram Mathematica Conversion between quaternions and Euler angles Slerp Quaternion Euler–Rodrigues formula Gimbal lock Euler angles Dual quaternion Charts on SO(3) Pythagorean quadruple