Rotation representation (mathematics)

From Wikipedia, the free encyclopedia

In geometry a rotation representation expresses the orientation of an object (or coordinate frame) relative to a coordinate reference frame. This concept extends to classical mechanics where rotational kinematics is the science of describing purely rotational motion of an object.

According to Euler's rotation theorem the general displacement of a rigid body (or coordinate frame) with one point fixed is described by a rotation about some axis. Furthermore, such a rotation may be uniquely described by a minimum of three parameters. However, for various reasons, there are several ways to represent such a rotation. Many of these definitions use more than the necessary minimum of three parameters, although any such representation still has only three degrees of freedom.

An example where rotation representation is used is in computer vision, where an automated observer needs to track a target. Let's consider a rigid body, with an orthogonal right-handed triad \hat{\mathbf{u}}, \hat{\mathbf{v}} and \hat{\mathbf{w}} of unit vectors fixed to its body (the object coordinate system). The basic problem is to specify the orientation of this triad, and hence the rigid body, in terms of the reference coordinate frame (in our case the camera coordinate system).

Contents

[edit] Direction Cosine Matrix (DCM)

It is clear that specifying the coordinates of a basis for our new (rotated) set of coordinate axes in terms of the original (non-rotated) coordinates axes, will completely describe the rotation. The three unit vectors \hat{\mathbf{u}}, \hat{\mathbf{v}} and \hat{\mathbf{w}} which form the basis for our new system each consists of 3 parameters, yielding a total of 9 elements. These elements can be written as the elements of a 3\times3 matrix \mathbf{A}, called the direction cosine matrix or rotation matrix.

\mathbf{A} = \left[ {\begin{array}{ccc}    \hat{\mathbf{u}}_x & \hat{\mathbf{v}}_x & \hat{\mathbf{w}}_x  \\    \hat{\mathbf{u}}_y & \hat{\mathbf{v}}_y & \hat{\mathbf{w}}_y  \\    \hat{\mathbf{u}}_z & \hat{\mathbf{v}}_z & \hat{\mathbf{w}}_z  \\ \end{array}} \right]

Each of the elements is the cosine of the angle between a rotated unit basis vector and one of the reference axes, and therefore \mathbf{A} is often called the Direction Cosine Matrix (DCM). The elements of the DCM are not all independent - as Euler's rotation theorem dictates, the DCM has only three degrees of freedom. The DCM has the following properties:

\{1,\ \cos(\theta)+i\sin(\theta),\ \cos(\theta)-i\sin(\theta)\}.
  • The determinant (being the product of the eigenvalues) of A is +1.

The angle θ which appears in the eigenvalue expression corresponds to the angle of the Euler axis and angle representation. The eigenvector corresonding with the eigenvalue of 1 is the accompanying Euler axis, since the axis is the only (nonzero) vector which remains unchanged by left-multiplyting (rotating) it with the rotation matrix.

Two successive DCM rotations \mathbf{A}_1 and \mathbf{A}_2 are easily combined as follows: \mathbf{A}_{total} = \mathbf{A}_2\mathbf{A}_1 (Note the order, since the vector being rotated is multiplied from the right). The ease by which vectors can be rotated using a DCM, as well as the ease of combining successive rotations, make the DCM a very useful and popular way to represent rotations, even though it is less concise than other representations.

See also: Rotation matrix

[edit] Euler axis and angle (rotation vector)

Main article: Axis angle

From Euler's rotation theorem we know that any rotation can be expressed as a single rotation about some axis. The axis is the unit vector (unique except for sign) which remains unchanged by the rotation. The magnitude of the angle is also unique, with its sign being determined by the sign of the rotation axis.

The axis can be represented as a normalized three dimensional vector \hat{\mathbf{e}} = [e_x\ e_y\ e_z]^T , and the angle by a scalar θ.

Since the axis is normalized, it has only two degrees of freedom. The angle adds the third degree of freedom to this rotation representation. A more concise way to express the Euler axis and angle, is as a non-normalized three-dimensional vector where the vector's direction specifies the axis, and its the vector's length denotes θ.

If the rotation angle θ is zero, the axis is not uniquely defined.

A visualization of a rotation represented by an Euler axis and angle.
A visualization of a rotation represented by an Euler axis and angle.

Combining two successive rotations, each represented by a Euler axis and angle, is not straightforward. It is usual to convert to direction cosine matrix (DCM) or quaternion notation, calculate the product, and then convert back to Euler axis and angle.

[edit] Euler angles

Main article: Euler angles

The idea behind Euler angles is to split the complete rotation of the coordinate system into three simpler constitutive rotations, in such a way that the complete rotation matrix is the product of three simpler matrices. Notice that the outer matrix will represent a rotation around one of the axis of the reference frame, and the inner matrix represents a rotation around one of the moving frame axis. The middle matrix represent a rotation around an intermediate axis called line of nodes.

Unfortunately, the definition of Euler angles is not unique and in the literature many different conventions are used. These conventions depend on the axes about which the rotations are carried out, and their sequence (since rotations are not commutative).

The convention being used is usually indicated by specifying the axes about which the consecutive rotations (before being composed) take place, referring to them by index (1,2,3) or letter (X,Y,Z). The engineering and robotics communities typically use 3-1-3 Euler angles. Notice that after composing the independent rotations, they do not rotate about the axis anymore. The most external matrix rotates the other two, leaving the second rotation matrix over the line of nodes, and the third one in a frame comoving with the body. There are 3x3x3 = 27 possible definitions for Euler Angle rotations, but not all of them represent real decompositions.

The Euler angles are never expressed in terms of the external frame, or in terms of the co-moving rotated body frame, but in a mixture. Other angle conventions (e.g., Tait-Bryan angles, Fick angles, Helmholtz angles, roll-pitch-yaw, dip-slip-rake, azimuth-elevation-skew) and are used with to avoid this problem.

[edit] Quaternions

Quaternions (Euler symmetric parameters) have proven very useful in representing rotations due to several advantages above the other representations mentioned in this article.

A quaternion representation of rotation is written as a normalized four dimensional vector \hat{\mathbf{q}} = [q_1\ q_2\ q_3\ q_4]^T. In terms of the Euler axis \hat{\mathbf{e}} = [e_x\ e_y\ e_z]^T and angle θ this vector's elements are expressed as follow:

\begin{array}{lcl}  q_1 &=& e_x\sin(\theta/2)\\     q_2 &=& e_y\sin(\theta/2)\\     q_3 &=& e_z\sin(\theta/2)\\     q_4 &=& \cos(\theta/2) \end{array}

The above definition follow the convention as used in (Wertz 1980) and (Markley 2003). An alternative definition used in some publications define the "scalar" term as the first quaternion element, with the other elements shifted down one position. (Coutsias 1999), (Schmidt 2001)

Inspection shows that the quaternion parametrization obeys the following constraint:

q_1^2 + q_2^2 + q_3^2 + q_4^2 = 1.

The last term (in our definition) is often called the scalar term, which has its origin in quaternions when understood as the mathematical extension of the complex numbers, written as

a + bi + cj + dk. with \{a,b,c,d\} \in \mathbb{R},

and where {i,j,k} are the hypercomplex numbers satisfying

\begin{array}{lclclcl}      i^2 &=& j^2 &=& k^2 &=& -1\\     ij &=& -ji &=& k&&\\    jk &=& -kj &=& i&&\\    ki &=& -ik &=& j&& \end{array}

Quaternion multiplication is performed in the same manner as multiplication of complex numbers, except that the order of elements must be taken into account, since multiplication is not commutative. In matrix notation we can write quaternion multiplication as

\tilde{\mathbf{q}}\otimes\mathbf{q} = \left[ {\begin{array}{rrrr}     q_4 &  q_3 & -q_2 &  q_1\\    -q_3 &  q_4 &  q_1 &  q_2\\     q_2 & -q_1 &  q_4 &  q_3\\    -q_1 & -q_2 & -q_3 &  q_4 \end{array}} \right] \left[ {\begin{array}{c}    \tilde{q}_1\\    \tilde{q}_2\\    \tilde{q}_3\\    \tilde{q}_4 \end{array}} \right].

Combining two consecutive quaternion rotations is therefore just as simple as using DCMs. Remember that successive DCM rotations \mathbf{A}_1 and \mathbf{A}_2 are combined as follows:

\mathbf{A}_3 = \mathbf{A}_2\mathbf{A}_1.

We can represent this quaternion parameters in a similarly concise way. Please note the inverse ordering of quaternion multiplication when compared to DCM multiplication.

\mathbf{q}_3 = \mathbf{q}_1 \otimes \mathbf{q}_2.

Quaternions are a very popular parametrization due to the following properties:

  • More compact than the DCM representation and less susceptible to round-off errors
  • The quaternion elements vary continuously over the unit sphere in \mathbb{R}^4, (denoted by S3) as the orientation changes, avoiding discontinuous jumps (inherent to three-dimensional parametrizations)
  • Expression of the DCM in terms of quaternion parameters involves no trigonometric functions
  • It is simple to combine two individual rotations represented as quaternions using a quaternion product

Like DCM's, quaternions must sometimes be re-normalized due to rounding errors, to make sure that they correspond to valid rotations. The cost of re-normalizing a quaternion, however, is much less than for normalizing a 3\times 3 DCM.

[edit] Rodrigues parameters

Rodrigues parameters (also called Gibbs vector) can be expressed in terms of Euler axis and angle as follows:

\mathbf{g} = \hat{\mathbf{e}}\tan(\theta/2).

The Gibbs vector is undefined for 180^\circ rotations, which is undesirable for global attitude representation.

Modified Rodriguez parameters (MRPs) can be expressed in terms of Euler axis and angle by:

\mathbf{p} = \hat{\mathbf{e}}\tan(\theta/4).

The modified Rodrigues parametrization shares many characteristics with the rotation vector parametrization, including the occurrence of discontinuous jumps in the parameter space when incrementing the rotation.

See also: Rodrigues' rotation formula

[edit] Cayley-Klein parameters

See definition at Wolfram Mathworld

[edit] Higher dimensional analogues

See also: SO(4)

[edit] Conversion formulae between representations

[edit] DCM -> Euler angles

The Euler angles (φ,θ,ψ) can be extracted from the rotation matrix \mathbf{A} by inspecting the combined DCM (rotation matrix) in analytical form.

Using the x-convention, the 3-1-3 Euler angles φ, θ and ψ (around the Z,X and again the Z-axis) can be obtained as follows:

\begin{array}{lcl}          \phi &=& \arctan(A_{31},A_{32}),\\      \theta &=& \arccos(A_{33}),\\   \psi &=& -\arctan(A_{13},A_{23}). \end{array}

Note that arctan(a,b) is equivalent to arctan(a / b) where we also take into account the quadrant in which the point (a,b) is in.

[edit] DCM -> Euler axis/angle

If the Euler angle θ is not a multiple of 180^\circ, the Euler axis \hat{\mathbf{e}} = [e_1\ e_2\ e_3]^T and angle θ can be computed from the elements of the rotation matrix \mathbf{A} as follow:

\begin{array}{lcl}           \theta &=& \arccos\left((A_{11}+A_{22}+A_{33}-1)/2\right),\\   e_1 &=& (A_{32}-A_{23})/(2\sin\theta),\\        e_2 &=& (A_{13}-A_{31})/(2\sin\theta),\\        e_3 &=& (A_{21}-A_{12})/(2\sin\theta). \end{array}

Alternatively, the following method can be used:

Eigen-decomposition of the DCM yields the eigenvalues 1, and \cos\theta \pm i\sin\theta. The Euler axis is the eigenvector corresponding to the eigenvalue of 1, and the θ can be computed from the remaining eigenvalues.

[edit] DCM -> quaternion

When computing a quaternion from the DCM parametrization there is a sign abiguity, since \mathbf{q} and -\mathbf{q} represent the same rotation.

One way of computing the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T from the rotation matrix \mathbf{A} is as follows:

\begin{array}{lcl}          q_4 &=& \pm\frac{1}{2}\sqrt{1+A_{11}+A_{22}+A_{33}},\\  q_1 &=& \frac{1}{4q_4}(A_{23}-A_{32}),\\        q_2 &=& \frac{1}{4q_4}(A_{31}-A_{13}),\\        q_3 &=& \frac{1}{4q_4}(A_{12}-A_{21}). \end{array}

There are three other mathematically equivalent ways to compute \mathbf{q}. Numerical inaccuracy can be reduced by avoiding situations in which the denominator (in this case q4) is close to zero. For small angles q_4 \approx 1. One of the other three methods looks as follows:

\begin{array}{lcl}          q_1 &=& \pm\frac{1}{2}\sqrt{1+A_{11}-A_{22}-A_{33}},\\  q_2 &=& \frac{1}{4q_1}(A_{12}+A_{21}),\\        q_3 &=& \frac{1}{4q_1}(A_{13}+A_{31}),\\        q_4 &=& \frac{1}{4q_1}(A_{23}-A_{32}). \end{array}

[edit] Euler angles -> DCM

We will consider the Euler Angle x-convention for the following algorithm.

The DCM of the complete rotation, \mathbf{A}, is the matrix product of the three matrices for the individual rotations. The first rotation's matrix is on the right and the last on the left, since we left-multiply the orientation vector by the rotation matrix.

\mathbf{A} = \mathbf{A}_3\mathbf{A}_2\mathbf{A}_1.

If we use the general convention instead of the x-convention, the order of multiplication is reversed (this can be proven by writing out the equations).

The axes of the rotation depend on the specific convention being used. For rotations about the X, Y and Z axes with angles φ, θ and ψ, the individual matrices are as follows:

\begin{array}{lcl} \mathbf{A}_X &=& \left[\begin{array}{ccc} 1 & 0 & 0\\ 0 & \cos\phi & -\sin\phi\\ 0 & \sin\phi & \cos\phi \end{array} \right],\\ \mathbf{A}_Y &=& \left[\begin{array}{ccc} \cos\theta & 0 & \sin\theta\\ 0 & 1 & 0\\ -\sin\theta & 0 & \cos\theta \end{array} \right],\\ \mathbf{A}_Z &=& \left[\begin{array}{ccc} \cos\psi & -\sin\psi & 0\\ \sin\psi & \cos\psi & 0\\ 0 & 0 & 1 \end{array} \right]. \end{array}

[edit] Euler angles -> quaternion

We will consider the x-convention 3-1-3 Euler Angles for the following algorithm.

We can compute the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T from the Euler angles (φ,θ,ψ) as follows:

\begin{array}{lcl}          q_1 &=& -\cos\left((\phi-\psi)/2\right)\sin(\theta/2),\\        q_2 &=& \sin\left((\phi-\psi)/2\right)\sin(\theta/2),\\         q_3 &=& -\sin\left((\phi+\psi)/2\right)\cos(\theta/2),\\        q_4 &=& \cos\left((\phi+\psi)/2\right)\cos(\theta/2). \end{array}

See also: conversion between quaternions and Euler angles

[edit] Euler axis/angle -> DCM

The DCM corresponding to an Euler axis \hat{\mathbf{e}} = [e_1\ e_2\ e_3]^T and angle θ can be computed as follows:

\mathbf{A} = \mathbf{I}_3\cos\theta + (1-\cos\theta)\hat{\mathbf{e}}\hat{\mathbf{e}}^T - \mathbf{\mathcal{E}}\sin\theta

with \mathbf{I}_3 the 3\times3 identity matrix, and

\mathbf{\mathcal{E}} = \left[\begin{array}{ccc} 0 & -e_3 & e_2\\ e_3 & 0 & -e_1\\ -e_2 & e_1 & 0 \end{array} \right].

[edit] Euler axis/angle -> quaternion

Given the Euler axis \hat{\mathbf{e}} and angle θ, the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T can be computed by

\begin{array}{lcl}  q_1 &=& \hat{e}_1\sin(\theta/2),\\      q_2 &=& \hat{e}_2\sin(\theta/2),\\      q_3 &=& \hat{e}_3\sin(\theta/2),\\      q_4 &=& \cos(\theta/2). \end{array}

[edit] Quaternion -> DCM

The DCM corresponding to the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T can be computed as follows:

\mathbf{A} = (q_4^2 - \check{\mathbf{q}}^T\check{\mathbf{q}})\mathbf{I}_3 + 2\check{\mathbf{q}}\check{\mathbf{q}}^T - 2q_4\mathbf{\mathcal{Q}}

with \mathbf{I}_3 the 3\times3 identity matrix, and

\check{\mathbf{q}} = \left[\begin{array}{c} q_1\\q_2\\q_3\end{array} \right],\ \ \ \mathbf{\mathcal{Q}} = \left[\begin{array}{ccc} 0 & -q_3 & q_2\\ q_3 & 0 & -q_1\\ -q_2 & q_1 & 0 \end{array} \right].

[edit] Quaternion -> Euler angles

Given the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T, the x-convention 3-1-3 Euler angles (φ,θ,ψ) can be computed by

\begin{array}{lcl}  \phi &=& \arctan((q_1q_3+q_2q_4),(q_2q_3-q_1q_4)),\\    \theta &=& \arccos(-q_1^2-q_2^2+q_3^2+q_4^2),\\         \psi &=& -\arctan((q_1q_3-q_2q_4),(q_2q_3+q_1q_4)). \end{array}

See also: conversion between quaternions and Euler angles

[edit] Quaternion -> Euler axis/angle

Given the quaternion \mathbf{q} = [q_1\ q_2\ q_3\ q_4]^T, define \check{\mathbf{q}} = [q_1\ q_2\ q_3]^T. Then the Euler axis \hat{\mathbf{e}} and angle θ can be computed by

\begin{array}{lcl}  \hat{\mathbf{e}} &=& \frac{\check{\mathbf{q}}}{\|\check{\mathbf{q}}\|},\\       \theta &=& 2\arccos(q_4). \end{array}

[edit] See also

[edit] References

  • Evangelos A. Coutsias and Louis Romero, (1999) The Quaternions with an application to Rigid Body Dynamics, Department of Mathematics and Statistics, University of New Mexico.
  • F. Landis Markley, (2003) Attitude Error Representations for Kalman Filtering, Journal of Guidance, Control and Dynamics
  • J. Schmidt and H. Niemann, (2001) Using Quaternions for Parametrizing 3-D Rotations in Unconstrained Nonlinear Optimization, Vision, Modeling and Visualization (VMV01)
  • James R. Wertz, (1980) Spacecraft Attitude Determination and Control, D Reidel Publishing Company. ISBN 90-277-1204-2