newton.core.quat_decompose#

newton.core.quat_decompose(q)[source]#

Decompose a quaternion into extrinsic Euler angles.

Calculates Euler angles for a sequence of rotations around fixed world axes in the order of X, then Y, then Z.

The corresponding matrix multiplication for a column vector \(v\) is:

\[v_{\text{rotated}} = R_z(\text{angle}_z) R_y(\text{angle}_y) R_x(\text{angle}_x) v\]
Parameters:

q (wp.quat) – The input quaternion to decompose.

Returns:

The Euler angles \((\text{angle}_x, \text{angle}_y, \text{angle}_z)\) in radians.

Return type:

wp.vec3