amep.utils.quaternion_rotate#

amep.utils.quaternion_rotate(quat: ndarray, vec: ndarray)#

Calculates the 3d vector rotated by the quaternion.

Notes

Method from http://people.csail.mit.edu/bkph/articles/Quaternions.pdf

Parameters:
  • quat (np.ndarray) – 4d quaternion the vector vec will be rotated with. Shapes (4,) or (N,4,) allowed.

  • vec (np.ndarray) – 3d vector that will be rotated by the quaternion quat. Shapes (3,) or (N,3,) allowed.

Returns:

Rotated 3d vector.

Return type:

np.ndarray