quaternion_to_euler¶
giant.rotations.core.conversions
:
- giant.rotations.core.conversions.quaternion_to_euler(quaternion, order='xyz')[source]¶
This function converts a rotation quaternion to 3 euler angles to be applied to the axes specified in order.
This function works by first converting the quaternion to a rotation matrix using
quaternion_to_rotmat()
and then using the functionrotmat_to_euler()
to find the euler angles. See the documentation for those two functions for more information.This function is vectorized so multiple quaternions can be converted simultaneously by specifying them as columns.
- Parameters:
quaternion (Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) – The quaternion(s) to be converted to euler angles
order (Literal['xyz', 'xzy', 'xyx', 'xzx', 'yxz', 'yzx', 'yxy', 'yzy', 'zxy', 'zyx', 'zyz', 'zxz']) – The order of the rotations
- Returns:
The euler angles corresponding to the rotation quaternion(s) acording to order
- Return type:
tuple[float | ndarray[tuple[Any, …], dtype[float64]], float | ndarray[tuple[Any, …], dtype[float64]], float | ndarray[tuple[Any, …], dtype[float64]]]