pytransform3d.rotations
.euler_from_quaternion#
- pytransform3d.rotations.euler_from_quaternion(q, i, j, k, extrinsic)[source]#
General method to extract any Euler angles from quaternions.
- Parameters:
- qarray-like, shape (4,)
Unit quaternion to represent rotation: (w, x, y, z)
- iint from [0, 1, 2]
The first rotation axis (0: x, 1: y, 2: z)
- jint from [0, 1, 2]
The second rotation axis (0: x, 1: y, 2: z)
- kint from [0, 1, 2]
The third rotation axis (0: x, 1: y, 2: z)
- extrinsicbool
Do we use extrinsic transformations? Intrinsic otherwise.
- Returns:
- euler_anglesarray, shape (3,)
Extracted rotation angles in radians about the axes i, j, k in this order. The first and last angle are normalized to [-pi, pi]. The middle angle is normalized to either [0, pi] (proper Euler angles) or [-pi/2, pi/2] (Cardan / Tait-Bryan angles).
- Raises:
- ValueError
If basis is invalid
References
[1]Bernardes, E., Viollet, S. (2022). Quaternion to Euler angles conversion: A direct, general and computationally efficient method. PLOS ONE, 17(11), doi: 10.1371/journal.pone.0276302.