Open 3D Engine EMotionFX Gem API Reference
24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <DualQuaternion.h>
Public Member Functions | |
MCORE_INLINE | DualQuaternion () |
MCORE_INLINE | DualQuaternion (const DualQuaternion &other) |
MCORE_INLINE | DualQuaternion (const AZ::Quaternion &real, const AZ::Quaternion &dual) |
MCORE_INLINE | DualQuaternion (const AZ::Transform &transform) |
MCORE_INLINE | DualQuaternion (const AZ::Quaternion &rotation, const AZ::Vector3 &translation) |
MCORE_INLINE void | Set (const AZ::Quaternion &real, const AZ::Quaternion &dual) |
DualQuaternion & | Normalize () |
MCORE_INLINE DualQuaternion | Normalized () const |
MCORE_INLINE DualQuaternion & | Identity () |
MCORE_INLINE AZ::Vector2 | Dot (const DualQuaternion &other) const |
MCORE_INLINE AZ::Vector2 | Length () const |
DualQuaternion & | Inverse () |
DualQuaternion | Inversed () const |
MCORE_INLINE DualQuaternion & | Conjugate () |
MCORE_INLINE DualQuaternion | Conjugated () const |
MCORE_INLINE void | FromTransform (const AZ::Transform &transform) |
MCORE_INLINE void | FromRotationTranslation (const AZ::Quaternion &rot, const AZ::Vector3 &pos) |
AZ::Transform | ToTransform () const |
MCORE_INLINE AZ::Vector3 | TransformPoint (const AZ::Vector3 &point) const |
MCORE_INLINE AZ::Vector3 | TransformVector (const AZ::Vector3 &v) const |
void | ToRotationTranslation (AZ::Quaternion *outRot, AZ::Vector3 *outPos) const |
void | NormalizedToRotationTranslation (AZ::Quaternion *outRot, AZ::Vector3 *outPos) const |
MCORE_INLINE const DualQuaternion & | operator= (const AZ::Transform &transform) |
MCORE_INLINE const DualQuaternion & | operator= (const DualQuaternion &other) |
MCORE_INLINE DualQuaternion | operator- () const |
MCORE_INLINE const DualQuaternion & | operator+= (const DualQuaternion &q) |
MCORE_INLINE const DualQuaternion & | operator-= (const DualQuaternion &q) |
MCORE_INLINE const DualQuaternion & | operator*= (const DualQuaternion &q) |
MCORE_INLINE const DualQuaternion & | operator*= (float f) |
Static Public Member Functions | |
static DualQuaternion | ConvertFromTransform (const AZ::Transform &transform) |
static DualQuaternion | ConvertFromRotationTranslation (const AZ::Quaternion &rotation, const AZ::Vector3 &translation) |
Public Attributes | |
AZ::Quaternion | m_real |
AZ::Quaternion | m_dual |
The dual quaternion class. Dual quaternions contain two internal vectors. The real and dual part. They behave very similar to regular quaternions in usage. The difference is that the dual quaternion can represent both a rotation and translation or displacement. The dual quaternion consists of a real part, which you can see as the rotation quaternion, and a dual part, which you can see as the translation part. One of the advantages of dual quaternions is that they can be used to replace the linear skin deformations with a volume preserving method. Using dual quaternions in skinning fixes issues such as the famous candy-wrapper effect. It handles twisting of bones much nicer compared to the linear method. This is often referred to as dual quaternion skinning.
|
inline |
The default constructor. This automatically initializes the dual quaternion to identity.
|
inline |
Copy constructor.
other | The dual quaternion to copy the data from. |
|
inline |
Extended constructor.
real | The real part, which is the rotation part. |
dual | The dual part, which is you can see as the translation part. |
|
inline |
Constructor which takes a matrix as input parameter. This converts the rotation of the specified matrix into a quaternion. Please keep in mind that the matrix may NOT contain any scaling, so if it does, please normalize your matrix first!
matrix | The matrix to initialize the quaternion from. |
MCORE_INLINE DualQuaternion::DualQuaternion | ( | const AZ::Quaternion & | rotation, |
const AZ::Vector3 & | translation | ||
) |
Extended constructor, which initializes this dual quaternion from a rotation and translation.
rotation | The rotation quaternion, which does not need to be normalized, unless you want this to be a normalized dual quaternion. |
translation | The translation vector. |
|
inline |
Conjugate this dual quaternion.
|
inline |
Calculate a conjugated version of this dual quaternion.
|
static |
Convert a rotation and translation into a dual quaternion.
rotation | The rotation quaternion, which does not need to be normalized. |
translation | The translation. |
|
static |
Convert a matrix into a quaternion. Please keep in mind that the specified matrix may NOT contain any scaling! So make sure the matrix has been normalized before, if it contains any scale.
m | The matrix to extract the rotation from. |
|
inline |
Get the dot product between the two dual quaternions. This basically performs two dot products: One on the real part and one on the dual part. That means that it also results in two float values, which is why a Vector2 is returned.
other | The other dual quaternion to perform the dot product with. |
|
inline |
Initialize this dual quaternion from a rotation and translation.
rot | The rotation quaternion. |
pos | The translation vector. |
|
inline |
Initialize the current quaternion from a specified matrix. Please note that the matrix may not contain any scaling! So make sure the matrix has been normalized before, if it contains any scale.
m | The matrix to initialize the quaternion from. |
|
inline |
Set the dual quaternion to identity, so that it has basically no transform. The default constructor already puts the dual quaternion in its identity transform.
DualQuaternion& MCore::DualQuaternion::Inverse | ( | ) |
Inverse this dual quaternion.
DualQuaternion MCore::DualQuaternion::Inversed | ( | ) | const |
Calculate an inversed version of this dual quaternion.
|
inline |
Calculate the length of the dual quaternion. This results in a 2D vector, because it calculates the length for both the real and dual parts. The result of the real part will be stored in the x component of the 2D vector, and the result of the dual part will be stored in the y component.
DualQuaternion& MCore::DualQuaternion::Normalize | ( | ) |
Normalize the dual quaternion.
|
inline |
Calculate the normalized version of this dual quaternion.
void MCore::DualQuaternion::NormalizedToRotationTranslation | ( | AZ::Quaternion * | outRot, |
AZ::Vector3 * | outPos | ||
) | const |
Extract the rotation and translation from this dual normalized quaternion. This method assumes that this dual quaternion is normalized. If it isn't, the resulting output will be incorrect! If you are not sure this quaternion is not normalized, or if you know it is not, please use the ToRotationTranslation method.
outRot | A pointer to the quaternion in which we will store the output rotation. |
outPos | A pointer to the vector in which we will store the output translation. |
|
inline |
Set the real and dual part of the dual quaternion.
real | The real part, which represents the rotation. |
dual | The dual part, which represents the translation. |
void MCore::DualQuaternion::ToRotationTranslation | ( | AZ::Quaternion * | outRot, |
AZ::Vector3 * | outPos | ||
) | const |
Extract the rotation and translation from this dual quaternion. This method handles non-unit dual quaternions fine. If you are sure your dual quaternion is normalized, you should use the faster version of this method, which is called NormalizedToRotationTranslation.
outRot | A pointer to the quaternion in which we will store the output rotation. |
outPos | A pointer to the vector in which we will store the output translation. |
AZ::Transform MCore::DualQuaternion::ToTransform | ( | ) | const |
Convert this dual quaternion into a 4x4 matrix.
MCORE_INLINE AZ::Vector3 DualQuaternion::TransformPoint | ( | const AZ::Vector3 & | point | ) | const |
Transform a 3D point with this dual quaternion. This applies both a rotation and possible translation to the point.
point | The 3D point to transform. |
MCORE_INLINE AZ::Vector3 DualQuaternion::TransformVector | ( | const AZ::Vector3 & | v | ) | const |
Transform a 3D vector with this dual quaternion. This will apply only the rotation part of this dual quaternion. So it will not apply any displacement caused by the dual part of this dual quaternion. You should use this method when transforming normals and tangents for example. You can use the TransformPoint method to transform 3D points. This vector transform is also faster than the TransformPoint method, as it has to do fewer calculations.
v | The input vector. |
AZ::Quaternion MCore::DualQuaternion::m_dual |
The dual part, which you can see as the translation part.
AZ::Quaternion MCore::DualQuaternion::m_real |
The real value, which you can see as the regular rotation quaternion.