OpenCV  5.0.0-pre
Open Source Computer Vision
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
cv::DualQuat< _Tp > Class Template Reference

#include <opencv2/core/dualquaternion.hpp>

Public Member Functions

 DualQuat ()
 
 DualQuat (const _Tp w, const _Tp x, const _Tp y, const _Tp z, const _Tp w_, const _Tp x_, const _Tp y_, const _Tp z_)
 create from eight same type numbers. More...
 
 DualQuat (const Vec< _Tp, 8 > &q)
 create from a double or float vector. More...
 
DualQuat< _Tp > conjugate () const
 return the conjugate of a dual quaternion.

\[ \begin{equation} \begin{split} \sigma^* &= (p + \epsilon q)^* &= (p^* + \epsilon q^*) \end{split} \end{equation} \]

More...
 
_Tp dot (DualQuat< _Tp > p) const
 return the dot product of two dual quaternion. More...
 
DualQuat< _Tp > exp () const
 return the value of exponential function value More...
 
Quat< _Tp > getDualPart () const
 return a quaternion which represent the dual part of dual quaternion. The definition of dual part is in createFromQuat(). More...
 
Quat< _Tp > getRealPart () const
 return a quaternion which represent the real part of dual quaternion. The definition of real part is in createFromQuat(). More...
 
Quat< _Tp > getRotation (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 return the rotation in quaternion form. More...
 
Vec< _Tp, 3 > getTranslation (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 return the translation vector. The rotation \(r\) in this dual quaternion \(\sigma\) is applied before translation \(t\). The dual quaternion \(\sigma\) is defined as

\[\begin{equation} \begin{split} \sigma &= p + \epsilon q \\ &= r + \frac{\epsilon}{2}{t}r. \end{split} \end{equation}\]

Thus, the translation can be obtained as follows

\[t = 2qp^*.\]

More...
 
DualQuat< _Tp > inv (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 if \(\sigma = p + \epsilon q\) is a dual quaternion, p is not zero, the inverse dual quaternion is

\[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \]

or equivalentlly,

\[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\]

More...
 
DualQuat< _Tp > log (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 return the value of logarithm function value More...
 
DualQuat< _Tp > norm () const
 return the norm \(||\sigma||\) of dual quaternion \(\sigma = p + \epsilon q\).

\[ \begin{equation} \begin{split} ||\sigma|| &= \sqrt{\sigma * \sigma^*} \\ &= ||p|| + \epsilon \frac{p \cdot q}{||p||}. \end{split} \end{equation} \]

Generally speaking, the norm of a not unit dual quaternion is a dual number. For convenience, we return it in the form of a dual quaternion , i.e.

\[ ||\sigma|| = [||p||, 0, 0, 0, \frac{p \cdot q}{||p||}, 0, 0, 0].\]

More...
 
DualQuat< _Tp > normalize () const
 return a normalized dual quaternion. A dual quaternion can be expressed as

\[ \begin{equation} \begin{split} \sigma &= p + \epsilon q\\ &=||\sigma||\left(r+\frac{1}{2}tr\right) \end{split} \end{equation} \]

where \(r, t\) represents the rotation (ordinary quaternion) and translation (pure ordinary quaternion) respectively, and \(||\sigma||\) is the norm of dual quaternion(a dual number). A dual quaternion is unit if and only if

\[ ||p||=1, p \cdot q=0 \]

where \(\cdot\) means dot product. The process of normalization is

\[ \sigma_{u}=\frac{\sigma}{||\sigma||} \]

Next, we simply proof \(\sigma_u\) is a unit dual quaternion:

\[ \renewcommand{\Im}{\operatorname{Im}} \begin{equation} \begin{split} \sigma_{u}=\frac{\sigma}{||\sigma||}&=\frac{p + \epsilon q}{||p||+\epsilon\frac{p\cdot q}{||p||}}\\ &=\frac{p}{||p||}+\epsilon\left(\frac{q}{||p||}-p\frac{p\cdot q}{||p||^3}\right)\\ &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\left(qp^{*}-p\cdot q\right)\frac{p}{||p||}\\ &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\Im(qp^*)\frac{p}{||p||}.\\ \end{split} \end{equation} \]

As expected, the real part is a rotation and dual part is a pure quaternion. More...

 
DualQuat< _Tp > operator* (const DualQuat< _Tp > &) const
 Multiplication operator of two dual quaternions q and p. Multiplies values on either side of the operator. More...
 
DualQuat< _Tp > & operator*= (const DualQuat< _Tp > &)
 Multiplication assignment operator of two quaternions. It multiplies right operand with the left operand and assign the result to left operand. More...
 
DualQuat< _Tp > operator*= (const _Tp s)
 Multiplication assignment operator of a quaternions and a scalar. It multiplies right operand with the left operand and assign the result to left operand. More...
 
DualQuat< _Tp > operator+ (const DualQuat< _Tp > &) const
 Addition operator of two dual quaternions p and q. It returns a new dual quaternion that each value is the sum of \(p_i\) and \(q_i\). More...
 
DualQuat< _Tp > & operator+= (const DualQuat< _Tp > &)
 Addition assignment operator of two dual quaternions p and q. It adds right operand to the left operand and assign the result to left operand. More...
 
DualQuat< _Tp > operator- () const
 Return opposite dual quaternion \(-p\) which satisfies \(p + (-p) = 0.\). More...
 
DualQuat< _Tp > operator- (const DualQuat< _Tp > &) const
 Subtraction operator of two dual quaternions p and q. It returns a new dual quaternion that each value is the sum of \(p_i\) and \(-q_i\). More...
 
DualQuat< _Tp > & operator-= (const DualQuat< _Tp > &)
 Subtraction assignment operator of two dual quaternions p and q. It subtracts right operand from the left operand and assign the result to left operand. More...
 
DualQuat< _Tp > operator/ (const _Tp s) const
 Division operator of a dual quaternions and a scalar. It divides left operand with the right operand and assign the result to left operand. More...
 
DualQuat< _Tp > operator/ (const DualQuat< _Tp > &) const
 Division operator of two dual quaternions p and q. Divides left hand operand by right hand operand. More...
 
DualQuat< _Tp > & operator/= (const DualQuat< _Tp > &)
 Division assignment operator of two dual quaternions p and q; It divides left operand with the right operand and assign the result to left operand. More...
 
Quat< _Tp > & operator/= (const _Tp s)
 Division assignment operator of a dual quaternions and a scalar. It divides left operand with the right operand and assign the result to left operand. More...
 
bool operator== (const DualQuat< _Tp > &) const
 return true if two dual quaternions p and q are nearly equal, i.e. when the absolute value of each \(p_i\) and \(q_i\) is less than CV_DUAL_QUAT_EPS. More...
 
DualQuat< _Tp > power (const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 return the value of \(p^t\) where p is a dual quaternion. This could be calculated as:

\[ p^t = \exp(t\ln p) \]

More...
 
DualQuat< _Tp > power (const DualQuat< _Tp > &q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 return the value of \(p^q\) where p and q are dual quaternions. This could be calculated as:

\[ p^q = \exp(q\ln p) \]

More...
 
Affine3< _Tp > toAffine3 (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 Transform this dual quaternion to a instance of Affine3. More...
 
Matx< _Tp, 4, 4 > toMat (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const
 Transform this dual quaternion to a affine transformation matrix the form of matrix, see createFromMat(). More...
 
Vec< _Tp, 8 > toVec () const
 Transform this dual quaternion to a vector. More...
 

Static Public Member Functions

static DualQuat< _Tp > createFromAffine3 (const Affine3< _Tp > &R)
 create dual quaternion from an affine matrix. The definition of affine matrix can refer to createFromMat() More...
 
static DualQuat< _Tp > createFromAngleAxisTrans (const _Tp angle, const Vec< _Tp, 3 > &axis, const Vec< _Tp, 3 > &translation)
 create a dual quaternion from a rotation angle \(\theta\), a rotation axis \(\boldsymbol{u}\) and a translation \(\boldsymbol{t}\). It generates a dual quaternion \(\sigma\) in the form of

\[\begin{equation} \begin{split} \sigma &= r + \frac{\epsilon}{2}\boldsymbol{t}r \\ &= [\cos(\frac{\theta}{2}), \boldsymbol{u}\sin(\frac{\theta}{2})] + \frac{\epsilon}{2}[0, \boldsymbol{t}][[\cos(\frac{\theta}{2}), \boldsymbol{u}\sin(\frac{\theta}{2})]]\\ &= \cos(\frac{\theta}{2}) + \boldsymbol{u}\sin(\frac{\theta}{2}) + \frac{\epsilon}{2}(-(\boldsymbol{t} \cdot \boldsymbol{u})\sin(\frac{\theta}{2}) + \boldsymbol{t}\cos(\frac{\theta}{2}) + \boldsymbol{u} \times \boldsymbol{t} \sin(\frac{\theta}{2})). \end{split} \end{equation}\]

More...
 
static DualQuat< _Tp > createFromMat (InputArray _R)
 Transform this dual quaternion to an affine transformation matrix \(M\). Dual quaternion consists of a rotation \(r=[a,b,c,d]\) and a translation \(t=[\Delta x,\Delta y,\Delta z]\). The affine transformation matrix \(M\) has the form

\[ \begin{bmatrix} 1-2(e_2^2 +e_3^2) &2(e_1e_2-e_0e_3) &2(e_0e_2+e_1e_3) &\Delta x\\ 2(e_0e_3+e_1e_2) &1-2(e_1^2+e_3^2) &2(e_2e_3-e_0e_1) &\Delta y\\ 2(e_1e_3-e_0e_2) &2(e_0e_1+e_2e_3) &1-2(e_1^2-e_2^2) &\Delta z\\ 0&0&0&1 \end{bmatrix} \]

if A is a matrix consisting of n points to be transformed, this could be achieved by

\[ new\_A = M * A \]

where A has the form

\[ \begin{bmatrix} x_0& x_1& x_2&...&x_n\\ y_0& y_1& y_2&...&y_n\\ z_0& z_1& z_2&...&z_n\\ 1&1&1&...&1 \end{bmatrix} \]

where the same subscript represent the same point. The size of A should be \([4,n]\). and the same size for matrix new_A. More...

 
static DualQuat< _Tp > createFromPitch (const _Tp angle, const _Tp d, const Vec< _Tp, 3 > &axis, const Vec< _Tp, 3 > &moment)
 A dual quaternion is a vector in form of

\[ \begin{equation} \begin{split} \sigma &=\boldsymbol{p} + \epsilon \boldsymbol{q}\\ &= \cos\hat{\frac{\theta}{2}}+\overline{\hat{l}}\sin\frac{\hat{\theta}}{2} \end{split} \end{equation} \]

where \(\hat{\theta}\) is dual angle and \(\overline{\hat{l}}\) is dual axis:

\[ \hat{\theta}=\theta + \epsilon d,\\ \overline{\hat{l}}= \hat{l} +\epsilon m. \]

In this representation, \(\theta\) is rotation angle and \((\hat{l},m)\) is the screw axis, d is the translation distance along the axis. More...

 
static DualQuat< _Tp > createFromQuat (const Quat< _Tp > &realPart, const Quat< _Tp > &dualPart)
 create Dual Quaternion from two same type quaternions p and q. A Dual Quaternion \(\sigma\) has the form:

\[\sigma = p + \epsilon q\]

where p and q are defined as follows:

\[\begin{equation} \begin{split} p &= w + x\boldsymbol{i} + y\boldsymbol{j} + z\boldsymbol{k}\\ q &= w\_ + x\_\boldsymbol{i} + y\_\boldsymbol{j} + z\_\boldsymbol{k}. \end{split} \end{equation} \]

The p and q are the real part and dual part respectively. More...

 
static DualQuat< _Tp > dqblend (const DualQuat< _Tp > &q1, const DualQuat< _Tp > &q2, const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
 The method of Dual Quaternion linear Blending(DQB) is to compute a transformation between dual quaternion \(q_1\) and \(q_2\) and can be defined as:

\[ DQB(t;{\boldsymbol{q}}_1,{\boldsymbol{q}}_2)= \frac{(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2}{||(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2||}. \]

where \(q_1\) and \(q_2\) are unit dual quaternions representing the input transformations. If you want to use DQB that works for more than two rigid transformations, see gdqblend. More...

 
template<int cn>
static DualQuat< _Tp > gdqblend (const Vec< DualQuat< _Tp >, cn > &dualquat, InputArray weights, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
 The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions \(q_1,...,q_n\) with convex weights \(w = (w_1,...,w_n)\), the generalized DQB is simply

\[ gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n} {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}. \]

. More...

 
static DualQuat< _Tp > gdqblend (InputArray dualquat, InputArray weights, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
 The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions \(q_1,...,q_n\) with convex weights \(w = (w_1,...,w_n)\), the generalized DQB is simply

\[ gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n} {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}. \]

. More...

 
static DualQuat< _Tp > sclerp (const DualQuat< _Tp > &q1, const DualQuat< _Tp > &q2, const _Tp t, bool directChange=true, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT)
 The screw linear interpolation(ScLERP) is an extension of spherical linear interpolation of dual quaternion. If \(\sigma_1\) and \(\sigma_2\) are two dual quaternions representing the initial and final pose. The interpolation of ScLERP function can be defined as:

\[ ScLERP(t;\sigma_1,\sigma_2) = \sigma_1 * (\sigma_1^{-1} * \sigma_2)^t, t\in[0,1] \]

. More...

 

Public Attributes

_Tp w
 
_Tp w_
 
_Tp x
 
_Tp x_
 
_Tp y
 
_Tp y_
 
_Tp z
 
_Tp z_
 

Static Public Attributes

static constexpr _Tp CV_DUAL_QUAT_EPS = (_Tp)1.e-6
 

Friends

template<typename T >
DualQuat< T > conjugate (const DualQuat< T > &dq)
 return the conjugate of a dual quaternion.

\[ \begin{equation} \begin{split} \sigma^* &= (p + \epsilon q)^* &= (p^* + \epsilon q^*) \end{split} \end{equation} \]

More...
 
template<typename T >
DualQuat< T > cv::operator* (const T s, const DualQuat< T > &)
 Multiplication operator of a scalar and a dual quaternions. It multiplies right operand with the left operand and assign the result to left operand. More...
 
template<typename T >
DualQuat< T > cv::operator* (const DualQuat< T > &, const T s)
 Multiplication operator of a dual quaternions and a scalar. It multiplies right operand with the left operand and assign the result to left operand. More...
 
template<typename T >
DualQuat< T > cv::operator+ (const T s, const DualQuat< T > &)
 Addition operator of a scalar and a dual quaternions. Adds right hand operand from left hand operand. More...
 
template<typename T >
DualQuat< T > cv::operator+ (const DualQuat< T > &, const T s)
 Addition operator of a dual quaternions and a scalar. Adds right hand operand from left hand operand. More...
 
template<typename T >
DualQuat< T > cv::operator- (const DualQuat< T > &, const T s)
 Subtraction operator of a dual quaternion and a scalar. Subtracts right hand operand from left hand operand. More...
 
template<typename T >
DualQuat< T > cv::operator- (const T s, const DualQuat< T > &)
 Subtraction operator of a scalar and a dual quaternions. Subtracts right hand operand from left hand operand. More...
 
template<typename S >
std::ostream & cv::operator<< (std::ostream &, const DualQuat< S > &)
 
template<typename T >
DualQuat< T > exp (const DualQuat< T > &dq)
 return the value of exponential function value More...
 
template<typename T >
DualQuat< T > inv (const DualQuat< T > &dq, QuatAssumeType assumeUnit)
 if \(\sigma = p + \epsilon q\) is a dual quaternion, p is not zero, the inverse dual quaternion is

\[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \]

or equivalentlly,

\[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\]

More...
 
template<typename T >
DualQuat< T > log (const DualQuat< T > &dq, QuatAssumeType assumeUnit)
 return the value of logarithm function value More...
 
template<typename T >
DualQuat< T > power (const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit)
 return the value of \(p^t\) where p is a dual quaternion. This could be calculated as:

\[ p^t = \exp(t\ln p) \]

More...
 
template<typename T >
DualQuat< T > power (const DualQuat< T > &p, const DualQuat< T > &q, QuatAssumeType assumeUnit)
 return the value of \(p^q\) where p and q are dual quaternions. This could be calculated as:

\[ p^q = \exp(q\ln p) \]

More...
 

Detailed Description

template<typename _Tp>
class cv::DualQuat< _Tp >

Dual quaternions were introduced to describe rotation together with translation while ordinary quaternions can only describe rotation. It can be used for shortest path pose interpolation, local pose optimization or volumetric deformation. More details can be found

A unit dual quaternion can be classically represented as:

\[ \begin{equation} \begin{split} \sigma &= \left(r+\frac{\epsilon}{2}tr\right)\\ &= [w, x, y, z, w\_, x\_, y\_, z\_] \end{split} \end{equation} \]

where \(r, t\) represents the rotation (ordinary unit quaternion) and translation (pure ordinary quaternion) respectively.

A general dual quaternions which consist of two quaternions is usually represented in form of:

\[ \sigma = p + \epsilon q \]

where the introduced dual unit \(\epsilon\) satisfies \(\epsilon^2 = \epsilon^3 =...=0\), and \(p, q\) are quaternions.

Alternatively, dual quaternions can also be interpreted as four components which are all dual numbers:

\[ \sigma = \hat{q}_w + \hat{q}_xi + \hat{q}_yj + \hat{q}_zk \]

If we set \(\hat{q}_x, \hat{q}_y\) and \(\hat{q}_z\) equal to 0, a dual quaternion is transformed to a dual number. see normalize().

If you want to create a dual quaternion, you can use:

using namespace cv;
double angle = CV_PI;
// create from eight number
DualQuatd dq1(1, 2, 3, 4, 5, 6, 7, 8); //p = [1,2,3,4]. q=[5,6,7,8]
// create from Vec
Vec<double, 8> v{1,2,3,4,5,6,7,8};
DualQuatd dq_v{v};
// create from two quaternion
Quatd p(1, 2, 3, 4);
Quatd q(5, 6, 7, 8);
// create from an angle, an axis and a translation
Vec3d axis{0, 0, 1};
Vec3d trans{3, 4, 5};
// If you already have an instance of class Affine3, then you can use
Affine3d R = dq3.toAffine3();
// or create directly by affine transformation matrix Rt
// see createFromMat() in detail for the form of Rt
Matx44d Rt = dq3.toMat();
// Any rotation + translation movement can
// be expressed as a rotation + translation around the same line in space (expressed by Plucker
// coords), and here's a way to represent it this way.
Vec3d axis{1, 1, 1}; // axis will be normalized in createFromPitch
Vec3d trans{3, 4 ,5};
axis = axis / std::sqrt(axis.dot(axis));// The formula for computing moment that I use below requires a normalized axis
Vec3d moment = 1.0 / 2 * (trans.cross(axis) + axis.cross(trans.cross(axis)) *
std::cos(rotation_angle / 2) / std::sin(rotation_angle / 2));
double d = trans.dot(qaxis);
DualQuatd dq6 = DualQuatd::createFromPitch(angle, d, axis, moment);

A point \(v=(x, y, z)\) in form of dual quaternion is \([1+\epsilon v]=[1,0,0,0,0,x,y,z]\). The transformation of a point \(v_1\) to another point \(v_2\) under the dual quaternion \(\sigma\) is

\[ 1 + \epsilon v_2 = \sigma * (1 + \epsilon v_1) * \sigma^{\star} \]

where \(\sigma^{\star}=p^*-\epsilon q^*.\)

A line in the \(Pl\ddot{u}cker\) coordinates \((\hat{l}, m)\) defined by the dual quaternion \(l=\hat{l}+\epsilon m\). To transform a line,

\[l_2 = \sigma * l_1 * \sigma^*,\]

where \(\sigma=r+\frac{\epsilon}{2}rt\) and \(\sigma^*=p^*+\epsilon q^*\).

To extract the Vec<double, 8> or Vec<float, 8>, see toVec();

To extract the affine transformation matrix, see toMat();

To extract the instance of Affine3, see toAffine3();

If two quaternions \(q_0, q_1\) are needed to be interpolated, you can use sclerp()

or dqblend().

With more than two dual quaternions to be blended, you can use generalize linear dual quaternion blending with the corresponding weights, i.e. gdqblend().

Constructor & Destructor Documentation

◆ DualQuat() [1/3]

template<typename _Tp>
cv::DualQuat< _Tp >::DualQuat ( )

◆ DualQuat() [2/3]

template<typename _Tp>
cv::DualQuat< _Tp >::DualQuat ( const _Tp  w,
const _Tp  x,
const _Tp  y,
const _Tp  z,
const _Tp  w_,
const _Tp  x_,
const _Tp  y_,
const _Tp  z_ 
)

create from eight same type numbers.

◆ DualQuat() [3/3]

template<typename _Tp>
cv::DualQuat< _Tp >::DualQuat ( const Vec< _Tp, 8 > &  q)

create from a double or float vector.

Member Function Documentation

◆ conjugate()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::conjugate ( ) const

return the conjugate of a dual quaternion.

\[ \begin{equation} \begin{split} \sigma^* &= (p + \epsilon q)^* &= (p^* + \epsilon q^*) \end{split} \end{equation} \]

◆ createFromAffine3()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::createFromAffine3 ( const Affine3< _Tp > &  R)
static

create dual quaternion from an affine matrix. The definition of affine matrix can refer to createFromMat()

◆ createFromAngleAxisTrans()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::createFromAngleAxisTrans ( const _Tp  angle,
const Vec< _Tp, 3 > &  axis,
const Vec< _Tp, 3 > &  translation 
)
static

create a dual quaternion from a rotation angle \(\theta\), a rotation axis \(\boldsymbol{u}\) and a translation \(\boldsymbol{t}\). It generates a dual quaternion \(\sigma\) in the form of

\[\begin{equation} \begin{split} \sigma &= r + \frac{\epsilon}{2}\boldsymbol{t}r \\ &= [\cos(\frac{\theta}{2}), \boldsymbol{u}\sin(\frac{\theta}{2})] + \frac{\epsilon}{2}[0, \boldsymbol{t}][[\cos(\frac{\theta}{2}), \boldsymbol{u}\sin(\frac{\theta}{2})]]\\ &= \cos(\frac{\theta}{2}) + \boldsymbol{u}\sin(\frac{\theta}{2}) + \frac{\epsilon}{2}(-(\boldsymbol{t} \cdot \boldsymbol{u})\sin(\frac{\theta}{2}) + \boldsymbol{t}\cos(\frac{\theta}{2}) + \boldsymbol{u} \times \boldsymbol{t} \sin(\frac{\theta}{2})). \end{split} \end{equation}\]

Parameters
anglerotation angle.
axisrotation axis.
translationa vector of length 3.
Note
Axis will be normalized in this function. And translation is applied after the rotation. Use createFromQuat(r, r * t / 2) to create a dual quaternion which translation is applied before rotation.
See also
Quat

◆ createFromMat()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::createFromMat ( InputArray  _R)
static

Transform this dual quaternion to an affine transformation matrix \(M\). Dual quaternion consists of a rotation \(r=[a,b,c,d]\) and a translation \(t=[\Delta x,\Delta y,\Delta z]\). The affine transformation matrix \(M\) has the form

\[ \begin{bmatrix} 1-2(e_2^2 +e_3^2) &2(e_1e_2-e_0e_3) &2(e_0e_2+e_1e_3) &\Delta x\\ 2(e_0e_3+e_1e_2) &1-2(e_1^2+e_3^2) &2(e_2e_3-e_0e_1) &\Delta y\\ 2(e_1e_3-e_0e_2) &2(e_0e_1+e_2e_3) &1-2(e_1^2-e_2^2) &\Delta z\\ 0&0&0&1 \end{bmatrix} \]

if A is a matrix consisting of n points to be transformed, this could be achieved by

\[ new\_A = M * A \]

where A has the form

\[ \begin{bmatrix} x_0& x_1& x_2&...&x_n\\ y_0& y_1& y_2&...&y_n\\ z_0& z_1& z_2&...&z_n\\ 1&1&1&...&1 \end{bmatrix} \]

where the same subscript represent the same point. The size of A should be \([4,n]\). and the same size for matrix new_A.

Parameters
_R4x4 matrix that represents rotations and translation.
Note
Translation is applied after the rotation. Use createFromQuat(r, r * t / 2) to create a dual quaternion which translation is applied before rotation.

◆ createFromPitch()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::createFromPitch ( const _Tp  angle,
const _Tp  d,
const Vec< _Tp, 3 > &  axis,
const Vec< _Tp, 3 > &  moment 
)
static

A dual quaternion is a vector in form of

\[ \begin{equation} \begin{split} \sigma &=\boldsymbol{p} + \epsilon \boldsymbol{q}\\ &= \cos\hat{\frac{\theta}{2}}+\overline{\hat{l}}\sin\frac{\hat{\theta}}{2} \end{split} \end{equation} \]

where \(\hat{\theta}\) is dual angle and \(\overline{\hat{l}}\) is dual axis:

\[ \hat{\theta}=\theta + \epsilon d,\\ \overline{\hat{l}}= \hat{l} +\epsilon m. \]

In this representation, \(\theta\) is rotation angle and \((\hat{l},m)\) is the screw axis, d is the translation distance along the axis.

Parameters
anglerotation angle.
dtranslation along the rotation axis.
axisrotation axis represented by quaternion with w = 0.
momentthe moment of line, and it should be orthogonal to axis.
Note
Translation is applied after the rotation. Use createFromQuat(r, r * t / 2) to create a dual quaternion which translation is applied before rotation.

◆ createFromQuat()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::createFromQuat ( const Quat< _Tp > &  realPart,
const Quat< _Tp > &  dualPart 
)
static

create Dual Quaternion from two same type quaternions p and q. A Dual Quaternion \(\sigma\) has the form:

\[\sigma = p + \epsilon q\]

where p and q are defined as follows:

\[\begin{equation} \begin{split} p &= w + x\boldsymbol{i} + y\boldsymbol{j} + z\boldsymbol{k}\\ q &= w\_ + x\_\boldsymbol{i} + y\_\boldsymbol{j} + z\_\boldsymbol{k}. \end{split} \end{equation} \]

The p and q are the real part and dual part respectively.

Parameters
realParta quaternion, real part of dual quaternion.
dualParta quaternion, dual part of dual quaternion.
See also
Quat

◆ dot()

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::dot ( DualQuat< _Tp >  p) const

return the dot product of two dual quaternion.

Parameters
pother dual quaternion.

◆ dqblend()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::dqblend ( const DualQuat< _Tp > &  q1,
const DualQuat< _Tp > &  q2,
const _Tp  t,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
)
static

The method of Dual Quaternion linear Blending(DQB) is to compute a transformation between dual quaternion \(q_1\) and \(q_2\) and can be defined as:

\[ DQB(t;{\boldsymbol{q}}_1,{\boldsymbol{q}}_2)= \frac{(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2}{||(1-t){\boldsymbol{q}}_1+t{\boldsymbol{q}}_2||}. \]

where \(q_1\) and \(q_2\) are unit dual quaternions representing the input transformations. If you want to use DQB that works for more than two rigid transformations, see gdqblend.

Parameters
q1a unit dual quaternion representing the input transformations.
q2a unit dual quaternion representing the input transformations.
tparameter \(t\in[0,1]\).
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.
See also
gdqblend

◆ exp()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::exp ( ) const

return the value of exponential function value

◆ gdqblend() [1/2]

template<typename _Tp>
template<int cn>
static DualQuat<_Tp> cv::DualQuat< _Tp >::gdqblend ( const Vec< DualQuat< _Tp >, cn > &  dualquat,
InputArray  weights,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
)
static

The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions \(q_1,...,q_n\) with convex weights \(w = (w_1,...,w_n)\), the generalized DQB is simply

\[ gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n} {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}. \]

.

Parameters
dualquatvector of dual quaternions
weightsvector of weights, the size of weights should be the same as dualquat, and the weights should satisfy \(\sum_0^n w_{i} = 1\) and \(w_i>0\).
assumeUnitif QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions and this function will save some computations.
Note
the type of weights' element should be the same as the date type of dual quaternion inside the dualquat.

◆ gdqblend() [2/2]

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::gdqblend ( InputArray  dualquat,
InputArray  weights,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
)
static

The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions \(q_1,...,q_n\) with convex weights \(w = (w_1,...,w_n)\), the generalized DQB is simply

\[ gDQB(\boldsymbol{w};{\boldsymbol{q}}_1,...,{\boldsymbol{q}}_n)=\frac{w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n} {||w_1{\boldsymbol{q}}_1+...+w_n{\boldsymbol{q}}_n||}. \]

.

Parameters
dualquatThe dual quaternions which have 8 channels and 1 row or 1 col.
weightsvector of weights, the size of weights should be the same as dualquat, and the weights should satisfy \(\sum_0^n w_{i} = 1\) and \(w_i>0\).
assumeUnitif QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions and this function will save some computations.
Note
the type of weights' element should be the same as the date type of dual quaternion inside the dualquat.

◆ getDualPart()

template<typename _Tp>
Quat<_Tp> cv::DualQuat< _Tp >::getDualPart ( ) const

return a quaternion which represent the dual part of dual quaternion. The definition of dual part is in createFromQuat().

See also
createFromQuat, getRealPart

◆ getRealPart()

template<typename _Tp>
Quat<_Tp> cv::DualQuat< _Tp >::getRealPart ( ) const

return a quaternion which represent the real part of dual quaternion. The definition of real part is in createFromQuat().

See also
createFromQuat, getDualPart

◆ getRotation()

template<typename _Tp>
Quat<_Tp> cv::DualQuat< _Tp >::getRotation ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

return the rotation in quaternion form.

◆ getTranslation()

template<typename _Tp>
Vec<_Tp, 3> cv::DualQuat< _Tp >::getTranslation ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

return the translation vector. The rotation \(r\) in this dual quaternion \(\sigma\) is applied before translation \(t\). The dual quaternion \(\sigma\) is defined as

\[\begin{equation} \begin{split} \sigma &= p + \epsilon q \\ &= r + \frac{\epsilon}{2}{t}r. \end{split} \end{equation}\]

Thus, the translation can be obtained as follows

\[t = 2qp^*.\]

Parameters
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.
Note
This dual quaternion's translation is applied after the rotation.

◆ inv()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::inv ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

if \(\sigma = p + \epsilon q\) is a dual quaternion, p is not zero, the inverse dual quaternion is

\[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \]

or equivalentlly,

\[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\]

Parameters
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.

◆ log()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::log ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

return the value of logarithm function value

Parameters
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.

◆ norm()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::norm ( ) const

return the norm \(||\sigma||\) of dual quaternion \(\sigma = p + \epsilon q\).

\[ \begin{equation} \begin{split} ||\sigma|| &= \sqrt{\sigma * \sigma^*} \\ &= ||p|| + \epsilon \frac{p \cdot q}{||p||}. \end{split} \end{equation} \]

Generally speaking, the norm of a not unit dual quaternion is a dual number. For convenience, we return it in the form of a dual quaternion , i.e.

\[ ||\sigma|| = [||p||, 0, 0, 0, \frac{p \cdot q}{||p||}, 0, 0, 0].\]

Note
The data type of dual number is dual quaternion.

◆ normalize()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::normalize ( ) const

return a normalized dual quaternion. A dual quaternion can be expressed as

\[ \begin{equation} \begin{split} \sigma &= p + \epsilon q\\ &=||\sigma||\left(r+\frac{1}{2}tr\right) \end{split} \end{equation} \]

where \(r, t\) represents the rotation (ordinary quaternion) and translation (pure ordinary quaternion) respectively, and \(||\sigma||\) is the norm of dual quaternion(a dual number). A dual quaternion is unit if and only if

\[ ||p||=1, p \cdot q=0 \]

where \(\cdot\) means dot product. The process of normalization is

\[ \sigma_{u}=\frac{\sigma}{||\sigma||} \]

Next, we simply proof \(\sigma_u\) is a unit dual quaternion:

\[ \renewcommand{\Im}{\operatorname{Im}} \begin{equation} \begin{split} \sigma_{u}=\frac{\sigma}{||\sigma||}&=\frac{p + \epsilon q}{||p||+\epsilon\frac{p\cdot q}{||p||}}\\ &=\frac{p}{||p||}+\epsilon\left(\frac{q}{||p||}-p\frac{p\cdot q}{||p||^3}\right)\\ &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\left(qp^{*}-p\cdot q\right)\frac{p}{||p||}\\ &=\frac{p}{||p||}+\epsilon\frac{1}{||p||^2}\Im(qp^*)\frac{p}{||p||}.\\ \end{split} \end{equation} \]

As expected, the real part is a rotation and dual part is a pure quaternion.

◆ operator*()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator* ( const DualQuat< _Tp > &  ) const

Multiplication operator of two dual quaternions q and p. Multiplies values on either side of the operator.

Rule of dual quaternion multiplication: The dual quaternion can be written as an ordered pair of quaternions [A, B]. Thus

\[ \begin{equation} \begin{split} p * q &= [A, B][C, D]\\ &=[AC, AD + BC] \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
std::cout << p * q << std::endl; //[-60, 12, 30, 24, -216, 80, 124, 120]

◆ operator*=() [1/2]

template<typename _Tp>
DualQuat<_Tp>& cv::DualQuat< _Tp >::operator*= ( const DualQuat< _Tp > &  )

Multiplication assignment operator of two quaternions. It multiplies right operand with the left operand and assign the result to left operand.

Rule of dual quaternion multiplication: The dual quaternion can be written as an ordered pair of quaternions [A, B]. Thus

\[ \begin{equation} \begin{split} p * q &= [A, B][C, D]\\ &=[AC, AD + BC] \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
p *= q;
std::cout << p << std::endl; //[-60, 12, 30, 24, -216, 80, 124, 120]

◆ operator*=() [2/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator*= ( const _Tp  s)

Multiplication assignment operator of a quaternions and a scalar. It multiplies right operand with the left operand and assign the result to left operand.

Rule of dual quaternion multiplication with a scalar:

\[ \begin{equation} \begin{split} p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\ &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s]. \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double s = 2.0;
p *= s;
std::cout << p << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
Note
the type of scalar should be equal to the dual quaternion.

◆ operator+()

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator+ ( const DualQuat< _Tp > &  ) const

Addition operator of two dual quaternions p and q. It returns a new dual quaternion that each value is the sum of \(p_i\) and \(q_i\).

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
std::cout << p + q << std::endl; //[6, 8, 10, 12, 14, 16, 18, 20]

◆ operator+=()

template<typename _Tp>
DualQuat<_Tp>& cv::DualQuat< _Tp >::operator+= ( const DualQuat< _Tp > &  )

Addition assignment operator of two dual quaternions p and q. It adds right operand to the left operand and assign the result to left operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
p += q; // equivalent to p = p + q
std::cout << p << std::endl; //[6, 8, 10, 12, 14, 16, 18, 20]

◆ operator-() [1/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator- ( ) const

Return opposite dual quaternion \(-p\) which satisfies \(p + (-p) = 0.\).

For example

DualQuatd q{1, 2, 3, 4, 5, 6, 7, 8};
std::cout << -q << std::endl; // [-1, -2, -3, -4, -5, -6, -7, -8]

◆ operator-() [2/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator- ( const DualQuat< _Tp > &  ) const

Subtraction operator of two dual quaternions p and q. It returns a new dual quaternion that each value is the sum of \(p_i\) and \(-q_i\).

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
std::cout << p - q << std::endl; //[-4, -4, -4, -4, 4, -4, -4, -4]

◆ operator-=()

template<typename _Tp>
DualQuat<_Tp>& cv::DualQuat< _Tp >::operator-= ( const DualQuat< _Tp > &  )

Subtraction assignment operator of two dual quaternions p and q. It subtracts right operand from the left operand and assign the result to left operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
p -= q; // equivalent to p = p - q
std::cout << p << std::endl; //[-4, -4, -4, -4, 4, -4, -4, -4]

◆ operator/() [1/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator/ ( const _Tp  s) const

Division operator of a dual quaternions and a scalar. It divides left operand with the right operand and assign the result to left operand.

Rule of dual quaternion division with a scalar:

\[ \begin{equation} \begin{split} p / s &= [w, x, y, z, w\_, x\_, y\_, z\_] / s\\ &=[w/s, x/s, y/s, z/s, w\_/s, x\_/s, y\_/s, z\_/s]. \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double s = 2.0;
p /= s; // equivalent to p = p / s
std::cout << p << std::endl; //[0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4]
Note
the type of scalar should be equal to this dual quaternion.

◆ operator/() [2/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::operator/ ( const DualQuat< _Tp > &  ) const

Division operator of two dual quaternions p and q. Divides left hand operand by right hand operand.

Rule of dual quaternion division with a dual quaternion:

\[ \begin{equation} \begin{split} p / q &= p * q.inv()\\ \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
std::cout << p / q << std::endl; // equivalent to p * q.inv()

◆ operator/=() [1/2]

template<typename _Tp>
DualQuat<_Tp>& cv::DualQuat< _Tp >::operator/= ( const DualQuat< _Tp > &  )

Division assignment operator of two dual quaternions p and q; It divides left operand with the right operand and assign the result to left operand.

Rule of dual quaternion division with a quaternion:

\[ \begin{equation} \begin{split} p / q&= p * q.inv()\\ \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
DualQuatd q{5, 6, 7, 8, 9, 10, 11, 12};
p /= q; // equivalent to p = p * q.inv()
std::cout << p << std::endl;

◆ operator/=() [2/2]

template<typename _Tp>
Quat<_Tp>& cv::DualQuat< _Tp >::operator/= ( const _Tp  s)

Division assignment operator of a dual quaternions and a scalar. It divides left operand with the right operand and assign the result to left operand.

Rule of dual quaternion division with a scalar:

\[ \begin{equation} \begin{split} p / s &= [w, x, y, z, w\_, x\_, y\_ ,z\_] / s\\ &=[w / s, x / s, y / s, z / s, w\_ / \space s, x\_ / \space s, y\_ / \space s, z\_ / \space s]. \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double s = 2.0;;
p /= s; // equivalent to p = p / s
std::cout << p << std::endl; //[0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0]
Note
the type of scalar should be equal to the dual quaternion.

◆ operator==()

template<typename _Tp>
bool cv::DualQuat< _Tp >::operator== ( const DualQuat< _Tp > &  ) const

return true if two dual quaternions p and q are nearly equal, i.e. when the absolute value of each \(p_i\) and \(q_i\) is less than CV_DUAL_QUAT_EPS.

◆ power() [1/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::power ( const _Tp  t,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
) const

return the value of \(p^t\) where p is a dual quaternion. This could be calculated as:

\[ p^t = \exp(t\ln p) \]

Parameters
tindex of power function.
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.

◆ power() [2/2]

template<typename _Tp>
DualQuat<_Tp> cv::DualQuat< _Tp >::power ( const DualQuat< _Tp > &  q,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
) const

return the value of \(p^q\) where p and q are dual quaternions. This could be calculated as:

\[ p^q = \exp(q\ln p) \]

Parameters
qa dual quaternion
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a dual unit quaternion and this function will save some computations.

◆ sclerp()

template<typename _Tp>
static DualQuat<_Tp> cv::DualQuat< _Tp >::sclerp ( const DualQuat< _Tp > &  q1,
const DualQuat< _Tp > &  q2,
const _Tp  t,
bool  directChange = true,
QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT 
)
static

The screw linear interpolation(ScLERP) is an extension of spherical linear interpolation of dual quaternion. If \(\sigma_1\) and \(\sigma_2\) are two dual quaternions representing the initial and final pose. The interpolation of ScLERP function can be defined as:

\[ ScLERP(t;\sigma_1,\sigma_2) = \sigma_1 * (\sigma_1^{-1} * \sigma_2)^t, t\in[0,1] \]

.

Parameters
q1a dual quaternion represents a initial pose.
q2a dual quaternion represents a final pose.
tinterpolation parameter
directChangeif true, it always return the shortest path.
assumeUnitif QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations.

For example

double angle1 = CV_PI / 2;
Vec3d axis{0, 0, 1};
Vec3d t(0, 0, 3);
double angle2 = CV_PI;
DualQuatd inter = DualQuatd::sclerp(initial, final, 0.5);

◆ toAffine3()

template<typename _Tp>
Affine3<_Tp> cv::DualQuat< _Tp >::toAffine3 ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

Transform this dual quaternion to a instance of Affine3.

◆ toMat()

template<typename _Tp>
Matx<_Tp, 4, 4> cv::DualQuat< _Tp >::toMat ( QuatAssumeType  assumeUnit = QUAT_ASSUME_NOT_UNIT) const

Transform this dual quaternion to a affine transformation matrix the form of matrix, see createFromMat().

◆ toVec()

template<typename _Tp>
Vec<_Tp, 8> cv::DualQuat< _Tp >::toVec ( ) const

Transform this dual quaternion to a vector.

Friends And Related Function Documentation

◆ conjugate

template<typename _Tp>
template<typename T >
DualQuat<T> conjugate ( const DualQuat< T > &  dq)
friend

return the conjugate of a dual quaternion.

\[ \begin{equation} \begin{split} \sigma^* &= (p + \epsilon q)^* &= (p^* + \epsilon q^*) \end{split} \end{equation} \]

Parameters
dqa dual quaternion.

◆ cv::operator* [1/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator* ( const T  s,
const DualQuat< T > &   
)
friend

Multiplication operator of a scalar and a dual quaternions. It multiplies right operand with the left operand and assign the result to left operand.

Rule of dual quaternion multiplication with a scalar:

\[ \begin{equation} \begin{split} p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\ &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s]. \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double s = 2.0;
std::cout << s * p << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator* [2/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator* ( const DualQuat< T > &  ,
const T  s 
)
friend

Multiplication operator of a dual quaternions and a scalar. It multiplies right operand with the left operand and assign the result to left operand.

Rule of dual quaternion multiplication with a scalar:

\[ \begin{equation} \begin{split} p * s &= [w, x, y, z, w\_, x\_, y\_, z\_] * s\\ &=[w s, x s, y s, z s, w\_ \space s, x\_ \space s, y\_ \space s, z\_ \space s]. \end{split} \end{equation} \]

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double s = 2.0;
std::cout << p * s << std::endl; //[2, 4, 6, 8, 10, 12, 14, 16]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator+ [1/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator+ ( const T  s,
const DualQuat< T > &   
)
friend

Addition operator of a scalar and a dual quaternions. Adds right hand operand from left hand operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double scalar = 2.0;
std::cout << scalar + p << std::endl; //[3.0, 2, 3, 4, 5, 6, 7, 8]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator+ [2/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator+ ( const DualQuat< T > &  ,
const T  s 
)
friend

Addition operator of a dual quaternions and a scalar. Adds right hand operand from left hand operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double scalar = 2.0;
std::cout << p + scalar << std::endl; //[3.0, 2, 3, 4, 5, 6, 7, 8]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator- [1/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator- ( const DualQuat< T > &  ,
const T  s 
)
friend

Subtraction operator of a dual quaternion and a scalar. Subtracts right hand operand from left hand operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double scalar = 2.0;
std::cout << p - scalar << std::endl; //[-1, 2, 3, 4, 5, 6, 7, 8]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator- [2/2]

template<typename _Tp>
template<typename T >
DualQuat<T> cv::operator- ( const T  s,
const DualQuat< T > &   
)
friend

Subtraction operator of a scalar and a dual quaternions. Subtracts right hand operand from left hand operand.

For example

DualQuatd p{1, 2, 3, 4, 5, 6, 7, 8};
double scalar = 2.0;
std::cout << scalar - p << std::endl; //[1.0, -2, -3, -4, -5, -6, -7, -8]
Note
the type of scalar should be equal to the dual quaternion.

◆ cv::operator<<

template<typename _Tp>
template<typename S >
std::ostream& cv::operator<< ( std::ostream &  ,
const DualQuat< S > &   
)
friend

◆ exp

template<typename _Tp>
template<typename T >
DualQuat<T> exp ( const DualQuat< T > &  dq)
friend

return the value of exponential function value

Parameters
dqa dual quaternion.

◆ inv

template<typename _Tp>
template<typename T >
DualQuat<T> inv ( const DualQuat< T > &  dq,
QuatAssumeType  assumeUnit 
)
friend

if \(\sigma = p + \epsilon q\) is a dual quaternion, p is not zero, the inverse dual quaternion is

\[\sigma^{-1} = \frac{\sigma^*}{||\sigma||^2}, \]

or equivalentlly,

\[\sigma^{-1} = p^{-1} - \epsilon p^{-1}qp^{-1}.\]

Parameters
dqa dual quaternion.
assumeUnitif QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations.

◆ log

template<typename _Tp>
template<typename T >
DualQuat<T> log ( const DualQuat< T > &  dq,
QuatAssumeType  assumeUnit 
)
friend

return the value of logarithm function value

Parameters
dqa dual quaternion.
assumeUnitif QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations.

◆ power [1/2]

template<typename _Tp>
template<typename T >
DualQuat<T> power ( const DualQuat< T > &  dq,
const T  t,
QuatAssumeType  assumeUnit 
)
friend

return the value of \(p^t\) where p is a dual quaternion. This could be calculated as:

\[ p^t = \exp(t\ln p) \]

Parameters
dqa dual quaternion.
tindex of power function.
assumeUnitif QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations.

◆ power [2/2]

template<typename _Tp>
template<typename T >
DualQuat<T> power ( const DualQuat< T > &  p,
const DualQuat< T > &  q,
QuatAssumeType  assumeUnit 
)
friend

return the value of \(p^q\) where p and q are dual quaternions. This could be calculated as:

\[ p^q = \exp(q\ln p) \]

Parameters
pa dual quaternion.
qa dual quaternion.
assumeUnitif QUAT_ASSUME_UNIT, dual quaternion p assume to be a dual unit quaternion and this function will save some computations.

Member Data Documentation

◆ CV_DUAL_QUAT_EPS

template<typename _Tp>
constexpr _Tp cv::DualQuat< _Tp >::CV_DUAL_QUAT_EPS = (_Tp)1.e-6
static

◆ w

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::w

◆ w_

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::w_

◆ x

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::x

◆ x_

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::x_

◆ y

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::y

◆ y_

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::y_

◆ z

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::z

◆ z_

template<typename _Tp>
_Tp cv::DualQuat< _Tp >::z_

The documentation for this class was generated from the following file: