py3dframe.Frame.set_translation#
- Frame.set_translation(translation, *, convention=None)[source]#
Set the translation vector between the parent frame and this frame in a specific convention.
The translation vector must be given as a array-like with 3 elements.
See also
attribute
parentto get or set the parent frame.attribute
conventionto get or set the convention of the frame.attribute
translationto get or set the translation in the convention of the frame.method
get_translation()to get the translation in a specific convention.method
set_global_translation()to set the translation between the global frame and this frame.
- Parameters:
translation (numpy.ndarray) – The translation 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.
- 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 moves and the new translation vector between the parent frame and this frame in convention 4 can be extracted from the application.
import numpy translation = numpy.array(...) # Extract the translation vector from the application. frame.set_translation(translation, convention=4) # Set the translation in convention 4.