|
AGX Dynamics
2.37.2.0
|
The object holding quaternions and providing operations on these. More...
#include <QuatTemplate.h>
Public Types | |
| typedef T | Type |
Public Member Functions | |
| QuatT () | |
| Default constructor. Create a Quaternion with an identity rotation. More... | |
| QuatT (T x, T y, T z, T w) | |
| Create a Quaternion with the specified scalar values. More... | |
| QuatT (const Vec4T< T > &v) | |
| Create a Quaternion based on the 4D vector (x,y,z,w) More... | |
| QuatT (T angle, const Vec3T< T > &axis) | |
Create a Quaternion calculated from a rotation of angle radians around the rotation axis axis. More... | |
| QuatT (T angle1, const Vec3T< T > &axis1, T angle2, const Vec3T< T > &axis2, T angle3, const Vec3T< T > &axis3) | |
| Create a Quaternion based on the concatenation between the three specified angle and axis. More... | |
| QuatT (const Vec3T< T > &from, const Vec3T< T > &to) | |
Create a Quaternion which maps the rotation from vector from to the vector to. More... | |
| QuatT (const EulerAngles &euler) | |
Create a Quaternion based on the rotation from euler specified as a EulerAngle. More... | |
| QuatT (const QuatT< T > ©)=default | |
| Copy constructor. More... | |
| template<typename T2 > | |
| QuatT (const QuatT< T2 > ©) | |
| Copy constructor for other types. More... | |
| QuatT (const AffineMatrix4x4T< T > &matrix) | |
| Create a Quaternion based on the rotation part in the specified Affine 4x4 transformation matrix. More... | |
| Vec3T< T > | asVec3 () const |
| Vec4T< T > | asVec4 () const |
| QuatT< T > | conj () const |
| void | get (EulerAngles &euler) const |
| Convert this quaternion to an EulerAngles representation. More... | |
| void | get (AffineMatrix4x4T< T > &matrix) const |
Set the Rotational part of matrix from this quaternion. More... | |
| void | get (OrthoMatrix3x3 &matrix) const |
| Set an OrthoMatrix3x3 to represent the same rotation as the quaternion. More... | |
| void | get (T &angle, agx::Vec3T< T > &axis) const |
| Convert a Quaternion to an axis and angle representation. More... | |
| agx::Real | getAngle () const |
| Get the rotation angle represented by the quaternion. More... | |
| Vec3T< T > | getAsEulerAngles (agx::EulerConvention::Convention convention=agx::EulerConvention::Convention::DEFAULT_CONVENTION) const |
| Convert to Euler anglers. More... | |
| void | getRotate (T &angle, T &x, T &y, T &z) const |
| Get the angle and vector components represented by the quaternion. More... | |
| void | getRotate (T &angle, Vec3T< T > &vec) const |
| Get the angle and vector represented by the quaternion. More... | |
| agx::Vec3T< T > | getUnitVector () const |
| Get the rotation unit vector represented by the quaternion. More... | |
| QuatT< T > | inverse () const |
| Multiplicative inverse method: q^(-1) = q^*/(q.q^*) More... | |
| const QuatT< T > | leftMult (const QuatT< T > &rhs) const |
| Binary left multiplication: q = p * rhs; results in the OTHER WAY AROUND: q = rhs quatmultiply p;. More... | |
| T | length () const |
| T | length2 () const |
| T | normalize () |
| Normalize the quat so that it has unit length. More... | |
| bool | operator!= (const QuatT< T > &v) const |
| const QuatT< T > | operator* (T rhs) const |
Multiply by scalar rhs. More... | |
| const QuatT< T > | operator* (const QuatT< T > &rhs) const |
| Binary LEFT multiply: result is q = rhs quatmultiply this, even though the notation is q = this * rhs ;. More... | |
| Vec3T< T > | operator* (const Vec3T< T > &v) const |
| Rotate a vector by this quaternion. More... | |
| QuatT< T > & | operator*= (T rhs) |
Unary multiply by scalar rhs. More... | |
| QuatT< T > & | operator*= (const QuatT< T > &rhs) |
| Unary LEFT multiply: result is this = rhs quatmultiply this, which makes sense since the notation suggests this = rhs * this ;. More... | |
| const QuatT< T > | operator+ (const QuatT< T > &rhs) const |
| Binary addition. More... | |
| QuatT< T > & | operator+= (const QuatT< T > &rhs) |
| Unary addition. More... | |
| const QuatT< T > | operator- (const QuatT< T > &rhs) const |
| Binary subtraction. More... | |
| const QuatT< T > | operator- () const |
| Negation operator - returns the negative of the quaternion. More... | |
| QuatT< T > & | operator-= (const QuatT< T > &rhs) |
| Unary subtraction. More... | |
| QuatT< T > | operator/ (T rhs) const |
Divide by scalar rhs. More... | |
| const QuatT< T > | operator/ (const QuatT< T > &denom) const |
| Binary divide. More... | |
| QuatT< T > & | operator/= (T rhs) |
Unary divide by scalar rhs. More... | |
| QuatT< T > & | operator/= (const QuatT< T > &denom) |
| Unary divide. More... | |
| QuatT< T > & | operator= (const QuatT< T > &v) |
| Assignment operator. More... | |
| bool | operator== (const QuatT< T > &v) const |
| Test for equality. More... | |
| T & | operator[] (size_t i) |
| T | operator[] (size_t i) const |
| T * | ptr () |
| const T * | ptr () const |
| const QuatT< T > | rightMult (const QuatT< T > &rhs) const |
| Binary RIGHT multiplication: q = p * rhs ; results in q = p quatmultiply rhs ;. More... | |
| void | set (T x, T y, T z, T w) |
| Set the 4 elements of the quaternion as 4 scalars. More... | |
| void | set (const Vec4T< T > &v) |
| Set the four elements of the quaternion as an Vec4. More... | |
| QuatT< T > & | set (const EulerAngles &euler) |
| Set this quaternion with the rotation described by the EulerAngles representation. More... | |
| QuatT< T > & | set (const AffineMatrix4x4T< T > &matrix) |
Set this quaternion with the rotational part of matrix. More... | |
| QuatT< T > & | set (const OrthoMatrix3x3 &matrix) |
| Set this quaternion with the rotation described by a OrthoMatrix3x3. More... | |
| void | setRotate (T angle, T x, T y, T z) |
Set the rotation of the Quaternion as a rotation angle radians around the vector (x, y, z) More... | |
| void | setRotate (T angle, const Vec3T< T > &vec) |
Set the rotation of this Quaternion as a rotation angle radians around the vector vec. More... | |
| void | setRotate (T angle1, const Vec3T< T > &axis1, T angle2, const Vec3T< T > &axis2, T angle3, const Vec3T< T > &axis3) |
| Set the rotation of this Quaternion as a concatenation of the three angle/axis rotations: More... | |
| void | setRotate (const Vec3T< T > &from, const Vec3T< T > &to) |
Make a rotation QuatT<T> which will rotate from to to Generally take a dot product to get the angle between these and then use a cross product to get the rotation axis Watch out for the two special cases when the vectors are co-incident or opposite in direction. More... | |
| void | slerp (T t, const QuatT< T > &from, const QuatT< T > &to) |
| Spherical Linear Interpolation. More... | |
| T & | w () |
| T | w () const |
| T & | x () |
| T | x () const |
| T & | y () |
| T | y () const |
| T & | z () |
| T | z () const |
| bool | zeroRotation () const |
Static Public Member Functions | |
| static QuatT< T > | rotate (T angle, T x, T y, T z) |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector (x, y, z) More... | |
| static QuatT< T > | rotate (T angle, const Vec3T< T > &vec) |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector vec. More... | |
| static QuatT< T > | rotate (T angle1, const Vec3T< T > &axis1, T angle2, const Vec3T< T > &axis2, T angle3, const Vec3T< T > &axis3) |
| Static method which constructs and returns a Quaternion from a rotation given as a concatenation of the three angle/axis rotations: More... | |
| static QuatT< T > | rotate (const Vec3T< T > &from, const Vec3T< T > &to) |
Static method which constructs and returns a Quaternion from rotating vector from to vector to. More... | |
Protected Attributes | |
| T | m_data [4] |
The object holding quaternions and providing operations on these.
The quaternion class holds a representation of quaternion objects and provides simple arithmetic as well as conversion utilities. In addition, the class can compute the 3x4 matrices for converting angular velocities to quaternion velocities and vice versa. The class can also convert from and to a 3x3 orthonormal matrix.
The convention adopted for quaternions is that they map a moving frame to the fixed global reference.
Definition at line 56 of file QuatTemplate.h.
| typedef T agx::QuatT< T >::Type |
Definition at line 60 of file QuatTemplate.h.
| agx::QuatT< T >::QuatT | ( | ) |
Default constructor. Create a Quaternion with an identity rotation.
Definition at line 408 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::conj(), agx::QuatT< Real >::operator*(), agx::QuatT< Real >::operator+(), agx::QuatT< Real >::operator-(), and agx::QuatT< Real >::operator/().
| agx::QuatT< T >::QuatT | ( | T | x, |
| T | y, | ||
| T | z, | ||
| T | w | ||
| ) |
Create a Quaternion with the specified scalar values.
Definition at line 417 of file QuatTemplate.h.
|
explicit |
Create a Quaternion based on the 4D vector (x,y,z,w)
Definition at line 426 of file QuatTemplate.h.
| agx::QuatT< T >::QuatT | ( | T | angle, |
| const Vec3T< T > & | axis | ||
| ) |
Create a Quaternion calculated from a rotation of angle radians around the rotation axis axis.
Definition at line 435 of file QuatTemplate.h.
| agx::QuatT< T >::QuatT | ( | T | angle1, |
| const Vec3T< T > & | axis1, | ||
| T | angle2, | ||
| const Vec3T< T > & | axis2, | ||
| T | angle3, | ||
| const Vec3T< T > & | axis3 | ||
| ) |
Create a Quaternion based on the concatenation between the three specified angle and axis.
Definition at line 441 of file QuatTemplate.h.
| agx::QuatT< T >::QuatT | ( | const Vec3T< T > & | from, |
| const Vec3T< T > & | to | ||
| ) |
Create a Quaternion which maps the rotation from vector from to the vector to.
Definition at line 449 of file QuatTemplate.h.
|
explicit |
Create a Quaternion based on the rotation from euler specified as a EulerAngle.
|
default |
Copy constructor.
|
explicit |
Copy constructor for other types.
Definition at line 457 of file QuatTemplate.h.
|
explicit |
Create a Quaternion based on the rotation part in the specified Affine 4x4 transformation matrix.
Definition at line 466 of file QuatTemplate.h.
| Vec3T< T > agx::QuatT< T >::asVec3 | ( | ) | const |
Definition at line 501 of file QuatTemplate.h.
| Vec4T< T > agx::QuatT< T >::asVec4 | ( | ) | const |
Definition at line 495 of file QuatTemplate.h.
| QuatT< T > agx::QuatT< T >::conj | ( | ) | const |
Definition at line 730 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::inverse().
| void agx::QuatT< T >::get | ( | EulerAngles & | euler | ) | const |
Convert this quaternion to an EulerAngles representation.
param euler - reference to where the result will be written.
| void agx::QuatT< T >::get | ( | AffineMatrix4x4T< T > & | matrix | ) | const |
Set the Rotational part of matrix from this quaternion.
| matrix | - reference to the matrix where the result will be written. |
| void agx::QuatT< T >::get | ( | OrthoMatrix3x3 & | matrix | ) | const |
Set an OrthoMatrix3x3 to represent the same rotation as the quaternion.
| matrix | - reference to the matrix where the result will be written. |
| void agx::QuatT< T >::get | ( | T & | angle, |
| agx::Vec3T< T > & | axis | ||
| ) | const |
Convert a Quaternion to an axis and angle representation.
| axis | - reference to which the axis will be written |
| angle | - reference to the real value where the angle will be written |
| agx::Real agx::QuatT< T >::getAngle | ( | ) | const |
Get the rotation angle represented by the quaternion.
| Vec3T<T> agx::QuatT< T >::getAsEulerAngles | ( | agx::EulerConvention::Convention | convention = agx::EulerConvention::Convention::DEFAULT_CONVENTION | ) | const |
Convert to Euler anglers.
and retrieve as a Vec3 with the angles stored.
| convention | - The specified convention for EulerAngles |
| void agx::QuatT< T >::getRotate | ( | T & | angle, |
| T & | x, | ||
| T & | y, | ||
| T & | z | ||
| ) | const |
Get the angle and vector components represented by the quaternion.
Referenced by agx::RigidBody::getCmRotation(), agx::RigidBody::getRotation(), and agxCollide::Geometry::getRotation().
| void agx::QuatT< T >::getRotate | ( | T & | angle, |
| Vec3T< T > & | vec | ||
| ) | const |
Get the angle and vector represented by the quaternion.
| agx::Vec3T<T> agx::QuatT< T >::getUnitVector | ( | ) | const |
Get the rotation unit vector represented by the quaternion.
| QuatT< T > agx::QuatT< T >::inverse | ( | ) | const |
Multiplicative inverse method: q^(-1) = q^*/(q.q^*)
Definition at line 736 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::operator/(), and agx::QuatT< Real >::operator/=().
| const QuatT< T > agx::QuatT< T >::leftMult | ( | const QuatT< T > & | rhs | ) | const |
Binary left multiplication: q = p * rhs; results in the OTHER WAY AROUND: q = rhs quatmultiply p;.
Definition at line 634 of file QuatTemplate.h.
| T agx::QuatT< T >::length | ( | ) | const |
Definition at line 718 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::normalize().
| T agx::QuatT< T >::length2 | ( | ) | const |
Definition at line 724 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::inverse().
| T agx::QuatT< T >::normalize | ( | ) |
Normalize the quat so that it has unit length.
Returns the previous length of the quat.
Definition at line 789 of file QuatTemplate.h.
| bool agx::QuatT< T >::operator!= | ( | const QuatT< T > & | v | ) | const |
v is not identical to this quaternion Definition at line 489 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator* | ( | T | rhs | ) | const |
Multiply by scalar rhs.
Definition at line 594 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator* | ( | const QuatT< T > & | rhs | ) | const |
Binary LEFT multiply: result is q = rhs quatmultiply this, even though the notation is q = this * rhs ;.
Definition at line 610 of file QuatTemplate.h.
|
inline |
Rotate a vector by this quaternion.
Definition at line 776 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator*= | ( | T | rhs | ) |
Unary multiply by scalar rhs.
Definition at line 600 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator*= | ( | const QuatT< T > & | rhs | ) |
Unary LEFT multiply: result is this = rhs quatmultiply this, which makes sense since the notation suggests this = rhs * this ;.
Definition at line 619 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator+ | ( | const QuatT< T > & | rhs | ) | const |
Binary addition.
Definition at line 678 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator+= | ( | const QuatT< T > & | rhs | ) |
Unary addition.
Definition at line 685 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator- | ( | const QuatT< T > & | rhs | ) | const |
Binary subtraction.
Definition at line 695 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator- | ( | ) | const |
Negation operator - returns the negative of the quaternion.
Basically just calls operator - () on the Vec4
Definition at line 712 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator-= | ( | const QuatT< T > & | rhs | ) |
Unary subtraction.
Definition at line 702 of file QuatTemplate.h.
| QuatT< T > agx::QuatT< T >::operator/ | ( | T | rhs | ) | const |
Divide by scalar rhs.
Definition at line 647 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator/ | ( | const QuatT< T > & | denom | ) | const |
Binary divide.
Definition at line 665 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator/= | ( | T | rhs | ) |
Unary divide by scalar rhs.
Definition at line 654 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator/= | ( | const QuatT< T > & | denom | ) |
Unary divide.
Definition at line 671 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator= | ( | const QuatT< T > & | v | ) |
Assignment operator.
Definition at line 473 of file QuatTemplate.h.
| bool agx::QuatT< T >::operator== | ( | const QuatT< T > & | v | ) | const |
Test for equality.
v Definition at line 483 of file QuatTemplate.h.
| T & agx::QuatT< T >::operator[] | ( | size_t | i | ) |
Definition at line 525 of file QuatTemplate.h.
| T agx::QuatT< T >::operator[] | ( | size_t | i | ) | const |
Definition at line 532 of file QuatTemplate.h.
| T * agx::QuatT< T >::ptr | ( | ) |
Definition at line 804 of file QuatTemplate.h.
| const T * agx::QuatT< T >::ptr | ( | ) | const |
Definition at line 810 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::rightMult | ( | const QuatT< T > & | rhs | ) | const |
Binary RIGHT multiplication: q = p * rhs ; results in q = p quatmultiply rhs ;.
Definition at line 640 of file QuatTemplate.h.
|
static |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector (x, y, z)
Definition at line 743 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::rotate().
|
static |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector vec.
Definition at line 749 of file QuatTemplate.h.
|
static |
Static method which constructs and returns a Quaternion from a rotation given as a concatenation of the three angle/axis rotations:
this = q1*q2*q3
Definition at line 757 of file QuatTemplate.h.
|
static |
Static method which constructs and returns a Quaternion from rotating vector from to vector to.
Definition at line 767 of file QuatTemplate.h.
| void agx::QuatT< T >::set | ( | T | x, |
| T | y, | ||
| T | z, | ||
| T | w | ||
| ) |
Set the 4 elements of the quaternion as 4 scalars.
Definition at line 507 of file QuatTemplate.h.
| void agx::QuatT< T >::set | ( | const Vec4T< T > & | v | ) |
Set the four elements of the quaternion as an Vec4.
Definition at line 516 of file QuatTemplate.h.
| QuatT<T>& agx::QuatT< T >::set | ( | const EulerAngles & | euler | ) |
Set this quaternion with the rotation described by the EulerAngles representation.
| QuatT<T>& agx::QuatT< T >::set | ( | const AffineMatrix4x4T< T > & | matrix | ) |
Set this quaternion with the rotational part of matrix.
| QuatT<T>& agx::QuatT< T >::set | ( | const OrthoMatrix3x3 & | matrix | ) |
Set this quaternion with the rotation described by a OrthoMatrix3x3.
| void agx::QuatT< T >::setRotate | ( | T | angle, |
| T | x, | ||
| T | y, | ||
| T | z | ||
| ) |
Set the rotation of the Quaternion as a rotation angle radians around the vector (x, y, z)
Referenced by agx::QuatT< Real >::QuatT(), agx::QuatT< Real >::rotate(), agx::Matrix4x4T< T >::setRotate(), and agx::AffineMatrix4x4T< Real >::setRotate().
| void agx::QuatT< T >::setRotate | ( | T | angle, |
| const Vec3T< T > & | vec | ||
| ) |
Set the rotation of this Quaternion as a rotation angle radians around the vector vec.
| void agx::QuatT< T >::setRotate | ( | T | angle1, |
| const Vec3T< T > & | axis1, | ||
| T | angle2, | ||
| const Vec3T< T > & | axis2, | ||
| T | angle3, | ||
| const Vec3T< T > & | axis3 | ||
| ) |
Set the rotation of this Quaternion as a concatenation of the three angle/axis rotations:
this = q1*q2*q3
| void agx::QuatT< T >::setRotate | ( | const Vec3T< T > & | from, |
| const Vec3T< T > & | to | ||
| ) |
Make a rotation QuatT<T> which will rotate from to to Generally take a dot product to get the angle between these and then use a cross product to get the rotation axis Watch out for the two special cases when the vectors are co-incident or opposite in direction.
| void agx::QuatT< T >::slerp | ( | T | t, |
| const QuatT< T > & | from, | ||
| const QuatT< T > & | to | ||
| ) |
Spherical Linear Interpolation.
As t goes from 0 to 1, the QuatT<T> object goes from from to to.
| T & agx::QuatT< T >::w | ( | ) |
Definition at line 557 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::QuatT(), and agx::QuatT< Real >::set().
| T agx::QuatT< T >::w | ( | ) | const |
Definition at line 581 of file QuatTemplate.h.
| T & agx::QuatT< T >::x | ( | ) |
Definition at line 539 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::operator*=(), agx::QuatT< Real >::QuatT(), and agx::QuatT< Real >::set().
| T agx::QuatT< T >::x | ( | ) | const |
Definition at line 563 of file QuatTemplate.h.
| T & agx::QuatT< T >::y | ( | ) |
Definition at line 545 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::operator*=(), agx::QuatT< Real >::QuatT(), and agx::QuatT< Real >::set().
| T agx::QuatT< T >::y | ( | ) | const |
Definition at line 569 of file QuatTemplate.h.
| T & agx::QuatT< T >::z | ( | ) |
Definition at line 551 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::operator*=(), agx::QuatT< Real >::QuatT(), and agx::QuatT< Real >::set().
| T agx::QuatT< T >::z | ( | ) | const |
Definition at line 575 of file QuatTemplate.h.
|
inline |
Definition at line 587 of file QuatTemplate.h.
|
protected |
Definition at line 402 of file QuatTemplate.h.
Referenced by agx::QuatT< Real >::asVec3(), agx::QuatT< Real >::asVec4(), agx::QuatT< Real >::conj(), agx::QuatT< Real >::length(), agx::QuatT< Real >::length2(), agx::QuatT< Real >::normalize(), agx::QuatT< Real >::operator!=(), agx::QuatT< Real >::operator*(), agx::QuatT< Real >::operator*=(), agx::QuatT< Real >::operator+(), agx::QuatT< Real >::operator+=(), agx::QuatT< Real >::operator-(), agx::QuatT< Real >::operator-=(), agx::QuatT< Real >::operator/(), agx::QuatT< Real >::operator/=(), agx::QuatT< Real >::operator=(), agx::QuatT< Real >::operator==(), agx::QuatT< Real >::operator[](), agx::QuatT< Real >::ptr(), agx::QuatT< Real >::QuatT(), agx::QuatT< Real >::set(), agx::QuatT< Real >::w(), agx::QuatT< Real >::x(), agx::QuatT< Real >::y(), agx::QuatT< Real >::z(), and agx::QuatT< Real >::zeroRotation().