From 4148917456707de04b79f122799590aa1c8c2d51 Mon Sep 17 00:00:00 2001 From: Alexander Fabisch Date: Wed, 2 Oct 2024 11:23:36 +0200 Subject: [PATCH] Make frame order consistent --- doc/source/user_guide/rotations.rst | 18 +++++++++--------- doc/source/user_guide/transformations.rst | 11 ++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/source/user_guide/rotations.rst b/doc/source/user_guide/rotations.rst index 2583f56c..767566a8 100644 --- a/doc/source/user_guide/rotations.rst +++ b/doc/source/user_guide/rotations.rst @@ -104,8 +104,8 @@ matrices and typically we use the variable name R for a rotation matrix. There are two conventions on how to interpret rotations: active or passive rotation. The standard in pytransform3d is an active rotation. -We can use a rotation matrix :math:`\boldsymbol R_{AB}` to transform a point -:math:`_B\boldsymbol{p}` from frame :math:`B` to frame :math:`A`. +We can use a rotation matrix :math:`\boldsymbol R_{BA}` to transform a point +:math:`_A\boldsymbol{p}` from frame :math:`A` to frame :math:`B`. .. warning:: @@ -115,21 +115,21 @@ We can use a rotation matrix :math:`\boldsymbol R_{AB}` to transform a point to a row vector from the right side. We will use the **pre-multiplication** convention. -This means that we rotate a point :math:`_B\boldsymbol{p}` by +This means that we rotate a point :math:`_A\boldsymbol{p}` by .. math:: - _A\boldsymbol{p} = \boldsymbol{R}_{ABB} \boldsymbol{p} + _B\boldsymbol{p} = \boldsymbol{R}_{BAA} \boldsymbol{p} This is called **linear map**. Note that with our index notation (as explained in :ref:`Frame Notation`) and these conventions, the second index of the rotation matrix and the left index -of the point have to be the same (:math:`B` in this example). The rotation is +of the point have to be the same (:math:`A` in this example). The rotation is applied incorrectly if this is not the case. -*Each column* of a rotation matrix :math:`\boldsymbol{R}_{AB}` is a basis -vector of frame :math:`A` with respect to frame :math:`B`. We can plot the +*Each column* of a rotation matrix :math:`\boldsymbol{R}_{BA}` is a basis +vector of frame :math:`B` with respect to frame :math:`A`. We can plot the basis vectors of an orientation to visualize it. Here, we can see orientation represented by the rotation matrix @@ -154,12 +154,12 @@ represented by the rotation matrix green for the y-axis and blue for the z-axis (RGB for xyz). We can easily chain multiple rotations: we can apply the rotation defined -by :math:`\boldsymbol R_{AB}` after the rotation :math:`\boldsymbol R_{BC}` +by :math:`\boldsymbol R_{CB}` after the rotation :math:`\boldsymbol R_{BA}` by applying the rotation .. math:: - \boldsymbol R_{AC} = \boldsymbol R_{AB} \boldsymbol R_{BC}. + \boldsymbol R_{CA} = \boldsymbol R_{CB} \boldsymbol R_{BA}. Note that the indices have to align again. Otherwise rotations are not applied in the correct order. diff --git a/doc/source/user_guide/transformations.rst b/doc/source/user_guide/transformations.rst index d3ab7164..9e35646c 100644 --- a/doc/source/user_guide/transformations.rst +++ b/doc/source/user_guide/transformations.rst @@ -97,16 +97,17 @@ setting the last component to zero (see :func:`~pytransform3d.transformations.vector_to_direction`): :math:`\left( x,y,z,0 \right)^T`. -We can use a transformation matrix :math:`\boldsymbol T_{AB}` to transform a -point :math:`{_B}\boldsymbol{p}` from frame :math:`B` to frame :math:`A`: +We can use a transformation matrix :math:`\boldsymbol T_{BA}` to transform a +point :math:`{_A}\boldsymbol{p}` from frame :math:`A` to frame :math:`B`: .. math:: - \boldsymbol{T}_{AB} {_B}\boldsymbol{p} = + \boldsymbol{T}_{BA} {_A}\boldsymbol{p} = \left( \begin{array}{c} - \boldsymbol{R} {_B}\boldsymbol{p} + \boldsymbol t\\ + \boldsymbol{R}_{BA} {_A}\boldsymbol{p} + {_B}\boldsymbol{t}_{BA}\\ 1\\ - \end{array} \right). + \end{array} \right) = + {_B}\boldsymbol{p}. You can use :func:`~pytransform3d.transformations.transform` to apply a transformation matrix to a homogeneous vector.