as_dual_quat#
- RigidTransform.as_dual_quat(self, *, 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_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.
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.])