Skip to main content
`Ctrl`+`K`
scipy.spatial.transform.RigidTransform.

# as_dual_quat

RigidTransform.as_dual_quat(*, scalar_first=False)

  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_first bool, 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_quat numpy.ndarray, shape (…, 8)

      Unit dual quaternion vectors with the same leading dimensions as the transform. 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 variable `SCIPY_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.])