pytransform3d.rotations.swing_twist_composition#

pytransform3d.rotations.swing_twist_composition(swing, twist)[source]#

Recompose a rotation from its swing and twist components.

This is the inverse of swing_twist_decomposition(). Given a swing and a twist quaternion, the original rotation is recovered by

\[\boldsymbol{q} = \boldsymbol{q}_{swing} \boldsymbol{q}_{twist},\]

i.e. the twist is applied first and then the swing.

Note that the reconstructed quaternion may differ in sign from the quaternion that was originally decomposed, since \(\boldsymbol{q}\) and \(-\boldsymbol{q}\) represent the same rotation.

Parameters:
swingarray-like, shape (4,)

Unit quaternion that represents the swing, a rotation about an axis orthogonal to the twist axis.

twistarray-like, shape (4,)

Unit quaternion that represents the twist, a rotation about the twist axis.

Returns:
qarray, shape (4,)

Unit quaternion that represents the recomposed rotation: (w, x, y, z).

See also

swing_twist_decomposition

Decomposes a rotation into swing and twist.

Examples using pytransform3d.rotations.swing_twist_composition#

Swing-Twist Decomposition

Swing-Twist Decomposition

Tool-Axis Redundancy via Swing and Twist

Tool-Axis Redundancy via Swing and Twist