py3dframe.Frame.set_euler_angles#
- Frame.set_euler_angles(euler_angles, *, convention=None, degrees=False, seq='xyz')[source]#
Set 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
parentto get or set the parent frame.attribute
conventionto get or set the convention of the frame.attribute
euler_anglesto get or set the Euler angles in the convention of the frame.method
get_euler_angles()to get the Euler angles in a specific convention.method
set_global_euler_angles()to set the Euler angles between the global frame and this frame.
- Parameters:
euler_angles (numpy.ndarray) – The Euler angles between the parent frame and this frame in the given convention as an array-like with 3 elements.
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 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’.
- Return type:
None
Examples
Lets create a default frame with convention 0.
from py3dframe import Frame parent = ... # Define the parent frame if needed, otherwise parent=None to use the canonical frame. frame = Frame.canonical(convention=0, parent=parent)
Lets assume, an application uses convention 4 to represent the transformation between two frames. The frame of reference of the application rotates and the new Euler angles between the parent frame and this frame in convention 4 with ‘ZYX’ sequence in degrees can be extracted from the application.
import numpy euler_angles = numpy.array(...) # Extract the Euler angles from the application. frame.set_euler_angles(euler_angles, convention=4, degrees=True, seq='ZYX') # Set the Euler angles in convention 4 with 'ZYX' sequence in degrees.