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

# from_dual_quat

static RigidTransform.from_dual_quat(dual_quat, *, scalar_first=False)

  Initialize from a unit dual quaternion.

  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.

  Unit dual quaternions must have a real quaternion with unit norm and a dual quaternion that is orthogonal to the real quaternion to satisfy the unit norm constraint. This function will enforce both properties through normalization.

  Parameters:
    dual_quat array_like, shape (…, 8)

      Unit dual quaternions. Each dual_quat[…, :] represents a unit dual quaternion. The real part is stored in the first four components and the dual part in the last four components.

    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:
    transform `RigidTransform` instance

      Rigid transform objects with the same leading dimensions as the input.

  Notes

  Array API Standard Support

  `from_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

  Creating from a single unit dual quaternion:

      >>> tf = Tf.from_dual_quat([
      ...     0.0617101, -0.06483886, 0.31432811, 0.94508498,
      ...     0.04985168, -0.26119618, 0.1691491, -0.07743254])
      >>> tf.as_matrix()
      array([[0.79398752, -0.60213598, -0.08376202, 0.24605262],
             [0.58613113, 0.79477941, -0.15740392, -0.4932833],
             [0.16135089, 0.07588122, 0.98397557, 0.34262676],
             [0., 0., 0., 1.]])
      >>> tf.single
      True