py3dframe.Frame.get_global_euler_angles#
- Frame.get_global_euler_angles(*, convention=None, degrees=False, seq='xyz')[source]#
Access the Euler angles representation of the rotation between the global frame and this frame in the given 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
global_euler_anglesto get or set the Euler angles between the global frame and this frame in the convention of the frame.method
set_global_euler_angles()to set the Euler angles between the global frame and this frame in a specific convention.method
get_euler_angles()to get the Euler angles between the parent frame and this frame in a specific convention.
- 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. It must be a string of 3 characters chosen among ‘X’, ‘Y’, ‘Z’, ‘x’, ‘y’, ‘z’. Default is “xyz”.
- Returns:
The Euler angles between the global frame and this frame in the given convention with shape (3,).
- Return type:
Examples
Lets consider a train and a person standing into the train.
First we can define the train frame relative to the global frame (the canonical frame) and then we can define the person frame relative to the train frame.
from py3dframe import Frame train = Frame.from_axes(origin=[0, 0, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], z_axis=[0, 0, 1], parent=None) person = Frame.from_axes(origin=[0, 1, 0], x_axis=[1, 0, 0], y_axis=[0, 1, 0], z_axis=[0, 0, 1], parent=train)
Lets assume the train moves and the person moves inside the train.
train.set_translation([10, 0, 0], convention=0) # The train moves of 10 units along the x axis of the global frame. person.set_translation([0, 2, 0], convention=0) # The person moves by 1 unit along the y axis of the train frame. person.set_euler_angles([0, 0, 45], convention=0, degrees=True) # The person rotates of 45 degrees around the z axis of the train frame.
If an application using an other convention required the Euler angles between the global frame and the person frame in the convention 4, with the axes “zyx” and in degrees, you can access these Euler angles with the
get_global_euler_angles()method:global_euler_angles_person = person.get_global_euler_angles(convention=4, seq="zyx", degrees=True) # Get the Euler angles between the global frame and the person frame in convention 4 with the axes "zyx" and in degrees.