gustaf.utils.arr.rotation_matrix_around_axis#

gustaf.utils.arr.rotation_matrix_around_axis(axis=None, rotation=None, degree=True)[source]#

Compute rotation matrix given the axis of rotation. Works for both 2D and 3D Uses Rodrigues’ formula.

If axis is not specified, 2D rotation matrix is assumed.

Parameters:
  • axis (list or np.ndarray) – Axis of rotation in 3D

  • rotation (float) – angle of rotation in either radiant or degrees

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

Returns:

rotation_matrix

Return type:

np.ndarray (3,3) of np.ndarray (2,2)