py3dframe.Frame.set_rotation_matrix#

Frame.set_rotation_matrix(rotation_matrix, *, convention=None)[source]#

Set the rotation matrix between the parent frame and this frame in a specific convention.

The rotation matrix must be given as a array-like with shape (3, 3).

See also

Parameters:
  • rotation_matrix (numpy.ndarray) – The rotation matrix between the parent frame and this frame in the given convention as an array-like with shape (3, 3).

  • 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 matrix between the parent frame and this frame in convention 4 can be extracted from the application.

import numpy

rotation_matrix = numpy.array(...) # Extract the rotation matrix from the application.

frame.set_rotation_matrix(rotation_matrix, convention=4) # Set the rotation matrix in convention 4.