py3dframe.Frame.get_euler_angles#

Frame.get_euler_angles(*, convention=None, degrees=False, seq='xyz')[source]#

Access the Euler angles representation of the rotation between the parent frame and this frame in a specific convention.

The Euler angles describe the rotation using three elementary rotations about specified axes.

See also

  • attribute parent to get or set the parent frame.

  • attribute convention to get or set the convention of the frame.

  • attribute euler_angles to get or set the Euler angles in the convention of the frame.

  • method set_euler_angles() to set the Euler angles in a specific convention.

  • method get_global_euler_angles() to get the Euler angles between the global frame and this frame.

Parameters:
  • convention (Optional[int], optional) – Integer in [0, 7] selecting the convention. Defaults to the frame’s own convention.

  • degrees (bool, optional) – If True, the Euler angles are returned in degrees. Default is False (radians).

  • seq (str, optional) – The axes of the Euler angles. Default is “xyz”. It must be a string of 3 characters chosen among ‘X’, ‘Y’, ‘Z’, ‘x’, ‘y’, ‘z’.

Returns:

The Euler angles between the parent frame and this frame in the given convention with shape (3,).

Return type:

numpy.ndarray

Examples

Lets create a frame from its axes and origin with the default convention 0.

import numpy
from py3dframe import Frame

origin = numpy.array([-1, -2, -3])
x_axis = numpy.array([1, 1, 0]) / numpy.sqrt(2)
y_axis = numpy.array([-1, 1, 0]) / numpy.sqrt(2)
z_axis = numpy.array([0, 0, 1])

parent = ... # Define the parent frame if needed, otherwise parent=None to use the canonical frame.

frame = Frame.from_axes(origin=origin, x_axis=x_axis, y_axis=y_axis, z_axis=z_axis, convention=0, parent=parent)

If an application using an other convention required the Euler angles in the convention 4 with ‘ZYX’ sequence in degrees, you can access the Euler angles in this convention with the get_euler_angles() method.

euler_angles_convention_4 = frame.get_euler_angles(convention=4, degrees=True, seq='ZYX')