Skip to main content

decompose_swing_twist

Function decompose_swing_twist 

pub fn decompose_swing_twist(
    q: [f32; 4],
    twist_axis: [f32; 3],
) -> ([f32; 4], [f32; 4])
Expand description

Decomposes unit quaternion q ([w, x, y, z]) into (swing, twist) around twist_axis such that quat_mul(swing, twist) == normalize(q) and twist is a pure rotation around twist_axis in the shortest-arc hemisphere (twist[0] >= 0).