Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Rotation matrix
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Conversion from rotation matrix to axis–angle=== Every rotation in three dimensions is defined by its '''axis''' (a vector along this axis is unchanged by the rotation), and its '''angle''' — the amount of rotation about that axis ([[Euler rotation theorem]]). There are several methods to compute the axis and angle from a rotation matrix (see also [[axis–angle representation]]). Here, we only describe the method based on the computation of the [[eigenvector]]s and [[eigenvalue]]s of the rotation matrix. It is also possible to use the [[Trace (linear algebra)|trace]] of the rotation matrix. ====Determining the axis==== [[File:Rotation decomposition.png|thumb|A rotation {{mvar|R}} around axis {{math|'''u'''}} can be decomposed using 3 endomorphisms {{math|'''P'''}}, {{math|('''I''' − '''P''')}}, and {{math|'''Q'''}} (click to enlarge).]] Given a {{nowrap|3 × 3}} rotation matrix {{mvar|R}}, a vector {{math|'''u'''}} parallel to the rotation axis must satisfy :<math>R\mathbf{u} = \mathbf{u},</math> since the rotation of {{math|'''u'''}} around the rotation axis must result in {{math|'''u'''}}. The equation above may be solved for {{math|'''u'''}} which is unique up to a scalar factor unless {{mvar|R}} is the [[identity matrix]] {{mvar|I}}. Further, the equation may be rewritten :<math>R\mathbf{u} = I \mathbf{u} \implies \left(R - I\right) \mathbf{u} = 0,</math> which shows that {{math|'''u'''}} lies in the [[null space]] of {{math|''R'' − ''I''}}. Viewed in another way, {{math|'''u'''}} is an [[eigenvector]] of {{mvar|R}} corresponding to the [[eigenvalue]] {{math|''λ'' {{=}} 1}}. Every rotation matrix must have this eigenvalue, the other two eigenvalues being [[complex conjugate]]s of each other. It follows that a general rotation matrix in three dimensions has, up to a multiplicative constant, only one real eigenvector. One way to determine the rotation axis is by showing that: :<math>\begin{align} 0 &= R^\mathsf{T} 0 + 0 \\ &= R^\mathsf{T}\left(R - I\right) \mathbf{u} + \left(R - I\right) \mathbf{u} \\ &= \left(R^\mathsf{T}R - R^\mathsf{T} + R - I\right) \mathbf{u} \\ &= \left(I - R^\mathsf{T} + R - I\right) \mathbf{u} \\ &= \left(R - R^\mathsf{T}\right) \mathbf{u} \end{align}</math> Since {{math|(''R'' − ''R''<sup>T</sup>)}} is a [[skew-symmetric matrix]], we can choose {{math|'''u'''}} such that :<math>[\mathbf u]_{\times} = \left(R - R^\mathsf{T}\right).</math> The matrix–vector product becomes a [[cross product]] of a vector with itself, ensuring that the result is zero: :<math>\left(R - R^\mathsf{T}\right) \mathbf{u} = [\mathbf u]_{\times} \mathbf{u} = \mathbf{u} \times \mathbf{u} = 0\,</math> Therefore, if :<math>R = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \\ \end{bmatrix},</math> then :<math>\mathbf{u} = \begin{bmatrix} h-f \\ c-g \\ d-b \\ \end{bmatrix}.</math> The magnitude of {{math|'''u'''}} computed this way is {{math|{{norm|'''u'''}} {{=}} 2 sin ''θ''}}, where {{mvar|θ}} is the angle of rotation. This '''does not work''' if {{mvar|R}} is symmetric. Above, if {{math|''R'' − ''R''<sup>T</sup>}} is zero, then all subsequent steps are invalid. In this case, the angle of rotation is 0° or 180° and any nonzero column of {{math|''I'' + ''R''}} is an eigenvector of {{mvar|R}} with eigenvalue 1 because {{math|''R''(''I'' + ''R'') {{=}} ''R'' + ''R''<sup>2</sup> {{=}} ''R'' + ''RR''<sup>T</sup> {{=}} ''I'' + ''R''}}.<ref>{{Cite journal |last1=Palais |first1=Bob |last2=Palais |first2=Richard |date=2007-12-20 |title=Euler's fixed point theorem: The axis of a rotation |journal=Journal of Fixed Point Theory and Applications |language=en |volume=2 |issue=2 |pages=215–220 |doi=10.1007/s11784-007-0042-5 |issn=1661-7738 |mr=2372984 |doi-access=free}}</ref> ====Determining the angle==== To find the angle of a rotation, once the axis of the rotation is known, select a vector {{math|'''v'''}} perpendicular to the axis. Then the angle of the rotation is the angle between {{math|'''v'''}} and {{math|''R'''''v'''}}. A more direct method, however, is to simply calculate the [[Trace (linear algebra)|'''trace''']]: the sum of the diagonal elements of the rotation matrix. Care should be taken to select the right sign for the angle {{mvar|θ}} to match the chosen axis: :<math>\operatorname{tr} (R) = 1 + 2\cos\theta ,</math> from which follows that the angle's absolute value is :<math>|\theta| = \arccos\left(\frac{\operatorname{tr}(R) - 1}{2}\right).</math> For the rotation axis <math>\mathbf{n}=(n_1,n_2,n_3)</math>, you can get the correct angle<ref>{{cite arXiv|last=Kuo Kan|first=Liang|date=6 October 2018|title=Efficient conversion from rotating matrix to rotation axis and angle by extending Rodrigues' formula|eprint=1810.02999|class=cs.CG}}</ref> from <math>\left\{\begin{matrix} \cos \theta&=&\dfrac{\operatorname{tr}(R) - 1}{2}\\ \sin \theta&=&-\dfrac{\operatorname{tr}(K_n R)}{2} \end{matrix}\right. </math> where <math>K_n=\begin{bmatrix} 0 & -n_3 & n_2\\ n_3 & 0 & -n_1\\ -n_2 & n_1 & 0\\ \end{bmatrix} </math> ====Rotation matrix from axis and angle==== The matrix of a proper rotation {{mvar|R}} by angle {{mvar|θ}} around the axis {{math|'''u''' {{=}} (''u<sub>x</sub>'', ''u<sub>y</sub>'', ''u<sub>z</sub>'')}}, a unit vector with {{math|''u''{{su|b=''x''|p=2}} + ''u''{{su|b=''y''|p=2}} + ''u''{{su|b=''z''|p=2}} {{=}} 1}}, is given by:<ref>{{cite journal |last1=Taylor |first1=Camillo J. |last2=Kriegman |first2=David J. |title=Minimization on the Lie Group SO(3) and Related Manifolds |journal=Technical Report No. 9405 |year=1994 |location=Yale University |url=https://www.cis.upenn.edu/~cjtaylor/PUBLICATIONS/pdfs/TaylorTR94b.pdf }}</ref> <ref> {{cite journal|first1 = V. | last1= Balakrishnan|title = How is a vector rotated? | journal = Resonance | volume =4 |issue =10|year=1999 | pages=61–68| doi= 10.1007/BF02834260|url=https://www.ias.ac.in/describe/article/reso/004/10/0061-0068}} </ref> <ref> {{cite book|first1=Adam | last1=Morawiec|title=Orientations and Rotations|year=2004 | doi=10.1007/978-3-662-09156-2|publisher=Springer| isbn=978-3-642-07386-1}} </ref> <ref> {{cite journal| first1=A. |last1=Palazzolo|title=Formalism for the rotation matrix of rotations about an arbitrary axis | journal=Am. J. Phys. | volume=44 | issue=1|pages=63–67| year=1976|doi=10.1119/1.10140|bibcode=1976AmJPh..44...63P}} </ref> :<math>R = \begin{bmatrix} u_x^2 \left(1-\cos \theta\right) + \cos \theta & u_x u_y \left(1-\cos \theta\right) - u_z \sin \theta & u_x u_z \left(1-\cos \theta\right) + u_y \sin \theta \\ u_x u_y \left(1-\cos \theta\right) + u_z \sin \theta & u_y^2\left(1-\cos \theta\right) + \cos \theta & u_y u_z \left(1-\cos \theta\right) - u_x \sin \theta \\ u_x u_z \left(1-\cos \theta\right) - u_y \sin \theta & u_y u_z \left(1-\cos \theta\right) + u_x \sin \theta & u_z^2\left(1-\cos \theta\right) + \cos \theta \end{bmatrix}.</math> A derivation of this matrix from first principles can be found in section 9.2 here.<ref>{{Cite thesis|url=https://dspace.lboro.ac.uk/dspace-jspui/handle/2134/18050|hdl=2134/18050|title=Modelling CPV|date=January 2015|publisher=Loughborough University|type=thesis|last1=Cole|first1=Ian R.}}</ref> The basic idea to derive this matrix is dividing the problem into few known simple steps. # First rotate the given axis and the point such that the axis lies in one of the coordinate planes ({{mvar|xy}}, {{mvar|yz}} or {{mvar|zx}}) # Then rotate the given axis and the point such that the axis is aligned with one of the two coordinate axes for that particular coordinate plane ({{mvar|x}}, {{mvar|y}} or {{mvar|z}}) # Use one of the fundamental rotation matrices to rotate the point depending on the coordinate axis with which the rotation axis is aligned. # Reverse rotate the axis-point pair such that it attains the final configuration as that was in step 2 (Undoing step 2) # Reverse rotate the axis-point pair which was done in step 1 (undoing step 1) This can be written more concisely as <!--please LEAVE THE NONTRIVIAL COEFFICIENT OF THE IDENTITY ALONE. READ FOOTNOTE 4--> <ref> {{cite journal|first1=Jon|last1=Mathews|title= Coordinate-free rotation formalism|journal=Am. J. Phys. | volume =44 | number=12 | pages=121 | doi=10.1119/1.10264|year=1976|bibcode=1976AmJPh..44.1210M}} </ref> :<math>R = (\cos\theta)\,I + (\sin\theta)\,[\mathbf u]_{\times} + (1-\cos\theta)\,(\mathbf{u}\otimes\mathbf{u}),</math> where {{math|['''u''']<sub>×</sub>}} is the [[Cross product#Conversion to matrix multiplication|cross product matrix]] of {{math|'''u'''}}; the expression {{math|'''u''' ⊗ '''u'''}} is the [[outer product]], and {{mvar|I}} is the [[identity matrix]]. Alternatively, the matrix entries are: :<math>R_{jk}=\begin{cases} \cos^2\frac{\theta}{2}+\sin^2\frac{\theta}{2}\left(2u_j^2-1\right), \quad &\text{if }j=k\\ 2u_ju_k\sin^2\frac{\theta}{2}-\varepsilon_{jkl}u_l\sin\theta, \quad &\text{if }j\neq k \end{cases}</math> where {{mvar|ε<sub>jkl</sub>}} is the [[Levi-Civita symbol]] with {{math|''ε''<sub>123</sub> {{=}} 1}}. This is a matrix form of [[Rodrigues' rotation formula]], (or the equivalent, differently parametrized [[Euler–Rodrigues formula#Vector formulation|Euler–Rodrigues formula]]) with<ref group="nb">Note that :<math> \mathbf{u}\otimes\mathbf{u} = \bigl( [\mathbf u]_{\times}\bigr)^2+{\mathbf I}</math> so that, in Rodrigues' notation, equivalently, :<math> \mathbf{R} = \mathbf{I} + (\sin\theta) [\mathbf u]_{\times} + (1-\cos\theta)\bigl( [\mathbf u]_{\times}\bigr)^2.</math></ref> :<math> \mathbf{u}\otimes\mathbf{u} = \mathbf{u}\mathbf{u}^\mathsf{T} = \begin{bmatrix} u_x^2 & u_x u_y & u_x u_z \\[3pt] u_x u_y & u_y^2 & u_y u_z \\[3pt] u_x u_z & u_y u_z & u_z^2 \end{bmatrix},\qquad [\mathbf u]_{\times} = \begin{bmatrix} 0 & -u_z & u_y \\[3pt] u_z & 0 & -u_x \\[3pt] -u_y & u_x & 0 \end{bmatrix}.</math> In <math>\mathbb{R}^3</math> the rotation of a vector {{math|'''x'''}} around the axis {{math|'''u'''}} by an angle {{mvar|θ}} can be written as: :<math>R_{\mathbf{u}}(\theta)\mathbf{x}=\mathbf{u}(\mathbf{u}\cdot\mathbf{x})+\cos\left(\theta\right)(\mathbf{u}\times\mathbf{x})\times\mathbf{u}+\sin\left(\theta\right)(\mathbf{u}\times\mathbf{x})</math> or equivalently: :<math>R_{\mathbf{u}}(\theta)\mathbf{x}= \mathbf{x} \cos(\theta) + \mathbf{u}(\mathbf{x} \cdot \mathbf{u})(1- \cos(\theta)) - \mathbf{x} \times \mathbf{u} \sin{\theta}</math> This can also be written in [[Tensor|tensor notation]] as:<ref>{{cite journal|first1=T. R.|last1=Koehler | first2=S. B. |last2=Trickey|title=Euler vectors and rotations about an arbitrary axis|year=1978|journal=Am. J. Phys.|volume=46|issue=6|page=650|doi=10.1119/1.11223|bibcode=1978AmJPh..46..650K}}</ref> :<math>(R_{\mathbf{u}}(\theta)\mathbf{x})_i = (R_{\mathbf{u}}(\theta))_{ij} {\mathbf{x}}_{j} \quad \text{with} \quad (R_{\mathbf{u}}(\theta))_{ij} = \delta_{ij}\cos(\theta) + \mathbf{u}_i\mathbf{u}_j (1- \cos(\theta)) - \sin{\theta} \varepsilon_{ijk} \mathbf{u}_{k} </math> If the 3D space is right-handed and {{math|''θ'' > 0}}, this rotation will be counterclockwise when {{math|'''u'''}} points towards the observer ([[Right-hand rule]]). Explicitly, with <math>(\boldsymbol{\alpha}, \boldsymbol{\beta},\mathbf u)</math> a right-handed orthonormal basis, :<math> R_{\mathbf{u}}(\theta)\boldsymbol{\alpha}= \cos\left(\theta\right) \boldsymbol{\alpha} + \sin\left(\theta\right) \boldsymbol{\beta}, \quad R_{\mathbf{u}}(\theta)\boldsymbol{\beta}= - \sin\left(\theta\right) \boldsymbol{\alpha} + \cos\left(\theta\right) \boldsymbol{\beta}, \quad R_{\mathbf{u}}(\theta)\mathbf{u}=\mathbf{u}. </math> Note the striking ''merely apparent differences'' to the ''equivalent'' Lie-algebraic formulation [[#Exponential_map|below]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)