rotmat_to_euler

giant.rotations:

giant.rotations.rotmat_to_euler(matrix, order='xyz')[source]

This function converts a rotation matrix to 3 euler angles to be applied to the axes specified in order.

Order specifies both the axes of the euler angles, and the order they should be applied. The order is applied left to right. That is, for an order of xyz the rotation will be applied about x, then about y, then about z.

The returned euler angles will match the order of order. That is, if order is xyz then the first angle will correspond to the rotation about x, the second angle will correspond to the rotation about y, and the third angle will correspond to the rotation about z. The angles will be returned in radians.

This function is vectorized, therefore you can input matrix as a nx3x3 stack of rotation matrices down the first axis and the results will return the angles for each matrix. There can only be a single input for order which will apply to all cases in this case.

Math to follow.

Parameters:
  • matrix (Sequence[Sequence] | ndarray) – The matrix(ces) to convert to euler angles

  • order (str) – The order of the rotations

Returns:

The euler angles corresponding to the rotation matrix(ces)

Return type:

Tuple[Sequence | ndarray | Real, Sequence | ndarray | Real, Sequence | ndarray | Real]