{{Short description|Parameterization of a rotation into a unit vector and angle}} {{Broader|3D rotation group}} 150px|thumb|right|The angle {{math|''θ''}} and axis unit vector {{math|'''e'''}} define a rotation, concisely represented by the rotation vector {{math|''θ'''''e'''}}.
In mathematics, the '''axis–angle representation''' parameterizes a rotation in a three-dimensional Euclidean space by two quantities: a unit vector {{math|'''e'''}} indicating the direction of an axis of rotation, and an angle of rotation {{math|''θ''}} 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 {{math|'''e'''}} rooted at the origin because the magnitude of {{math|'''e'''}} is constrained. For example, the elevation and azimuth angles of {{math|'''e'''}} 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''' (not to be confused with a vector of Euler angles). 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 {{mvar|θ}}, <math display="block">\boldsymbol{\theta} = \theta \mathbf{e} \,.</math> 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 {{math|''θ'' + 2''πM''}}, for any integer {{mvar|M}}, encodes exactly the same rotation as a rotation vector of length {{mvar|θ}}. Thus, there are at least a countable infinity of rotation vectors corresponding to any rotation. Furthermore, all rotations by {{math|2''πM''}} are the same as no rotation at all, so, for a given integer {{mvar|M}}, all rotation vectors of length {{math|2''πM''}}, 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 {{math|''z''}} direction. Then if you turn to your left, you will rotate {{math|{{sfrac|-π|2}}}} radians (or -90°) about the {{math|''-z''}} axis. Viewing the axis-angle representation as an ordered pair, this would be <math display="block">( \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).</math>
The above example can be represented as a rotation vector with a magnitude of {{math|{{sfrac|π|2}}}} pointing in the {{math|''z''}} direction, <math display="block">\begin{bmatrix} 0 \\ 0 \\ \frac{\pi}{2} \end{bmatrix}.</math>
thumb|Animated example of axis-angle representation with axis direction (1, 1.5, 0.5) and varying rotation 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{{clarify|date=January 2014}} 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 {{math|''e''<sup>±''iθ''</sup>}} 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.
==Application== {{Main|Rodrigues' rotation formula}}
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 <math>\mathfrak{so}(3)</math> to {{math|SO(3)}} without computing the full matrix exponential.
If {{math|'''v'''}} is a vector in {{math|'''R'''<sup>3</sup>}} and {{math|'''e'''}} is a unit vector rooted at the origin describing an axis of rotation about which {{math|'''v'''}} is rotated by an angle {{mvar|θ}}, Rodrigues' rotation formula to obtain the rotated vector is <math display="block"> \mathbf{v}_\mathrm{rot} = \mathbf{v} + (\sin\theta) (\mathbf{e} \times \mathbf{v}) + (1 - \cos\theta) (\mathbf{e} \times (\mathbf{e} \times \mathbf{v})) \,. </math>
For the rotation of a single vector it may be more efficient than converting {{math|'''e'''}} and {{mvar|θ}} into a rotation matrix to rotate the vector.
==Relationship to other representations== {{Further|Charts on SO(3)}} 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 {{mvar|'''ω'''}} instead of {{math|'''e'''}}.
===Exponential map from 𝔰𝔬(3) to SO(3)=== {{Further|Matrix exponential|Orthogonal matrix|Lie algebra #Relation to Lie groups|Rotation group SO(3)#Exponential map}}
The exponential map effects a transformation from the axis-angle representation of rotations to rotation matrices, <math display="block">\exp\colon \mathfrak{so}(3) \to \mathrm{SO}(3) \,.</math>
Essentially, by using a Taylor expansion one derives a closed-form relation between these two representations. Given a unit vector <math display="inline">\boldsymbol\omega \in \mathfrak{so}(3) = \R^3</math><!--{{math|1='''''ω''''' ∈ 𝔰𝔬(3) = '''R'''<sup>3</sup>}}--> representing the unit rotation axis, and an angle, {{math|''θ'' ∈ '''R'''}}, an equivalent rotation matrix {{mvar|R}} is given as follows, where {{math|'''K'''}} is the cross product matrix of {{mvar|'''ω'''}}, that is, {{math|1='''Kv''' = '''''ω''''' × '''v'''}} for all vectors {{math|'''v''' ∈ '''R'''<sup>3</sup>}}, <math display="block">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</math>
Because {{math|'''K'''}} is skew-symmetric, and the sum of the squares of its above-diagonal entries is 1, the characteristic polynomial {{math|''P''(''t'')}} of {{math|'''K'''}} is {{math|1=''P''(''t'') = det('''K''' − ''t'''''I''') = −(''t''<sup>3</sup> + ''t'')}}. Since, by the Cayley–Hamilton theorem, {{math|''P''('''K''')}} = 0, this implies that <math display="block">\mathbf{K}^3 = -\mathbf{K} \,.</math> As a result, {{math|1='''K'''<sup>4</sup> = –'''K'''<sup>2</sup>}}, {{math|1='''K'''<sup>5</sup> = '''K'''}}, {{math|1='''K'''<sup>6</sup> = '''K'''<sup>2</sup>}}, {{math|1='''K'''<sup>7</sup> = –'''K'''}}.
This cyclic pattern continues indefinitely, and so all higher powers of {{math|'''K'''}} can be expressed in terms of {{math|'''K'''}} and {{math|'''K'''<sup>2</sup>}}. Thus, from the above equation, it follows that <math display="block">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 \,, </math> that is, <math display="block">R = I + (\sin\theta) \mathbf{K} + (1-\cos\theta) \mathbf{K}^2\, ,</math>
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.<ref>This holds for the triplet representation of the rotation group, i.e., spin 1. For higher dimensional representations/spins, see {{cite journal |last1=Curtright |first1=T. L. |authorlink1=Thomas Curtright |last2=Fairlie |first2=D. B. |authorlink2=David Fairlie |last3=Zachos |first3=C. K. |authorlink3=Cosmas Zachos |year=2014 |title=A compact formula for rotations as spin matrix polynomials |journal=SIGMA |volume=10 |page=084 |arxiv=1402.3541 |bibcode=2014SIGMA..10..084C |s2cid=18776942 |doi=10.3842/SIGMA.2014.084}}</ref>
Due to the existence of the above-mentioned exponential map, the unit vector {{mvar|'''ω'''}} representing the rotation axis, and the angle {{math|''θ''}} are sometimes called the ''exponential coordinates'' of the rotation matrix {{mvar|R}}.
===Log map from SO(3) to 𝔰𝔬(3)=== {{Further|Rotation group SO(3)|Infinitesimal transformation}} Let {{math|'''K'''}} continue to denote the 3 × 3 matrix that effects the cross product with the rotation axis {{mvar|'''ω'''}}: {{math|1='''K'''('''v''') = '''''ω''''' × '''v'''}} for all vectors {{math|'''v'''}} 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: <math display="block"> \theta = \arccos\left( \frac{\operatorname{Tr}(R) - 1}{2} \right) </math> and then use that to find the normalized axis, <math display="block"> \boldsymbol{\omega} = \frac{1}{2 \sin \theta} \begin{bmatrix} R_{32}-R_{23} \\ R_{13}-R_{31} \\ R_{21}-R_{12} \end{bmatrix} ~,</math>
where <math>R_{ij}</math> is the component of the rotation matrix, <math>R</math>, in the <math>i</math>-th row and <math>j</math>-th column.
This formula '''does not work''' for <math>\omega</math> if {{mvar|R}} is symmetric. Because, this is possible only when <math>\theta = k \pi</math> for some integer <math>k</math>, so sin(<math>\theta</math>) = 0, causing a division by 0 in the formula. However, the ''limit'' of the formula for <math>\omega</math>, as <math>\theta \to k \pi</math>, gives the correct value for <math>\omega</math>. For the general case the <math>\omega</math> may also be found using null space of {{mvar|R-I}}, see rotation matrix#Determining the axis.
The axis-angle representation is not unique since a rotation of <math>-\theta</math> about <math>-\boldsymbol{\omega} </math> is the same as a rotation of <math>\theta</math> about <math>\boldsymbol{\omega} </math>. Of course, adding any integer multiple of 2π to <math>\theta</math> will also result in the identical rotation; a better method is to constrain <math>\theta</math> to the interval [0, 2π) or (-π, π].
If <math>\theta</math> is sought for a known <math>(R,\omega)</math> pair, then it '''must be consistent''' with the orientation of the <math>\omega</math> axis (in other words, it must lie in the appropriate quadrant of the unit circle defined by <math>\sin \theta</math> and <math>\cos \theta</math>). Considering that the cross-product matrix <math>\mathbf{K}</math> is also available for a given <math>\omega</math>, this consistency can be ensured by generalizing the above trace formula as follows: <ref> {{Cite journal | last = Dai | first = Jian S. | year = 2012 | title = Finite Displacement Screw Operators with Embedded Chasles' Motion | journal = Journal of Mechanisms and Robotics | volume = 4 | issue = 4 | pages = 041002 | doi = 10.1115/1.4006951 }} Note that the original formula, given in Eq. (28) of the paper, includes a factor of <math>0.5</math> in both arguments of the <math>{\rm atan2}(.,.)</math> function. However, this factor can be safely omitted, because <math>\operatorname{atan2}(\alpha y, \alpha x) = \operatorname{atan2}(y, x)</math> for any <math>\alpha > 0</math> and <math>x,y \in \mathbb{R}</math>. </ref> <math display="block"> \theta = {\rm atan2}(-{\rm Tr}(\mathbf{K} R), {\rm Tr}(R) - 1), </math> where atan2 is the two-argument arctangent function, which provides the correct sign for <math>\theta</math> in the <math>(-\pi,\pi]</math> interval. This method resolves the sign ambiguity that exists in the off-axis terms of <math>R</math>.
The matrix logarithm of the rotation matrix {{mvar|R}} is <math display="block"> \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}</math>
An exception occurs when {{math|''R''}} has eigenvalues equal to {{num|−1}}. In this case, the log is not unique. However, even in the case where {{math|1=''θ'' = ''π''}} the Frobenius norm of the log is <math display="block"> \| \log(R) \|_\mathrm{F} = \sqrt{2} |\theta |\,.</math> Given rotation matrices {{mvar|A}} and {{mvar|B}}, <math display="block"> d_g(A,B) := \left\| \log\left(A^\mathsf{T} B\right)\right\|_\mathrm{F} </math> is the geodesic distance on the 3D manifold of rotation matrices.
For small rotations, the above computation of {{mvar|θ}} may be numerically imprecise as the derivative of arccos goes to infinity as {{math|''θ'' → 0}}. In that case, the off-axis terms will actually provide better information about {{mvar|θ}} since, for small angles, {{math|''R'' ≈ ''I'' + ''θ'''''K'''}}. (This is because these are the first two terms of the Taylor series for {{math|exp(''θ'''''K''')}}.)
This formulation also has numerical problems at {{math|1=''θ'' = ''π''}}, 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.
<math display="block">R = I + \mathbf{K} \sin\theta + \mathbf{K}^2 (1-\cos\theta)</math> At {{math|1=''θ'' = ''π''}}, we have <math display="block">R = I + 2 \mathbf{K}^2 = I + 2(\boldsymbol{\omega} \otimes \boldsymbol{\omega} - I) = 2 \boldsymbol{\omega} \otimes \boldsymbol{\omega} - I</math> and so let <math display="block">B := \boldsymbol{\omega} \otimes \boldsymbol{\omega} = \frac{1}{2}(R+I) \,,</math> so the diagonal terms of {{math|''B''}} are the squares of the elements of {{mvar|'''ω'''}} and the signs (up to sign ambiguity) can be determined from the signs of the off-axis terms of {{mvar|B}}.
===Unit quaternions=== {{main|Quaternions and spatial rotation}} The following expression transforms axis–angle coordinates to versors (unit quaternions): <math display="block">\mathbf q = \left(\cos\tfrac{\theta}{2}, \boldsymbol{\omega} \sin\tfrac{\theta}{2}\right)</math>
Given a versor {{math|1='''q''' = ''r'' + '''v'''}} represented with its scalar {{mvar|r}} and vector {{math|'''v'''}}, the axis–angle coordinates can be extracted using the following: <math display="block">\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}</math>
A more numerically stable expression of the rotation angle uses the atan2 function: <math display="block">\theta = 2 \operatorname{atan2}(|\mathbf{v}|,r)\,,</math> where {{math|{{abs|'''v'''}}}} is the Euclidean norm of the 3-vector {{math|'''v'''}}.
==See also== * Homogeneous coordinates * Pseudovector * Rotations without a matrix * Screw theory, a representation of rigid-body motions and velocities using the concepts of twists, screws, and wrenches
==References== {{Reflist}}
{{DEFAULTSORT:Axis Angle Representation}} Category:Rotation in three dimensions Category:Angle