Skip to content

pymath.euler_angles_from_matrix

Daniel Flassig edited this page Jun 24, 2026 · 1 revision

Extracts the three ZXZ Euler angles from a 3×3 rotation matrix.

This function is located in the pymath module. See pymath for the angle convention.

alpha, beta, gamma = pymath.euler_angles_from_matrix(mat)
Parameter Type Description
mat matrix A 3×3 rotation matrix, represented as an array of three row-vectors. Missing or non-numeric entries are read as 0.

Return value

Type Description
alpha First z-rotation, in degrees.
beta x-rotation, in degrees; returned in the range [0, 180].
gamma Final z-rotation, in degrees.

Notes:

  • Uses the ZXZ convention rot(z, alpha) · rot(x, beta) · rot(z, gamma).
  • Returns three separate values, not a table.
  • beta is returned in [0, 180]. To obtain an equivalent solution with beta in [-90, 90], apply the identity:
    beta  -> -beta
    alpha ->  alpha + 180
    gamma ->  gamma - 180
    
  • The inverse operation is pymath.matrix_from_euler_angles.

Example:

local R = {{0, -1, 0},
           {1,  0, 0},
           {0,  0, 1}}
local alpha, beta, gamma = pymath.euler_angles_from_matrix(R)
-- alpha == 90, beta == 0, gamma == 0   (one of several equivalent representations)

Version Support:

Minimum PYTHA Version: V27

See also:

pymath, pymath.matrix_from_euler_angles, pymath.rotation_from_quat

Clone this wiki locally