warp.quat_to_euler#
- warp.quat_to_euler(q: quatf, i: int, j: int, k: int) vec3f[source]#
Return the Euler angles in radians of the rotation
qfor an axis sequence.The result uses the same conventions as
quat_from_euler(): rotations about the fixed axesi,j, andk, 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 asq, including at gimbal lock, where the angles aboutiandkare 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 frome[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 fromi.k – Index of the third axis, in
{0, 1, 2}and different fromj.
- Returns:
Euler angles
ein radians. For Tait-Bryan sequences,eis indexed by axis:e[0]is the angle about X,e[1]about Y, ande[2]about Z. For proper Euler sequences,e[i]holds the first angle,e[j]the second, ande[3 - i - j]the third, which is also about axisi. 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: