pytransform3d.rotations.concatenate_quaternions#

pytransform3d.rotations.concatenate_quaternions(q1, q2)[source]#

Concatenate two quaternions.

We concatenate two quaternions by quaternion multiplication \(\boldsymbol{q}_1\boldsymbol{q}_2\).

We use Hamilton’s quaternion multiplication.

If the two quaternions are divided up into scalar part and vector part each, i.e., \(\boldsymbol{q} = (w, \boldsymbol{v}), w \in \mathbb{R}, \boldsymbol{v} \in \mathbb{R}^3\), then the quaternion product is

\[\boldsymbol{q}_{12} = (w_1 w_2 - \boldsymbol{v}_1 \cdot \boldsymbol{v}_2, w_1 \boldsymbol{v}_2 + w_2 \boldsymbol{v}_1 + \boldsymbol{v}_1 \times \boldsymbol{v}_2)\]

with the scalar product \(\cdot\) and the cross product \(\times\).

Parameters:
q1array-like, shape (4,)

First quaternion

q2array-like, shape (4,)

Second quaternion

Returns:
q12array, shape (4,)

Quaternion that represents the concatenated rotation q1 * q2

See also

concatenate_rotors

Concatenate rotors, which is the same operation.