Rotation Representation Converter
Rotation Representation Converter
Interactive calculator for converting between rotation matrices, quaternions, ZYX Euler angles, axis-angle, and exponential coordinates β with 3D screw axis visualization and step-by-step formulas.
Background
Every 3-D rotation can be described in multiple equivalent ways. This tool converts between the five most common representations and visualises the underlying screw axis in 3-D. Full derivations live in the Rotation Representations Reference.
| Representation | Parameters | Key property |
|---|---|---|
| Rotation matrix \(R \in SO(3)\) | 9 numbers | \(R^\top R = I\), \(\det R = +1\) |
| Quaternion \(\mathbf{q} = (w, x, y, z)\) | 4 numbers | \(\lVert\mathbf{q}\rVert = 1\); double cover of \(SO(3)\) |
| ZYX Euler angles \((\psi, \theta, \phi)\) | 3 numbers | Yaw-pitch-roll; gimbal lock at \(\theta = \pm 90Β°\) |
| Axis-angle \((\hat{\mathbf{n}}, \theta)\) | 4 numbers | Rodrigues formula; undefined axis at \(\theta = 0\) |
| Exponential coordinates \(\boldsymbol{\omega} = \theta\hat{\mathbf{n}}\) | 3 numbers | Lie algebra \(\mathfrak{so}(3)\); \(\lVert\boldsymbol{\omega}\rVert = \theta\) |
The Rodrigues formula, quaternion algebra, and ZYX Euler extraction follow Park & Lynch, Modern Robotics, Cambridge University Press, 2017, Chapters 3β4. All conversion functions implement the same algorithms as the Python reference in Rotation Representations Reference.
Interactive Calculator
Step-by-step Conversion Formulas
3-D Screw Axis Visualisation
Mathematical Reference
Rodrigues Formula (Axis-Angle β R)
Given unit axis \(\hat{\mathbf{n}}\) and angle \(\theta\):
\[R = I + \sin\theta \,[\hat{\mathbf{n}}]_\times + (1-\cos\theta)\,[\hat{\mathbf{n}}]_\times^2\]
where the skew-symmetric matrix is
\[[\hat{\mathbf{n}}]_\times = \begin{bmatrix}0 & -n_z & n_y \\ n_z & 0 & -n_x \\ -n_y & n_x & 0\end{bmatrix}.\]
Rotation Matrix β Axis-Angle
\[\theta = \arccos\!\left(\frac{\operatorname{tr}(R)-1}{2}\right), \qquad \hat{\mathbf{n}} = \frac{1}{2\sin\theta}\begin{bmatrix}R_{32}-R_{23}\\R_{13}-R_{31}\\R_{21}-R_{12}\end{bmatrix}.\]
Special cases: \(\theta = 0\) (identity, axis undefined) and \(\theta = \pi\) (180Β° rotation, Shepperdβs method on diagonal).
Rotation Matrix β Quaternion (Shepperd)
\[w = \tfrac{1}{2}\sqrt{1+\operatorname{tr}(R)}, \quad x = \frac{R_{32}-R_{23}}{4w}, \quad y = \frac{R_{13}-R_{31}}{4w}, \quad z = \frac{R_{21}-R_{12}}{4w}.\]
At \(\theta = 180Β°\) (where \(w \approx 0\)) the formula is numerically degenerate; the implementation uses the diagonal entries of \((R+I)/2\) instead.
Quaternion β Rotation Matrix
\[R = \begin{bmatrix}1-2(y^2+z^2) & 2(xy-wz) & 2(xz+wy) \\ 2(xy+wz) & 1-2(x^2+z^2) & 2(yz-wx) \\ 2(xz-wy) & 2(yz+wx) & 1-2(x^2+y^2)\end{bmatrix}.\]
Both \(\mathbf{q}\) and \(-\mathbf{q}\) produce identical \(R\) (double cover of \(SO(3)\)).
ZYX Euler Angles
Composition order: \(R = R_z(\psi) R_y(\theta) R_x(\phi)\). Extraction:
\[\psi = \operatorname{atan2}(R_{21}, R_{11}), \quad \theta = -\arcsin(R_{31}), \quad \phi = \operatorname{atan2}(R_{32}, R_{33}).\]
Gimbal lock occurs when \(\theta = \pm 90Β°\) (\(R_{31} = \mp 1\)). In that configuration \(\psi\) and \(\phi\) cannot be independently resolved; the implementation sets \(\phi = 0\) and encodes all remaining rotation in \(\psi\).
Exponential Coordinates
\(\boldsymbol{\omega} = \theta\hat{\mathbf{n}} \in \mathbb{R}^3\). The magnitude \(|\boldsymbol{\omega}| = \theta\) is the rotation angle; the direction \(\hat{\mathbf{n}} = \boldsymbol{\omega}/\theta\) is the screw axis. These are the coordinates of the Lie algebra \(\mathfrak{so}(3)\):
\[R = \exp([\boldsymbol{\omega}]_\times).\]
See also: Rotation Representations Reference β full derivations and Python implementation. Screw Theory Reference β SE(3) twists, wrenches, and product of exponentials.