Skip to content

shz_quat_to_angles_xyz

Markdown
SHZ_INLINE shz_vec3_t shz_quat_to_angles_xyz(shz_quat_t q) SHZ_NOEXCEPT;

Decomposes the given quaternion into X, Y, then Z Tait-Bryan angles.

NameTypeDescription
qshz_quat_tUnit quaternion to decompose.

The X, Y, and Z angles of rotation, in radians.

Returns the angles a, b, and c, in radians, such that the given quaternion is equal to Qx(a) * Qy(b) * Qz(c), making this the inverse of shz_quat_from_rotation_xyz(). The angles are returned in the same order as that routine takes them: x = X angle, y = Y angle, z = Z angle.

The outer angles are in [-PI, PI] and the middle angle is in [-PI/2, PI/2].

  • At gimbal lock, when the middle angle is +/-PI/2, the outer angles are not unique. The returned angles still reconstruct the same rotation.

shz_quat_from_rotation_xyz, shz_quat_angle_x, shz_quat_angle_y, shz_quat_angle_z