From 74c7a2ab60101da732fd4a32ee141c4a3d94f803 Mon Sep 17 00:00:00 2001 From: Alexander Fabisch Date: Sun, 6 Oct 2024 10:51:42 +0200 Subject: [PATCH] Detailed explanation of quat. product --- .../rotations/_quaternion_operations.py | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pytransform3d/rotations/_quaternion_operations.py b/pytransform3d/rotations/_quaternion_operations.py index 2187febe..a176f2f5 100644 --- a/pytransform3d/rotations/_quaternion_operations.py +++ b/pytransform3d/rotations/_quaternion_operations.py @@ -82,13 +82,26 @@ def quaternion_gradient(Q, dt=1.0): def concatenate_quaternions(q1, q2): - """Concatenate two quaternions. + r"""Concatenate two quaternions. + + We concatenate two quaternions by quaternion multiplication + :math:`\boldsymbol{q}_1\boldsymbol{q}_2`. We use Hamilton's quaternion multiplication. - Suppose we want to apply two extrinsic rotations given by quaternions - q1 and q2 to a vector v. We can either apply q2 to v and then q1 to - the result or we can concatenate q1 and q2 and apply the result to v. + If the two quaternions are divided up into scalar part and vector part + each, i.e., + :math:`\boldsymbol{q} = (w, \boldsymbol{v}), w \in \mathbb{R}, + \boldsymbol{v} \in \mathbb{R}^3`, then the quaternion product is + + .. math:: + + \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 :math:`\cdot` and the cross product :math:`\times`. Parameters ----------