quaternion_multiplication

giant.rotations:

giant.rotations.quaternion_multiplication(quaternion_1_in, quaternion_2_in)[source]

This function performs the hamiltonian quaternion multiplication operation.

The quaternions should be of the form as specified in Rotation Representations.

The hamiltonian multiplication is defined such that q_from_A_to_C = quaternion_multiplication(q_from_B_to_C, q_from_A_to_B)

Mathematically this is given by:

\[\begin{split}\mathbf{q}_1\otimes\mathbf{q}_2=\left[\begin{array}{c}q_{s1}\mathbf{q}_{v2} + q_{s2}\mathbf{q}_{v1} + \mathbf{q}_{v1}\times\mathbf{q}_{v2}\\ q_{s1}q_{s2}-\mathbf{q}_{v1}^T\mathbf{q}_{v2}\end{array}\right]\end{split}\]

This function is vectorized, therefore you can input multiple quaternions as a 4xn array where each column is an independent quaternion.

Parameters:
  • quaternion_1_in (Sequence | ndarray | Rotation) – The first quaternion to multiply

  • quaternion_2_in (Sequence | ndarray | Rotation) – The second quaternion to multiply

Returns:

The non-hamiltonian product of quaternion_1 and quaternion_2

Return type:

ndarray | Rotation