rot2eul: Compute the Euler angles from a rotation matrix on SO(3).

View source: R/rot2eul.R

Euler angles from a rotation matrix on SO(3)R Documentation

Compute the Euler angles from a rotation matrix on SO(3).


It calculates three euler angles (\theta_{12}, \theta_{13}, \theta_{23}) from a (3 \times 3) rotation matrix X, where X is defined as X = R_z(\theta_{12})\times R_y(\theta_{13}) \times R_x(\theta_{23}). Here R_x(\theta_{23}) means a rotation of \theta_{23} radians about the x axis.





A rotation matrix which is defined as a product of three elementary rotations mentioned above. Here \theta_{12}, \theta_{23} \in (-\pi, \pi) and and \theta_{13} \in (-\pi/2, \pi/2).


Given a rotation matrix X, euler angles are computed by equating each element in X with the corresponding element in the matrix product defined above. This results in nine equations that can be used to find the euler angles.


For a given rotation matrix, there are two eqivalent sets of euler angles.


Anamul Sajib <>.

R implementation and documentation: Anamul Sajib <>.


Green, P. J. and Mardia, K. V. (2006). Bayesian alignment using hierarchical models, with applications in proteins bioinformatics. Biometrika, 93(2):235–254.

See Also



# three euler angles

theta.12 <- sample( seq(-3, 3, 0.3), 1 )
theta.23 <- sample( seq(-3, 3, 0.3), 1 )
theta.13 <- sample( seq(-1.4, 1.4, 0.3), 1 )

theta.12 ; theta.23 ; theta.13

X <- eul2rot(theta.12, theta.23, theta.13)
X  ##  A rotation matrix

e <- rot2eul(X)$v1

theta.12 <- e[3]
theta.23 <- e[2]
theta.13 <- e[1]

theta.12 ; theta.23 ; theta.13

Directional documentation built on Oct. 12, 2023, 1:07 a.m.