Skip to content

Commit

Permalink
Link new functions in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderFabisch committed Oct 25, 2024
1 parent f4d3e80 commit b807408
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
35 changes: 23 additions & 12 deletions doc/source/user_guide/rotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ One of the most practical representations of orientation is a rotation matrix
Note that this is a non-minimal representation for orientations because we
have 9 values but only 3 degrees of freedom. This is because
:math:`\boldsymbol R` is orthonormal, which results in 6 constraints
(enforced with :func:`~pytransform3d.rotations.norm_matrix`):
(enforced with :func:`~pytransform3d.rotations.norm_matrix`
and checked with
:func:`~pytransform3d.rotations.matrix_requires_renormalization` or
:func:`~pytransform3d.rotations.check_matrix`):

* column vectors must have unit norm (3 constraints)
* and must be orthogonal to each other (3 constraints)
Expand Down Expand Up @@ -252,7 +255,9 @@ component-wise integration and differentiation with this representation.
**Cons**

* Ambiguities: an angle of 0 and any multiple of :math:`2\pi` represent
the same orientation; when :math:`\theta = \pi`, the axes
the same orientation (can be avoided with
:func:`~pytransform3d.rotations.norm_compact_axis_angle`, which introduces
discontinuities); when :math:`\theta = \pi`, the axes
:math:`\hat{\boldsymbol{\omega}}` and :math:`-\hat{\boldsymbol{\omega}}`
represent the same rotation.
* Supported operations: concatenation and transformation of vectors requires
Expand Down Expand Up @@ -347,9 +352,10 @@ functions :func:`~pytransform3d.rotations.quaternion_wxyz_from_xyzw` and
.. warning::

The *antipodal* unit quaternions :math:`\boldsymbol{\hat{q}}` and
:math:`-\boldsymbol{\hat{q}}` represent the same rotation (double cover).
This must be considered during operations like interpolation, distance
calculation, or (approximate) equality checks.
:math:`-\boldsymbol{\hat{q}}`
(:func:`~pytransform3d.rotations.quaternion_double`) represent the same
rotation (double cover). This must be considered during operations like
interpolation, distance calculation, or (approximate) equality checks.

The quaternion product
(:func:`~pytransform3d.rotations.concatenate_quaternions`) can be used to
Expand All @@ -369,8 +375,10 @@ with the quaternion product (:func:`~pytransform3d.rotations.q_prod_vector`).
**Pros**

* Representation: compact.
* Renormalization: cheap in comparison to rotation matrices;
less susceptible to round-off errors than matrix representation.
* Renormalization: checked with
:func:`~pytransform3d.rotations.quaternion_requires_renormalization`;
cheap in comparison to rotation matrices (); less susceptible to round-off
errors than matrix representation.
* Discontinuities: none.
* Computational efficiency: the quaternion product is cheaper than the matrix
product.
Expand Down Expand Up @@ -480,7 +488,8 @@ Another minimal representation of rotation are modified Rodrigues parameters
This representation is similar to the compact axis-angle representation.
However, the angle of rotation is converted to :math:`\tan(\frac{\theta}{4})`.
Hence, there is an easy conversion from unit quaternions to MRP:
Hence, there is an easy conversion from unit quaternions to MRP
(:func:`~pytransform3d.rotations.mrp_from_quaternion`):

.. math::
Expand All @@ -495,15 +504,17 @@ parameters.

.. warning::

MRPs have a singuarity at :math:`2 \pi` which we can avoid by ensuring the
angle of rotation does not exceed :math:`\pi`.
MRPs have a singuarity at :math:`2 \pi` (see
:func:`~pytransform3d.rotations.mrp_near_singularity`) which we can avoid
by ensuring the angle of rotation does not exceed :math:`\pi` (with
:func:`~pytransform3d.rotations.norm_mrp`).

.. warning::

MRPs have two representations for the same rotation:
:math:`\boldsymbol{\psi}` and :math:`-\frac{1}{||\boldsymbol{\psi}||^2}
\boldsymbol{\psi}` represent the same rotation and correspond to two
antipodal unit quaternions [8]_.
\boldsymbol{\psi}` (:func:`~pytransform3d.rotations.mrp_double`) represent
the same rotation and correspond to two antipodal unit quaternions [8]_.

**Pros**

Expand Down
5 changes: 5 additions & 0 deletions pytransform3d/rotations/_quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ def quaternion_double(q):
-------
q_double : array, shape (4,)
-q
See Also
--------
pick_closest_quaternion
Picks the quaternion that is closest to another one in Euclidean space.
"""
return -check_quaternion(q, unit=True)

Expand Down

0 comments on commit b807408

Please sign in to comment.