py3dframe.Frame.set_rotation_vector#
- Frame.set_rotation_vector(rotation_vector, *, convention=None, degrees=False)[source]#
Set the rotation vector representation of the rotation between the parent frame and this frame in a specific convention.
The rotation vector describes the rotation by a single rotation about a fixed axis. The direction of the axis is given by the direction of the vector, and the magnitude of the vector is given by the angle of rotation.
See also
attribute
parentto get or set the parent frame.attribute
conventionto get or set the convention of the frame.attribute
rotation_vectorto get or set the rotation vector in the convention of the frame.method
get_rotation_vector()to get the rotation vector in a specific convention.method
set_global_rotation_vector()to set the rotation vector between the global frame and this frame.
- Parameters:
rotation_vector (numpy.ndarray) – The rotation vector 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 rotation vector is in degrees. Default is False (radians).
- 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 vector between the parent frame and this frame in convention 4 in degrees can be extracted from the application.
import numpy rotation_vector = numpy.array(...) # Extract the rotation vector from the application. frame.set_rotation_vector(rotation_vector, convention=4, degrees=True) # Set the rotation vector in convention 4 in degrees.