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

# from_dual_quat

classmethod RigidTransform.from_dual_quat(cls, 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_quatarray_like, shape (N, 8) or (8,)

      A single unit dual quaternion or a stack of unit dual quaternions. The real part is stored in the first four components and the dual part in the last four components.

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

      A single transform or a stack of transforms.

  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