Skip to content

pymath.matrix_from_euler_angles

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

Builds the 3×3 rotation matrix for a set of ZXZ Euler angles.

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

mat = pymath.matrix_from_euler_angles(alpha, beta, gamma)
Parameter Type Description
alpha number First rotation about the z-axis, in degrees.
beta number Rotation about the (rotated) x-axis, in degrees.
gamma number Final rotation about the (rotated) z-axis, in degrees.

Return value

Type Description
mat A new 3×3 rotation matrix rot(z, alpha) · rot(x, beta) · rot(z, gamma), represented as an array of three row-vectors.

Notes:

Example:

-- alpha = 90° about z, no further rotation
local R = pymath.matrix_from_euler_angles(90, 0, 0)
-- R == {{0, -1, 0},
--       {1,  0, 0},
--       {0,  0, 1}}

-- Apply it to a vector with pymath.dot:
local v = pymath.dot(R, {1, 0, 0})
-- v == {0, 1, 0}

Version Support:

Minimum PYTHA Version: V27

See also:

pymath, pymath.euler_angles_from_matrix, pymath.matrix_from_quat

Clone this wiki locally