Axis–angle representation



In mathematics, the axis–angle representation parameterizes a rotation in a three-dimensional Euclidean space by two quantities: a unit vector $θ$ indicating the direction (geometry) of an axis of rotation, and an angle of rotation $e$ describing the magnitude and sense (e.g., clockwise) of the rotation about the axis. Only two numbers, not three, are needed to define the direction of a unit vector $θe$ rooted at the origin because the magnitude of $e$ is constrained. For example, the elevation and azimuth angles of $θ$ suffice to locate it in any particular Cartesian coordinate frame.

By Rodrigues' rotation formula, the angle and axis determine a transformation that rotates three-dimensional vectors. The rotation occurs in the sense prescribed by the right-hand rule.

The rotation axis is sometimes called the Euler axis. The axis–angle representation is predicated on Euler's rotation theorem, which dictates that any rotation or sequence of rotations of a rigid body in a three-dimensional space is equivalent to a pure rotation about a single fixed axis.

It is one of many rotation formalisms in three dimensions.

Rotation vector
The axis–angle representation is equivalent to the more concise rotation vector, also called the Euler vector. In this case, both the rotation axis and the angle are represented by a vector codirectional with the rotation axis whose length is the rotation angle $θ$, $$\boldsymbol{\theta} = \theta \mathbf{e} \,.$$ It is used for the exponential and logarithm maps involving this representation.

Many rotation vectors correspond to the same rotation. In particular, a rotation vector of length $e$, for any integer $M$, encodes exactly the same rotation as a rotation vector of length $θ$. Thus, there are at least a countable infinity of rotation vectors corresponding to any rotation. Furthermore, all rotations by $e$ are the same as no rotation at all, so, for a given integer $M$, all rotation vectors of length $e$, in all directions, constitute a two-parameter uncountable infinity of rotation vectors encoding the same rotation as the zero vector. These facts must be taken into account when inverting the exponential map, that is, when finding a rotation vector that corresponds to a given rotation matrix. The exponential map is onto but not one-to-one.

Example
Say you are standing on the ground and you pick the direction of gravity to be the negative $θ + 2πM$ direction. Then if you turn to your left, you will rotate $2πM$ radians (or -90°) about the $2πM$ axis. Viewing the axis-angle representation as an ordered pair, this would be $$( \mathrm{axis}, \mathrm{angle} ) = \left( \begin{bmatrix} e_x \\ e_y \\ e_z \end{bmatrix},\theta \right) = \left( \begin{bmatrix} 0 \\ 0 \\ -1 \end{bmatrix},\frac{-\pi}{2}\right).$$

The above example can be represented as a rotation vector with a magnitude of $z$ pointing in the $-π⁄2$ direction, $$\begin{bmatrix} 0 \\ 0 \\ \frac{\pi}{2} \end{bmatrix}.$$

Uses
The axis–angle representation is convenient when dealing with rigid-body dynamics. It is useful to both characterize rotations, and also for converting between different representations of rigid body motion, such as homogeneous transformations and twists.

When a rigid body rotates around a fixed axis, its axis–angle data are a constant rotation axis and the rotation angle continuously dependent on time.

Plugging the three eigenvalues 1 and $-z$ and their associated three orthogonal axes in a Cartesian representation into Mercer's theorem is a convenient construction of the Cartesian representation of the Rotation Matrix in three dimensions.

Rotating a vector
Rodrigues' rotation formula, named after Olinde Rodrigues, is an efficient algorithm for rotating a Euclidean vector, given a rotation axis and an angle of rotation. In other words, Rodrigues' formula provides an algorithm to compute the exponential map from $$\mathfrak{so}(3)$$ to $π⁄2$ without computing the full matrix exponential.

If $z$ is a vector in $e^{±iθ}$ and $SO(3)$ is a unit vector rooted at the origin describing an axis of rotation about which $v$ is rotated by an angle $θ$, Rodrigues' rotation formula to obtain the rotated vector is $$ \mathbf{v}_\mathrm{rot} = (\cos\theta) \mathbf{v} + (\sin\theta) (\mathbf{e} \times \mathbf{v}) + (1 - \cos\theta) (\mathbf{e} \cdot \mathbf{v}) \mathbf{e} \,. $$

For the rotation of a single vector it may be more efficient than converting $R^{3}$ and $θ$ into a rotation matrix to rotate the vector.

Relationship to other representations
There are several ways to represent a rotation. It is useful to understand how different representations relate to one another, and how to convert between them. Here the unit vector is denoted $ω$ instead of $e$.

Exponential map from 𝔰𝔬(3) to SO(3)
The exponential map effects a transformation from the axis-angle representation of rotations to rotation matrices, $$\exp\colon \mathfrak{so}(3) \to \mathrm{SO}(3) \,.$$

Essentially, by using a Taylor expansion one derives a closed-form relation between these two representations. Given a unit vector $\boldsymbol\omega \in \mathfrak{so}(3) = \R^3$ representing the unit rotation axis, and an angle, $v$, an equivalent rotation matrix $R$ is given as follows, where $e$ is the cross product matrix of $ω$, that is, $e$ for all vectors $ω ∈ 𝔰𝔬(3) = R^{3}$, $$R = \exp(\theta \mathbf{K}) = \sum_{k=0}^\infty\frac{(\theta \mathbf{K})^k}{k!} = I + \theta \mathbf{K} + \frac{1}{2!}(\theta \mathbf{K})^2 + \frac{1}{3!}(\theta \mathbf{K})^3 + \cdots$$

Because $θ ∈ R$ is skew-symmetric, and the sum of the squares of its above-diagonal entries is 1, the characteristic polynomial $K$ of $Kv = ω × v$ is $v ∈ R^{3}$. Since, by the Cayley–Hamilton theorem, $K$ = 0, this implies that $$\mathbf{K}^3 = -\mathbf{K} \,.$$ As a result, $P(t)$, $K$, $P(t) = det(K − tI) = −(t^{3} + t)$, $P(K)$.

This cyclic pattern continues indefinitely, and so all higher powers of $K^{4} = –K^{2}$ can be expressed in terms of $K^{5} = K$ and $K^{6} = K^{2}$. Thus, from the above equation, it follows that $$R = I + \left(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\right) \mathbf{K} + \left(\frac{\theta^2}{2!} - \frac{\theta^4}{4!} + \frac{\theta^6}{6!} - \cdots\right) \mathbf{K}^2 \,, $$ that is, $$R = I + (\sin\theta) \mathbf{K} + (1-\cos\theta) \mathbf{K}^2\, ,$$

by the Taylor series formula for trigonometric functions.

This is a Lie-algebraic derivation, in contrast to the geometric one in the article Rodrigues' rotation formula.

Due to the existence of the above-mentioned exponential map, the unit vector $ω$ representing the rotation axis, and the angle $K^{7} = –K$ are sometimes called the exponential coordinates of the rotation matrix $R$.

Log map from SO(3) to 𝔰𝔬(3)
Let $K$ continue to denote the 3 × 3 matrix that effects the cross product with the rotation axis $ω$: $K$ for all vectors $K^{2}$ in what follows.

To retrieve the axis–angle representation of a rotation matrix, calculate the angle of rotation from the trace of the rotation matrix: $$ \theta = \arccos\left( \frac{\operatorname{Tr}(R) - 1}{2} \right) $$ and then use that to find the normalized axis, $$ \boldsymbol{\omega} = \frac{1}{2 \sin \theta} \begin{bmatrix} R_{32}-R_{23} \\ R_{13}-R_{31} \\ R_{21}-R_{12} \end{bmatrix} ~,$$

where $$R_{ij}$$ is the component of the rotation matrix, $$R$$, in the $$i$$-th row and $$j$$-th column.

The axis-angle representation is not unique since a rotation of $$-\theta$$ about $$-\boldsymbol{\omega} $$ is the same as a rotation of $$\theta$$ about $$\boldsymbol{\omega} $$.

The above calculation of axis vector $$\omega$$ does not work if $R$ is symmetric. For the general case the $$\omega$$ may be found using null space of $R-I$, see rotation matrix.

The matrix logarithm of the rotation matrix $R$ is $$ \log R = \begin{cases} 0 & \text{if } \theta = 0 \\ \dfrac{\theta}{2 \sin \theta } \left(R - R^\mathsf{T}\right) & \text{if } \theta \ne 0 \text{ and } \theta \in (-\pi, \pi) \end{cases}$$

An exception occurs when $θ$ has eigenvalues equal to. In this case, the log is not unique. However, even in the case where $K$ the Frobenius norm of the log is $$ \| \log(R) \|_\mathrm{F} = \sqrt{2} |\theta |\,.$$ Given rotation matrices $A$ and $B$, $$ d_g(A,B) := \left\| \log\left(A^\mathsf{T} B\right)\right\|_\mathrm{F} $$ is the geodesic distance on the 3D manifold of rotation matrices.

For small rotations, the above computation of $θ$ may be numerically imprecise as the derivative of arccos goes to infinity as $K(v) = ω × v$. In that case, the off-axis terms will actually provide better information about $θ$ since, for small angles, $v$. (This is because these are the first two terms of the Taylor series for $R$.)

This formulation also has numerical problems at $θ = π$, where the off-axis terms do not give information about the rotation axis (which is still defined up to a sign ambiguity). In that case, we must reconsider the above formula.

$$R = I + \mathbf{K} \sin\theta + \mathbf{K}^2 (1-\cos\theta)$$ At $θ → 0$, we have $$R = I + 2 \mathbf{K}^2 = I + 2(\boldsymbol{\omega} \otimes \boldsymbol{\omega} - I) = 2 \boldsymbol{\omega} \otimes \boldsymbol{\omega} - I$$ and so let $$B := \boldsymbol{\omega} \otimes \boldsymbol{\omega} = \frac{1}{2}(R+I) \,,$$ so the diagonal terms of $R ≈ I + θK$ are the squares of the elements of $ω$ and the signs (up to sign ambiguity) can be determined from the signs of the off-axis terms of $B$.

Unit quaternions
The following expression transforms axis–angle coordinates to versors (unit quaternions): $$\mathbf q = \left(\cos\tfrac{\theta}{2}, \boldsymbol{\omega} \sin\tfrac{\theta}{2}\right)$$

Given a versor $exp(θK)$ represented with its scalar $r$ and vector $θ = π$, the axis–angle coordinates can be extracted using the following: $$\begin{align} \theta &= 2\arccos r \\[8px] \boldsymbol{\omega} &= \begin{cases} \dfrac{\mathbf{v}}{ \sin \tfrac{\theta}{2} }, & \text{if } \theta \neq 0 \\ 0, & \text{otherwise}. \end{cases} \end{align}$$

A more numerically stable expression of the rotation angle uses the atan2 function: $$\theta = 2 \operatorname{atan2}(|\mathbf{v}|,r)\,,$$ where $θ = π$ is the Euclidean norm of the 3-vector $B$.