warp.quat_to_euler#

warp.quat_to_euler(q: quatf, i: int, j: int, k: int) → vec3f[source]#
  • Kernel: true
  • Python: true
  • Differentiable: true

Return the Euler angles in radians of the rotation q for an axis sequence.

The result uses the same conventions as quat_from_euler(): rotations about the fixed axes i, j, and k, in that order. For Tait-Bryan sequences (i != k), quat_from_euler(quat_to_euler(q, i, j, k), i, j, k) represents the same rotation as q, including at gimbal lock, where the angles about i and k are not unique.

Caution

For proper Euler sequences (i == k), quat_from_euler() cannot invert the result: it reads both the first and the third angle from e[i], but this function stores the third angle in another slot.

Parameters:
  • q – Rotation quaternion.

  • i – Index of the first axis, in {0, 1, 2}.

  • j – Index of the second axis, in {0, 1, 2} and different from i.

  • k – Index of the third axis, in {0, 1, 2} and different from j.

Returns:

Euler angles e in radians. For Tait-Bryan sequences, e is indexed by axis: e[0] is the angle about X, e[1] about Y, and e[2] about Z. For proper Euler sequences, e[i] holds the first angle, e[j] the second, and e[3 - i - j] the third, which is also about axis i. The second angle is in [-pi/2, pi/2] for Tait-Bryan sequences and in [0, pi] for proper Euler sequences. The first and third angles are in [-2*pi, 2*pi].

Return type:

warp.vec3