matrix_from_euler_angles

compas.geometry.matrix_from_euler_angles(euler_angles, static=True, axes='xyz')[source]

Calculates a rotation matrix from Euler angles.

In 3D space any orientation can be achieved by composing three elemental rotations, rotations about the axes (x,y,z) of a coordinate system. A triple of Euler angles can be interpreted in 24 ways, which depends on if the rotations are applied to a static (extrinsic) or rotating (intrinsic) frame and the order of axes.

Parameters
  • euler_angles (list of float) – Three numbers that represent the angles of rotations about the defined axes.

  • static (bool, optional) – If true the rotations are applied to a static frame. If not, to a rotational. Default is True.

  • axes ({‘xyz’, ‘yzx’, ‘zxy’}, optional) – A 3 character string specifying order of the axes. Default is 'xyz'.

Returns

list of list of float – A 4x4 transformation matrix representing a rotation.

Examples

>>> ea1 = 1.4, 0.5, 2.3
>>> R = matrix_from_euler_angles(ea1)
>>> ea2 = euler_angles_from_matrix(R)
>>> allclose(ea1, ea2)
True