gustaf.utils.arr.rotation_matrix#

gustaf.utils.arr.rotation_matrix(rotation, degree=True)[source]#

Compute rotation matrix. Works for both 2D and 3D point sets. In 2D, it can rotate along the (virtual) z-axis. In 3D, it can rotate along [x, y, z]-axis. Uses scipy.spatial.transform.Rotation.

Parameters:
  • rotation (list or float) – Amount of rotation along [x,y,z] axis. Default is in degrees. In 2D, it can be float.

  • degree (bool) – (Optional) rotation given in degrees. Default is True. If False, in radian.

Returns:

rotation_matrix

Return type:

np.ndarray (3,3)