as_dual_quat#
- RigidTransform.as_dual_quat(*, scalar_first=False)[source]#
Return the dual quaternion representation of the transform.
Unit dual quaternions encode orientation in a real unit quaternion and translation in a dual quaternion. There is a double cover, i.e., the unit dual quaternions q and -q represent the same transform.
- Parameters:
- scalar_firstbool, optional
Whether the scalar component goes first or last in the two individual quaternions that represent the real and the dual part. Default is False, i.e. the scalar-last order is used.
- Returns:
- dual_quatnumpy.ndarray, shape (N, 8) or (8,)
A single unit dual quaternion vector or a stack of unit dual quaternion vectors. The real part is stored in the first four components and the dual part in the last four components.
Notes
Array API Standard Support
as_dual_quat
has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1
and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
✅
JAX
✅
✅
Dask
⛔
n/a
See Support for the array API standard for more information.
Examples
>>> from scipy.spatial.transform import RigidTransform as Tf >>> import numpy as np
Get identity dual quaternion (we use scalar-last by default):
>>> Tf.identity().as_dual_quat() array([0., 0., 0., 1., 0., 0., 0., 0.])
When we want to use the scalar-first convention, we use the argument:
>>> Tf.identity().as_dual_quat(scalar_first=True) array([1., 0., 0., 0., 0., 0., 0., 0.])