#include <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... | |
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 > | getDualPart () const |
return a quaternion which represent the dual part of dual quaternion. The definition of dual part is in createFromQuat(). More... | |
DualQuat< _Tp > | conjugate () const |
return the conjugate of a dual quaternion. 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 in this dual quaternion is applied before translation . The dual quaternion is defined as More... | |
DualQuat< _Tp > | norm () const |
return the norm of dual quaternion . More... | |
DualQuat< _Tp > | normalize () const |
return a normalized dual quaternion. A dual quaternion can be expressed as More... | |
DualQuat< _Tp > | inv (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const |
if is a dual quaternion, p is not zero, the inverse dual quaternion is More... | |
_Tp | dot (DualQuat< _Tp > p) const |
return the dot product of two dual quaternion. More... | |
DualQuat< _Tp > | power (const _Tp t, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const |
return the value of where p is a dual quaternion. This could be calculated as: More... | |
DualQuat< _Tp > | power (const DualQuat< _Tp > &q, QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const |
return the value of where p and q are dual quaternions. This could be calculated as: More... | |
DualQuat< _Tp > | exp () const |
return the value of exponential function value More... | |
DualQuat< _Tp > | log (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const |
return the value of logarithm function value More... | |
Vec< _Tp, 8 > | toVec () const |
Transform this dual quaternion to a vector. 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... | |
Affine3< _Tp > | toAffine3 (QuatAssumeType assumeUnit=QUAT_ASSUME_NOT_UNIT) const |
Transform this dual quaternion to a instance of Affine3. More... | |
DualQuat< _Tp > | operator- () const |
Return opposite dual quaternion which satisfies . 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 and is less than CV_DUAL_QUAT_EPS. 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 and . 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 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 and . 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 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 |
Multiplication operator of two dual quaternions q and p. Multiplies values on either side of the operator. 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... | |
template<typename T > | |
DualQuat< T > | power (const T t, QuatAssumeType assumeUnit) const |
template<typename T > | |
DualQuat< T > | power (const DualQuat< T > &q, QuatAssumeType assumeUnit) const |
template<int cn> | |
DualQuat< T > | gdqblend (const Vec< DualQuat< T >, cn > &_dualquat, InputArray _weight, QuatAssumeType assumeUnit) |
Static Public Member Functions | |
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 has the form: 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 , a rotation axis and a translation . It generates a dual quaternion in the form of More... | |
static DualQuat< _Tp > | createFromMat (InputArray _R) |
Transform this dual quaternion to an affine transformation matrix . Dual quaternion consists of a rotation and a translation . The affine transformation matrix has the form. More... | |
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 > | 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. 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 and are two dual quaternions representing the initial and final pose. The interpolation of ScLERP function can be defined as: 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 and and can be defined as: 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 with convex weights , the generalized DQB is simply. 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 with convex weights , the generalized DQB is simply. More... | |
Public Attributes | |
_Tp | w |
_Tp | x |
_Tp | y |
_Tp | z |
_Tp | w_ |
_Tp | x_ |
_Tp | y_ |
_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. More... | |
template<typename T > | |
DualQuat< T > | inv (const DualQuat< T > &dq, QuatAssumeType assumeUnit) |
if is a dual quaternion, p is not zero, the inverse dual quaternion is More... | |
template<typename T > | |
DualQuat< T > | power (const DualQuat< T > &dq, const T t, QuatAssumeType assumeUnit) |
return the value of where p is a dual quaternion. This could be calculated as: More... | |
template<typename T > | |
DualQuat< T > | power (const DualQuat< T > &p, const DualQuat< T > &q, QuatAssumeType assumeUnit) |
return the value of where p and q are dual quaternions. This could be calculated as: More... | |
template<typename T > | |
DualQuat< T > | exp (const DualQuat< T > &dq) |
return the value of exponential function value 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 > | 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 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) |
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 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 S > | |
std::ostream & | cv::operator<< (std::ostream &, const DualQuat< S > &) |
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:
where 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:
where the introduced dual unit satisfies , and are quaternions.
Alternatively, dual quaternions can also be interpreted as four components which are all dual numbers:
If we set and 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:
A point in form of dual quaternion is . The transformation of a point to another point under the dual quaternion is
where
A line in the coordinates defined by the dual quaternion . To transform a line,
where and .
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 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().
cv::DualQuat< T >::DualQuat |
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.
cv::DualQuat< _Tp >::DualQuat | ( | const Vec< _Tp, 8 > & | q | ) |
create from a double or float vector.
|
inline |
return the conjugate of a dual quaternion.
|
static |
create dual quaternion from an affine matrix. The definition of affine matrix can refer to createFromMat()
|
static |
create a dual quaternion from a rotation angle , a rotation axis and a translation . It generates a dual quaternion in the form of
angle | rotation angle. |
axis | rotation axis. |
translation | a vector of length 3. |
|
static |
Transform this dual quaternion to an affine transformation matrix . Dual quaternion consists of a rotation and a translation . The affine transformation matrix has the form.
if A is a matrix consisting of n points to be transformed, this could be achieved by
where A has the form
where the same subscript represent the same point. The size of A should be . and the same size for matrix new_A.
_R | 4x4 matrix that represents rotations and translation. |
|
static |
A dual quaternion is a vector in form of.
where is dual angle and is dual axis:
In this representation, is rotation angle and is the screw axis, d is the translation distance along the axis.
angle | rotation angle. |
d | translation along the rotation axis. |
axis | rotation axis represented by quaternion with w = 0. |
moment | the moment of line, and it should be orthogonal to axis. |
|
static |
create Dual Quaternion from two same type quaternions p and q. A Dual Quaternion has the form:
where p and q are defined as follows:
The p and q are the real part and dual part respectively.
realPart | a quaternion, real part of dual quaternion. |
dualPart | a quaternion, dual part of dual quaternion. |
|
inline |
return the dot product of two dual quaternion.
p | other dual quaternion. |
|
static |
The method of Dual Quaternion linear Blending(DQB) is to compute a transformation between dual quaternion and and can be defined as:
where and are unit dual quaternions representing the input transformations. If you want to use DQB that works for more than two rigid transformations, see gdqblend
q1 | a unit dual quaternion representing the input transformations. |
q2 | a unit dual quaternion representing the input transformations. |
t | parameter . |
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
DualQuat< T > cv::DualQuat< T >::exp |
return the value of exponential function value
|
static |
The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions with convex weights , the generalized DQB is simply.
dualquat | vector of dual quaternions |
weights | vector of weights, the size of weights should be the same as dualquat, and the weights should satisfy and . |
assumeUnit | if QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions and this function will save some computations. |
DualQuat<T> cv::DualQuat< _Tp >::gdqblend | ( | const Vec< DualQuat< T >, cn > & | _dualquat, |
InputArray | _weight, | ||
QuatAssumeType | assumeUnit | ||
) |
|
static |
The generalized Dual Quaternion linear Blending works for more than two rigid transformations. If these transformations are expressed as unit dual quaternions with convex weights , the generalized DQB is simply.
dualquat | The dual quaternions which have 8 channels and 1 row or 1 col. |
weights | vector of weights, the size of weights should be the same as dualquat, and the weights should satisfy and . |
assumeUnit | if QUAT_ASSUME_UNIT, these dual quaternions assume to be unit quaternions and this function will save some computations. |
|
inline |
return a quaternion which represent the dual part of dual quaternion. The definition of dual part is in createFromQuat().
|
inline |
return a quaternion which represent the real part of dual quaternion. The definition of real part is in createFromQuat().
|
inline |
return the rotation in quaternion form.
|
inline |
return the translation vector. The rotation in this dual quaternion is applied before translation . The dual quaternion is defined as
Thus, the translation can be obtained as follows
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
|
inline |
if is a dual quaternion, p is not zero, the inverse dual quaternion is
or equivalentlly,
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
DualQuat< T > cv::DualQuat< T >::log | ( | QuatAssumeType | assumeUnit = QUAT_ASSUME_NOT_UNIT | ) | const |
return the value of logarithm function value
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
DualQuat< T > cv::DualQuat< T >::norm |
return the norm of dual quaternion .
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.
DualQuat< T > cv::DualQuat< T >::normalize |
return a normalized dual quaternion. A dual quaternion can be expressed as
where represents the rotation (ordinary quaternion) and translation (pure ordinary quaternion) respectively, and is the norm of dual quaternion(a dual number). A dual quaternion is unit if and only if
where means dot product. The process of normalization is
Next, we simply proof is a unit dual quaternion:
As expected, the real part is a rotation and dual part is a pure quaternion.
|
inline |
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
For example
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:
For example
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
For example
|
inline |
|
inline |
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
|
inline |
DualQuat<_Tp> cv::DualQuat< _Tp >::operator- | ( | const DualQuat< _Tp > & | ) | const |
|
inline |
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
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:
For example
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:
For example
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:
For example
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:
For example
|
inline |
return true if two dual quaternions p and q are nearly equal, i.e. when the absolute value of each and is less than CV_DUAL_QUAT_EPS.
DualQuat<_Tp> cv::DualQuat< _Tp >::power | ( | const _Tp | t, |
QuatAssumeType | assumeUnit = QUAT_ASSUME_NOT_UNIT |
||
) | const |
return the value of where p is a dual quaternion. This could be calculated as:
t | index of power function. |
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
DualQuat<_Tp> cv::DualQuat< _Tp >::power | ( | const DualQuat< _Tp > & | q, |
QuatAssumeType | assumeUnit = QUAT_ASSUME_NOT_UNIT |
||
) | const |
return the value of where p and q are dual quaternions. This could be calculated as:
q | a dual quaternion |
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a dual unit quaternion and this function will save some computations. |
|
inline |
|
inline |
|
static |
The screw linear interpolation(ScLERP) is an extension of spherical linear interpolation of dual quaternion. If and are two dual quaternions representing the initial and final pose. The interpolation of ScLERP function can be defined as:
q1 | a dual quaternion represents a initial pose. |
q2 | a dual quaternion represents a final pose. |
t | interpolation parameter |
directChange | if true, it always return the shortest path. |
assumeUnit | if QUAT_ASSUME_UNIT, this dual quaternion assume to be a unit dual quaternion and this function will save some computations. |
For example
Affine3< T > cv::DualQuat< T >::toAffine3 | ( | QuatAssumeType | assumeUnit = QUAT_ASSUME_NOT_UNIT | ) | const |
Transform this dual quaternion to a instance of Affine3.
Matx< T, 4, 4 > cv::DualQuat< T >::toMat | ( | QuatAssumeType | assumeUnit = QUAT_ASSUME_NOT_UNIT | ) | const |
Transform this dual quaternion to a affine transformation matrix the form of matrix, see createFromMat().
|
inline |
Transform this dual quaternion to a vector.
|
friend |
return the conjugate of a dual quaternion.
dq | a dual quaternion. |
|
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:
For example
|
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:
For example
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
return the value of exponential function value
dq | a dual quaternion. |
|
friend |
if is a dual quaternion, p is not zero, the inverse dual quaternion is
or equivalentlly,
dq | a dual quaternion. |
assumeUnit | if QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations. |
|
friend |
return the value of logarithm function value
dq | a dual quaternion. |
assumeUnit | if QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations. |
|
friend |
return the value of where p is a dual quaternion. This could be calculated as:
dq | a dual quaternion. |
t | index of power function. |
assumeUnit | if QUAT_ASSUME_UNIT, dual quaternion dq assume to be a unit dual quaternion and this function will save some computations. |
|
friend |
return the value of where p and q are dual quaternions. This could be calculated as:
p | a dual quaternion. |
q | a dual quaternion. |
assumeUnit | if QUAT_ASSUME_UNIT, dual quaternion p assume to be a dual unit quaternion and this function will save some computations. |
|
staticconstexpr |
_Tp cv::DualQuat< _Tp >::w |
_Tp cv::DualQuat< _Tp >::w_ |
_Tp cv::DualQuat< _Tp >::x |
_Tp cv::DualQuat< _Tp >::x_ |
_Tp cv::DualQuat< _Tp >::y |
_Tp cv::DualQuat< _Tp >::y_ |
_Tp cv::DualQuat< _Tp >::z |
_Tp cv::DualQuat< _Tp >::z_ |