py3dframe.Frame.set_rotation#
- Frame.set_rotation(rotation, *, convention=None)[source]#
Set the rotation between the parent frame and this frame in a specific convention.
The rotation must be given as a
Rotationobject.See also
attribute
parentto get or set the parent frame.attribute
conventionto get or set the convention of the frame.attribute
rotationto get or set the rotation in the convention of the frame.method
get_rotation()to get the rotation in a specific convention.method
set_global_rotation()to set the rotation between the global frame and this frame.
- Parameters:
rotation (Rotation) – The rotation between the parent frame and this frame in the given convention.
convention (Optional[int], optional) – Integer in
[0, 7]selecting the convention. Defaults to the frame’s own convention.
- 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 rotation between the parent frame and this frame in convention 4 can be extracted from the application.
import numpy from py3dframe import Rotation rotation = Rotation.from_matrix(...) # Extract the rotation matrix from the application. frame.set_rotation(rotation, convention=4) # Set the rotation in convention 4.