# Axis–angle representation

(Redirected from Axis angle)
A visualization of a rotation represented by an Euler axis and angle.

The axis-angle representation of a rotation parameterizes a rotation of a rigid body in a three-dimensional space by two values: a unit vector $\mathbf{\hat{e}}$ indicating the direction of an axis of rotation, and an angle θ describing the magnitude of the rotation about the axis. The rotation occurs in the sense prescribed by the right-hand rule. The rotation axis is sometimes called Euler axis.

This representation evolves from Euler's rotation theorem, which implies 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.

The axis-angle representation is equivalent to the more concise rotation vector, or Euler vector. In this case, both the rotation axis and the angle are represented by a vector codirectional with the rotation axis whose magnitude is the rotation angle θ:

$\mathbf{e} = \theta \mathbf{\hat{e}}$

Rodrigues' rotation formula can be used to apply to a vector a rotation represented by an axis and an angle.

## 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.

## Example

Say you are standing on the ground and you pick the direction of gravity to be the negative z direction. Then if you turn to your left, you will travel $\tfrac{\pi}{2}$ radians (or 90 degrees) about the z axis. In axis-angle representation, this would be

$\langle \mathrm{axis}, \mathrm{angle} \rangle = \left( \begin{bmatrix} a_x \\ a_y \\ a_z \end{bmatrix},\theta \right) = \left( \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix},\frac{\pi}{2}\right)$

### Rotation vector

The above example can be represented as a rotation vector with a magnitude of $\tfrac{\pi}{2}$ pointing in the z direction.

$\begin{bmatrix} 0 \\ 0 \\ \frac{\pi}{2} \end{bmatrix}$

This is the product of the angle and vector. It is more compact and is used for the exponential and log maps involving this representation.

## Simultaneous orthogonal rotation angle

The orientation of a rigid-body indicated with three simultaneous rotations around the rigid-body's intrisic axes and their single rotation equivalent.

Simultaneous Orthogonal Rotations Angle (SORA) is a vector representing angular orientation of a rigid-body relative to some reference frame. The components of this vector are equal to the angles of three simultaneous rotations around the rigid body's intrinsic coordinate system axes, initially aligned with the axes of the reference frame, needed to move the rigid body to its current angular orientation.

Every angular orientation can be represented by a single rotation. Therefore, the three simultaneous orthogonal rotations actually represent a single rotation around a certain axis v and for a certain angle $\varphi$. The orientation and magnitude of SORA are equal to this equivalent single rotation axis v and angle $\varphi$, respectively. SORA is therefore the rotation vector. Denoting the angles of the three simultaneous orthogonal rotations with $\varphi_x$, $\varphi_y$, and $\varphi_z$, SORA is equal to:

$\mathbf{\Phi}=\begin{bmatrix} \varphi_x \\ \varphi_y \\ \varphi_z \end{bmatrix}=\mathbf{v}\phi$

where v and $\phi$ are the equivalent single rotation axis and angle respectively, equal to:

$\mathbf{v}=\frac{1}{\sqrt{\varphi_x^2+\varphi_y^2+\varphi_z^2}}\begin{bmatrix} \varphi_x \\ \varphi_y \\ \varphi_z \end{bmatrix},$
$\phi=\sqrt{\varphi_x^2+\varphi_y^2+\varphi_z^2}.$

An analytic derivation of these single rotation equivalent axis and angle is achieved by decomposing the total rotation to an infinite sequence of infinitesimally small rotations.[1]

The most common scenario, where simultaneous rotation around three orthogonal axes can be observed is when performing measurements with a gyroscope. The three simultaneous orthogonal rotations measured with a 3D gyroscope represent a single rotation around a certain axis for a certain angle. When the measured angular velocities or their proportions are constant, this rotation and the resulting angular orientation can be uniquely represented with SORA. When this condition is met, the orientation of the rotation axis does not change and the components of SORA are equal to the angles of three simultaneous rotations measured with a 3D gyroscope.

Using gyroscope measurements that provide rotation angle estimation, it is reasonable to combine angular velocities around three orthogonal axes in vector form:

$\mathbf{\Omega}=\begin{bmatrix} \omega_x \\ \omega_y \\ \omega_z \end{bmatrix}.$

Angular velocity vector $\Omega$ is orthogonal to the rotation plane, and its magnitude is equal to the angular velocity in that plane. When the measured angular velocities or their proportions are approximately constant, the orientation of the rotation axis is also constant. It then holds:

$\mathbf{\Omega}=\frac{\mathbf{\Phi}}{T}.$

SORA represents a unique angular orientation of a rigid-body relative to some reference frame. Using SORA as a generalized representation of angular orientation, we can avoid the problem of rotation non-commutativity. As SORA indicates a single rotation for a specific angular orientation, the Gimbal problem is here avoided. Because of the mentioned, SORA is much more suitable for representation of angular orientation than widely used Euler angles.

SORA is simple and well-suited for use in the real-time calculation of orientation based on angular velocity measurements derived using a gyroscope, as long as the measured angular velocities or their proportions are approximately constant. Under this condition, using SORA, orientation calculation only requires a single step.[1] SORA is appropriate for use in a number of applications that require angular orientation information, including navigation and motion tracking.

Finally, SORA helps interpret the meaning of the rotation vector with measurable quantities.

## Rotating a vector

Rodrigues' rotation formula (named after Olinde Rodrigues) is an efficient algorithm for rotating a vector in space, given a rotation axis and an angle of rotation. In other words, the Rodrigues formula provides an algorithm to compute the exponential map from so(3) to SO(3) without computing the full matrix exponent (the rotation matrix).

If v is a vector in $\mathbb{R}^3$ and ω is a unit vector describing an axis of rotation about which we want to rotate v by an angle θ (in a right-handed sense), the Rodrigues formula to obtain the rotated vector is:

$\mathbf{v}_\mathrm{rot} = \mathbf{v} \cos\theta + (\mathbf{\omega} \times \mathbf{v})\sin\theta + \mathbf{\omega} (\mathbf{\omega} \cdot \mathbf{v}) (1 - \cos\theta).$

This is more efficient than converting ω and θ into a rotation matrix, and using the rotation matrix to compute the rotated vector.

## Relationship to other representations

There are many ways to represent a rotation. It is useful to understand how different representations relate to one another, and how to convert between them.

### Exponential map from so(3) to SO(3)

The exponential map is used as a transformation from axis-angle representation of rotations to rotation matrices.

$\exp\colon so(3) \to SO(3)$

Essentially, by using a Taylor expansion you can derive a closed form relationship between these two representations. Given a unit vector $\omega \in \Bbb{R}^{3}$ representing the Euler axis, and an angle, $\theta \in \Bbb{R}$, an equivalent rotation matrix is given by the following:

$R = \exp([\omega]_\times \theta) = \sum_{k=0}^\infty\frac{([\omega]_\times\theta)^k}{k!} = I + [\omega]_\times \theta + \frac{1}{2!}([\omega]_\times\theta)^2 + \frac{1}{3!}([\omega]_\times\theta)^3 + \cdots$
$R = I + [\omega]_\times\left(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\right) + [\omega]_\times^2 \left(\frac{\theta^2}{2!} - \frac{\theta^4}{4!} + \frac{\theta^6}{6!} - \cdots\right)$
$R = I + [\omega]_\times \sin(\theta) + [\omega]_\times^2 (1-\cos(\theta))$

where R is a 3×3 rotation matrix and $[\omega]_\times$ is the cross product matrix of $\omega$. This can be easily derived from Rodrigues' rotation formula. – Due to the existence of the above mentioned exponential map, the unit vector $\omega$ representing the rotation axis, and the angle $\theta$ are sometimes called the exponential coordinates of the rotation matrix R.

### Log map from SO(3) to so(3)

To retrieve the axis-angle representation of a rotation matrix calculate the angle of rotation:

$\theta = \arccos\left( \frac{\mathrm{trace}(R) - 1}{2} \right)$

and then use it to find the normalized axis:

$\omega = \frac{1}{2 \sin(\theta)} \begin{bmatrix} R(3,2)-R(2,3) \\ R(1,3)-R(3,1) \\ R(2,1)-R(1,2) \end{bmatrix}$

Note, also that the Matrix logarithm of the rotation matrix R is:

$\log R = \left\{ \begin{matrix} 0 & \mathrm{if} \; \theta = 0 \\ \frac{\theta}{2 \sin(\theta)} (R - R^\top) & \mathrm{if} \; \theta \ne 0 \; \mathrm{and} \; \theta \in (-\pi, \pi) \end{matrix}\right.$

Except when R has eigenvalues equal to -1 where the log is not unique. However, even in the case where $\theta = \pi$ the Frobenius norm of the log is:

$\| \log(R) \|_F = \sqrt{2} | \theta |$

Note that given rotation matrices A and B:

$d_g(A,B) := \| \log(A^\top B)\|_F$

is the geodesic distance on the 3D manifold of rotation matrices. Note that for small rotations, the above computation of $\theta$ may be numerically imprecise as the derivative of arccos goes to infinity as theta approaches zero. In that case, the off-axis terms will provide better information about $\theta$, as for small angles, $R\approx [\mathbf{v}]_\times + I$ where $[\mathbf{v}]_\times$ is the matrix representation of the cross product.

This formulation also has numerical problems at $\theta=\pi$. There, the off-axis terms don't 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 + [\omega]_\times \sin(\theta) + [\omega]_\times^2 (1-\cos(\theta))$

At $\theta=\pi$ we have

$R = I + 2 [\omega]_\times^2 = I + 2(\omega \otimes \omega - I) = 2 \omega \otimes \omega - I$

and so let

$B:=\omega \otimes \omega = \frac{1}{2}(R+I)$

so the diagonal terms of B are the squares of the elements of $\omega$ and the signs (up to sign ambiguity) can be determined from the signs of the off-axis terms of B.

### Unit Quaternions

To transform from axis-angle coordinates to unit quaternions use the following expression:

$Q = \left(\cos\left(\frac{\theta}{2}\right), \omega \sin\left(\frac{\theta}{2}\right)\right)$

Given a unit quaternion, $w,x,y,z$, the axis-angle coordinates can be extracted using the following:

$\theta = 2\,\arccos(w)\,$
$\omega = \left\{ \begin{matrix} \frac{q}{ \sin( \theta/2 ) } , & \mathrm{if} \; \theta \neq 0 \\ 0, & \mathrm{otherwise} \end{matrix} \right.$

A more numerically stable expression of the rotation angle is the following:

$\theta = 2\,\arctan2(\|[x\,y\,z]\|,w)\,$

It may also be useful to know:

$\frac{q}{ \sin( \theta/2 ) } = \frac{[x\,y\,z]^\top}{ \|[x\,y\,z]\|}$