日本語 English

Converting Between Euler Angles, Rotation Matrices and Quaternions

This page explains how to convert between Euler angles, rotation matrices and quaternions. It shows formulas for each rotation order (XYZ, XZY, YXZ, YZX, ZXY, ZYX) and usage examples of the PLC library.

Rotation conversion

Euler angles → rotation matrix (EulerToMatrix)

Euler angles → rotation matrix
Input
eulerAngle
Euler angles [roll, pitch, yaw]
order
Rotation order (0:XYZ, 1:XZY, 2:YXZ, 3:YZX, 4:ZXY, 5:ZYX)
Output
mat
Rotation matrix

Example

Euler angles → rotation matrix calculation example
Input
eulerAngle
[30, 30, 0]
order
0
Output
mat
\begin{bmatrix} 0.866& 0& 0.5 \\ 0.25& 0.866& -0.433 \\ -0.433& 0.5& 0.75 \end{bmatrix}

Formulas

Rotation order XYZ \begin{align} &R_{xyz}=R_xR_yR_z \\ &= \begin{bmatrix} cos\theta_y cos\theta_z & -cos\theta_y sin\theta_z & sin\theta_y \\ sin\theta_x sin\theta_y cos\theta_z+cos\theta_x sin\theta_z & -sin\theta_x sin\theta_y sin\theta_z+cos\theta_xcos\theta_z & -sin\theta_x cos\theta_y \\ -cos\theta_x sin\theta_y cos\theta_z+sin\theta_x sin\theta_z & cos\theta_x sin\theta_y sin\theta_z+sin\theta_x cos\theta_z & cos\theta_x cos\theta_y \end{bmatrix} \end{align}
Rotation order XZY \begin{align} &R_{xzy}=R_xR_zR_y \\ &= \begin{bmatrix} cos\theta_y cos\theta_z & -sin\theta_z & sin\theta_y cos\theta_z \\ cos\theta_x cos\theta_y sin\theta_z+sin\theta_x sin\theta_y & cos\theta_x cos\theta_z & cos\theta_x sin\theta_y sin\theta_z-sin\theta_x cos\theta_y \\ sin\theta_x cos\theta_y sin\theta_z-cos\theta_x sin\theta_y & sin\theta_x cos\theta_z & sin\theta_x sin\theta_y sin\theta_z+cos\theta_x cos\theta_y \end{bmatrix} \end{align}
Rotation order YXZ \begin{align} &R_{yxz}=R_yR_xR_z \\ &= \begin{bmatrix} sin\theta_x sin\theta_y sin\theta_z+cos\theta_y cos\theta_z & sin\theta_x sin\theta_y sin\theta_z-cos\theta_y sin\theta_z & cos\theta_x sin\theta_y \\ cos\theta_x sin\theta_z & cos\theta_x cos\theta_z & -sin\theta_z \\ sin\theta_x cos\theta_y sin\theta_z-sin\theta_y cos\theta_z & sin\theta_x cos\theta_y cos\theta_z+sin\theta_y sin\theta_z & cos\theta_x cos\theta_y \end{bmatrix} \end{align}
Rotation order YZX \begin{align} &R_{yzx}=R_yR_zR_x \\ &= \begin{bmatrix} cos\theta_y cos\theta_z & -cos\theta_x cos\theta_y sin\theta_z+sin\theta_x sin\theta_y & sin\theta_x cos\theta_y sin\theta_z+cos\theta_x sin\theta_y \\ sin\theta_x & cos\theta_x cos\theta_z & -sin\theta_x cos\theta_z \\ -sin\theta_y cos\theta_z & cos\theta_x sin\theta_y sin\theta_z+sin\theta_x cos\theta_y & -sin\theta_x sin\theta_y sin\theta_z+cos\theta_x cos\theta_y \end{bmatrix} \end{align}
Rotation order ZXY \begin{align} &R_{zxy}=R_zR_xR_y \\ &= \begin{bmatrix} -sin\theta_x sin\theta_y sin\theta_z+cos\theta_y cos\theta_z & -cos\theta_x sin\theta_z & sin\theta_x cos\theta_y sin\theta_z+sin\theta_y cos\theta_z \\ sin\theta_x sin\theta_y cos\theta_z+cos\theta_y sin\theta_z & cos\theta_x cos\theta_z & -sin\theta_x cos\theta_y cos\theta_z+sin\theta_y sin\theta_z \\ -cos\theta_x sin\theta_y & sin\theta_x & cos\theta_x cos\theta_y \end{bmatrix} \end{align}
Rotation order ZYX \begin{align} &R_{zyx}=R_zR_yR_x \\ &= \begin{bmatrix} cos\theta_y cos\theta_z & sin\theta_x sin\theta_y cos\theta_z-cos\theta_x sin\theta_z & cos\theta_x sin\theta_y cos\theta_z+sin\theta_x sin\theta_z \\ cos\theta_y sin\theta_z & sin\theta_x sin\theta_y sin\theta_z+cos\theta_x cos\theta_z & cos\theta_x sin\theta_y sin\theta_z+sin\theta_x cos\theta_z \\ -sin\theta_y & sin\theta_x cos\theta_y & cos\theta_x cos\theta_y \end{bmatrix} \end{align}


Rotation matrix → Euler angles (MatrixToEuler)

Rotation matrix → Euler angles
Input
mat
Rotation matrix
order
Rotation order (0:XYZ, 1:XZY, 2:YXZ, 3:YZX, 4:ZXY, 5:ZYX)
Output
eulerAngle
Euler angles [roll, pitch, yaw]

Example

Rotation matrix → Euler angles calculation example
Input
mat
\begin{bmatrix} 0.866& 0& 0.5 \\ 0.25& 0.866& -0.433 \\ -0.433& 0.5& 0.75 \end{bmatrix}
order
0
Output
eulerAngle
[30, 30, 0]

Formulas

The elements of the rotation matrix are written as follows \[ \begin{bmatrix} m_{00}& m_{01}& m_{02} \\ m_{10}& m_{11}& m_{12} \\ m_{20}& m_{21}& m_{22} \\ \end{bmatrix} \]
Rotation order XYZ \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( -\frac{m_{12}}{m_{22}} \right) &(\cos \theta_y \neq 0) \\ \arctan \left( \frac{m_{21}}{m_{11}} \right) &(otherwise) \end{cases} \\ \theta_y &= \arcsin (m_{02}) \\ \theta_z &= \begin{cases} \arctan \left( -\frac{m_{01}}{m_{00}} \right) &(\cos \theta_y \neq 0) \\ 0 &(otherwise) \end{cases} \\ \end{align} \]
Rotation order XZY \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( \frac{m_{21}}{m_{11}} \right) &(\cos \theta_z \neq 0) \\ \arctan \left( -\frac{m_{12}}{m_{22}} \right) &(otherwise) \end{cases} \\ \theta_y &= \begin{cases} \arctan \left( \frac{m_{02}}{m_{00}} \right) &(\cos \theta_z \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_z &= \arcsin (-m_{01}) \\ \end{align} \]
Rotation order YXZ \[\large \begin{align} \theta_x &= \arcsin (-m_{12}) \\ \theta_y &= \begin{cases} \arctan \left( \frac{m_{02}}{m_{22}} \right) &(\cos \theta_x \neq 0) \\ \arctan \left( -\frac{m_{20}}{m_{00}} \right) &(otherwise) \end{cases} \\ \theta_z &= \begin{cases} \arctan \left( \frac{m_{10}}{m_{11}} \right) &(\cos \theta_x \neq 0) \\ 0 &(otherwise) \end{cases} \\ \end{align} \]
Rotation order YZX \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( -\frac{m_{12}}{m_{11}} \right) &(\cos \theta_z \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_y &= \begin{cases} \arctan \left( -\frac{m_{20}}{m_{00}} \right) &(\cos \theta_z \neq 0) \\ \arctan \left( \frac{m_{02}}{m_{22}} \right) &(otherwise) \\ \end{cases} \\ \theta_z &= \arcsin (m_{10}) \\ \end{align} \]
Rotation order ZXY \[\large \begin{align} \theta_x &= \arcsin (m_{21}) \\ \theta_y &= \begin{cases} \arctan \left( -\frac{m_{20}}{m_{22}} \right) &(\cos \theta_x \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_z &= \begin{cases} \arctan \left( -\frac{m_{01}}{m_{11}} \right) &(\cos \theta_x \neq 0) \\ \arctan \left( \frac{m_{10}}{m_{00}} \right) &(otherwise) \\ \end{cases} \\ \end{align} \]
Rotation order ZYX \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( \frac{m_{21}}{m_{22}} \right) &(\cos \theta_y \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_y &= \arcsin (-m_{20}) \\ \theta_z &= \begin{cases} \arctan \left( \frac{m_{10}}{m_{00}} \right) &(\cos \theta_y \neq 0) \\ \arctan \left( -\frac{m_{01}}{m_{11}} \right) &(otherwise) \\ \end{cases} \\ \end{align} \]


Euler angles → quaternion (EulerToQuaternion)

Euler angles → quaternion
Input
eulerAngle
Euler angles [roll, pitch, yaw]
order
Rotation order (0:XYZ, 1:XZY, 2:YXZ, 3:YZX, 4:ZXY, 5:ZYX)
Output
q
Quaternion [w, x, y, z]

Example

Euler angles → quaternion calculation example
Input
eulerAngle
[30, 30, 0]
order
0
Output
q
q.w=0.933
q.x=0.25
q.y=0.25
q.z=0.067

Formulas

A quaternion is written as follows \[ q = \begin{bmatrix} q_w \\ q_x \\ q_y \\ q_z \\ \end{bmatrix} \]
Rotation order XYZ \[\large \begin{bmatrix} -\sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \end{bmatrix} \]
Rotation order XZY \[\large \begin{bmatrix} \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} - \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \end{bmatrix} \]
Rotation order YXZ \[\large \begin{bmatrix} \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} - \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \end{bmatrix} \]
Rotation order YZX \[\large \begin{bmatrix} -\sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \end{bmatrix} \]
Rotation order ZXY \[\large \begin{bmatrix} -\sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \end{bmatrix} \]
Rotation order ZYX \[\large \begin{bmatrix} \sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\cos \frac{\theta_z}{2} - \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \sin \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} \\ -\sin \frac{\theta_x}{2}\sin \frac{\theta_y}{2}\cos \frac{\theta_z}{2} + \cos \frac{\theta_x}{2}\cos \frac{\theta_y}{2}\sin \frac{\theta_z}{2} \\ \end{bmatrix} \]


Quaternion → Euler angles (QuaternionToEuler)

Quaternion → Euler angles
Input
q
Quaternion [w, x, y, z]
order
Rotation order (0:XYZ, 1:XZY, 2:YXZ, 3:YZX, 4:ZXY, 5:ZYX)
Output
eulerAngle
Euler angles [roll, pitch, yaw]

Example

Quaternion → Euler angles calculation example
Input
q
q.w=0.933
q.x=0.25
q.y=0.25
q.z=0.067
order
0
Output
eulerAngle
[30, 30, 0]

Formulas

A quaternion is written as follows \[ q = \begin{bmatrix} q_w \\ q_x \\ q_y \\ q_z \\ \end{bmatrix} \]
Rotation order XYZ \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( -\frac{2q_yq_z-2q_xq_w}{2q_w^2+2q_z^2-1} \right) &(\cos \theta_y \neq 0) \\ \arctan \left( \frac{2q_yq_z+2q_xq_w}{2q_w^2+2q_y^2-1} \right) &(otherwise) \end{cases} \\ \theta_y &= \arcsin (2q_xq_z+2q_yq_w) \\ \theta_z &= \begin{cases} \arctan \left( -\frac{2q_xq_y-2q_zq_w}{2q_w^2+2q_x^2-1} \right) &(\cos \theta_y \neq 0) \\ 0 &(otherwise) \end{cases} \\ \end{align} \]
Rotation order XZY \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( \frac{2q_yq_z+2q_xq_w}{2q_w^2+2q_y^2-1} \right) &(\cos \theta_z \neq 0) \\ \arctan \left( -\frac{2q_yq_z-2q_xq_w}{2q_w^2+2q_z^2-1} \right) &(otherwise) \\ \end{cases} \\ \theta_y &= \begin{cases} \arctan \left( \frac{2q_xq_z+2q_yq_w}{2q_w^2+2q_x^2-1} \right) &(\cos \theta_z \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_z &= \arcsin (-(2q_xq_y-2q_zq_w)) \\ \end{align} \]
Rotation order YXZ \[\large \begin{align} \theta_x &= \arcsin (-(2q_yq_z-2q_xq_w)) \\ \theta_y &= \begin{cases} \arctan \left( \frac{2q_xq_z+2q_yq_w}{2q_w^2+2q_z^2-1} \right) &(\cos \theta_x \neq 0) \\ \arctan \left( -\frac{2q_xq_z-2q_yq_w}{2q_w^2+2q_z^2-1} \right) &(otherwise) \\ \end{cases} \\ \theta_z &= \begin{cases} \arctan \left( \frac{2q_xq_y+2q_zq_w}{2q_w^2+2q_y^2-1} \right) &(\cos \theta_x \neq 0) \\ 0 &(otherwise) \end{cases} \\ \end{align} \]
Rotation order YZX \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( -\frac{2q_yq_z-2q_xq_w}{2q_w^2+2q_y^2-1} \right) &(\cos \theta_z \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_y &= \begin{cases} \arctan \left( -\frac{2q_xq_z-2q_yq_w}{2q_w^2+2q_x^2-1} \right) &(\cos \theta_z \neq 0) \\ \arctan \left( \frac{2q_xq_z+2q_yq_w}{2q_w^2+2q_z^2-1} \right) &(otherwise) \\ \end{cases} \\ \theta_z &= \arcsin (-(2q_xq_y+2q_zq_w)) \\ \end{align} \]
Rotation order ZXY \[\large \begin{align} \theta_x &= \arcsin (2q_yq_z+2q_xq_w) \\ \theta_y &= \begin{cases} \arctan \left( -\frac{2q_xq_z-2q_yq_w}{2q_w^2+2q_z^2-1} \right) &(\cos \theta_x \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_z &= \begin{cases} \arctan \left( -\frac{2q_xq_y-2q_zq_w}{2q_w^2+2q_y^2-1} \right) &(\cos \theta_x \neq 0) \\ \arctan \left( \frac{2q_xq_y+2q_zq_w}{2q_w^2+2q_x^2-1} \right) &(otherwise) \\ \end{cases} \\ \end{align} \]
Rotation order ZYX \[\large \begin{align} \theta_x &= \begin{cases} \arctan \left( \frac{2q_yq_z+2q_xq_w}{2q_w^2+2q_z^2-1} \right) &(\cos \theta_y \neq 0) \\ 0 &(otherwise) \end{cases} \\ \theta_y &= \arcsin (-(2q_xq_z-2q_yq_w)) \\ \theta_z &= \begin{cases} \arctan \left( \frac{2q_xq_y+2q_zq_w}{2q_w^2+2q_x^2-1} \right) &(\cos \theta_y \neq 0) \\ \arctan \left( -\frac{2q_xq_y-2q_zq_w}{2q_w^2+2q_y^2-1} \right) &(otherwise) \\ \end{cases} \\ \end{align} \]


Quaternion → rotation matrix (QuaternionToMatrix)

Quaternion → rotation matrix
Input
q
Quaternion [w, x, y, z]
Output
mat
Rotation matrix

Example

Quaternion → rotation matrix calculation example
Input
q
q.w=0.933
q.x=0.25
q.y=0.25
q.z=0.067
Output
mat
\begin{bmatrix} 0.866& 0& 0.5 \\ 0.25& 0.866& -0.433 \\ -0.433& 0.5& 0.75 \end{bmatrix}

Formulas

\[\large \begin{bmatrix} 2q_w^2+2q_x^2-1& 2q_xq_y-2q_zq_w& 2q_xq_z+2q_yq_w \\ 2q_xq_y+2q_zq_w& 2q_w^2+2q_y^2-1& 2q_yq_z-2q_xq_w \\ 2q_xq_z-2q_yq_w& 2q_yq_z+2q_xq_w& 2q_w^2+2q_z^2-1 \\ \end{bmatrix} \]


Rotation matrix → quaternion (MatrixToQuaternion)

Rotation matrix → quaternion
Input
mat
Rotation matrix
conv
Conversion candidate (0-3)
Output
q
Quaternion [w, x, y, z]

Example

Rotation matrix → quaternion calculation example
Input
mat
\begin{bmatrix} 0.866& 0& 0.5 \\ 0.25& 0.866& -0.433 \\ -0.433& 0.5& 0.75 \end{bmatrix}
conv
0
Output
q
q.w=0.933
q.x=0.25
q.y=0.25
q.z=0.067

Formulas

conv=0 \[\Large q= \begin{bmatrix} \frac{m_{21}-m_{12}}{2\sqrt{m_{00}-m_{11}-m_{22}+1}} \\ \frac{\sqrt{m_{00}-m_{11}-m_{22}+1}}{2} \\ \frac{m_{10}-m_{01}}{2\sqrt{m_{00}-m_{11}-m_{22}+1}} \\ \frac{m_{02}-m_{20}}{2\sqrt{m_{00}-m_{11}-m_{22}+1}} \\ \end{bmatrix} \] conv=1 \[\Large q= \begin{bmatrix} \frac{m_{02}-m_{20}}{2\sqrt{-m_{00}+m_{11}-m_{22}+1}} \\ \frac{m_{10}-m_{01}}{2\sqrt{-m_{00}+m_{11}-m_{22}+1}} \\ \frac{\sqrt{-m_{00}+m_{11}-m_{22}+1}}{2} \\ \frac{m_{21}-m_{12}}{2\sqrt{-m_{00}+m_{11}-m_{22}+1}} \\ \end{bmatrix} \] conv=2 \[\Large q= \begin{bmatrix} \frac{m_{10}-m_{01}}{2\sqrt{-m_{00}-m_{11}+m_{22}+1}} \\ \frac{m_{02}-m_{20}}{2\sqrt{-m_{00}-m_{11}+m_{22}+1}} \\ \frac{m_{21}-m_{12}}{2\sqrt{-m_{00}-m_{11}+m_{22}+1}} \\ \frac{\sqrt{-m_{00}-m_{11}+m_{22}+1}}{2} \\ \end{bmatrix} \] conv=3 \[\Large q= \begin{bmatrix} \frac{\sqrt{m_{00}+m_{11}+m_{22}+1}}{2} \\ \frac{m_{21}-m_{12}}{2\sqrt{m_{00}+m_{11}+m_{22}+1}} \\ \frac{m_{02}-m_{20}}{2\sqrt{m_{00}+m_{11}+m_{22}+1}} \\ \frac{m_{10}-m_{01}}{2\sqrt{m_{00}+m_{11}+m_{22}+1}} \\ \end{bmatrix} \]


FAQ

What is the difference between Euler angles and quaternions?

Euler angles are intuitive but suffer from gimbal lock. Quaternions are widely used in attitude control and robot control.

Why does rotation order matter?

Because XYZ and ZYX produce different resulting orientations.

Reference URL

Qiita: conversion between rotation matrices, quaternions and Euler angles (Japanese) https://qiita.com/aa_debdeb/items/3d02e28fb9ebfa357eaf


Comments