|
AGX Dynamics
2.35.0.1
|
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 (const AffineMatrix4x4T< T > &matrix) | |
| Create a Quaternion based on the rotation part in the specified Affine 4x4 transformation matrix. 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 Vec3T< T > &from, const Vec3T< T > &to) | |
Create a Quaternion which maps the rotation from vector from to the vector to. 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 (T x, T y, T z, T w) | |
| Create a Quaternion with the specified scalar values. More... | |
| Vec3T< T > | asVec3 () const |
| Vec4T< T > | asVec4 () const |
| T | at (size_t i) |
| QuatT< T > | conj () const |
| void | get (AffineMatrix4x4T< T > &matrix) const |
Set the Rotational part of matrix from this quaternion. More... | |
| void | get (EulerAngles &euler) const |
| Convert this quaternion to an EulerAngles representation. 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* (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... | |
| const QuatT< T > | operator* (T rhs) const |
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... | |
| QuatT< T > & | operator*= (T rhs) |
Unary multiply by scalar rhs. 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 |
| Negation operator - returns the negative of the quaternion. More... | |
| const QuatT< T > | operator- (const QuatT< T > &rhs) const |
| Binary subtraction. More... | |
| QuatT< T > & | operator-= (const QuatT< T > &rhs) |
| Unary subtraction. More... | |
| const QuatT< T > | operator/ (const QuatT< T > &denom) const |
| Binary divide. More... | |
| QuatT< T > | operator/ (T rhs) const |
Divide by scalar rhs. More... | |
| QuatT< T > & | operator/= (const QuatT< T > &denom) |
| Unary divide. More... | |
| QuatT< T > & | operator/= (T rhs) |
Unary divide by scalar rhs. 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... | |
| QuatT< T > & | set (const AffineMatrix4x4T< T > &matrix) |
Set this quaternion with the rotational part of matrix. More... | |
| QuatT< T > & | set (const EulerAngles &euler) |
| Set this quaternion with the rotation described by the EulerAngles representation. More... | |
| QuatT< T > & | set (const OrthoMatrix3x3 &matrix) |
| Set this quaternion with the rotation described by a OrthoMatrix3x3. More... | |
| void | set (const Vec4T< T > &v) |
| Set the four elements of the quaternion as an Vec4. More... | |
| void | set (T val, size_t i) |
| Set the value of element i. Mainly for accessing QuatT<T> in Lua. More... | |
| void | set (T x, T y, T z, T w) |
| Set the 4 elements of the quaternion as 4 scalars. 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 | 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 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 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 | 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 (const Vec3T< T > &from, const Vec3T< T > &to) |
Static method which constructs and returns a Quaternion from rotating vector from to vector to. 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 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 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... | |
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 415 of file QuatTemplate.h.
| agx::QuatT< T >::QuatT | ( | T | x, |
| T | y, | ||
| T | z, | ||
| T | w | ||
| ) |
Create a Quaternion with the specified scalar values.
Definition at line 424 of file QuatTemplate.h.
|
explicit |
Create a Quaternion based on the 4D vector (x,y,z,w)
Definition at line 433 of file QuatTemplate.h.
References agx::Vec4T< T >::w(), agx::Vec4T< T >::x(), agx::Vec4T< T >::y(), and agx::Vec4T< T >::z().
| 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 442 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 448 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 456 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 464 of file QuatTemplate.h.
|
explicit |
Create a Quaternion based on the rotation part in the specified Affine 4x4 transformation matrix.
Definition at line 473 of file QuatTemplate.h.
| Vec3T< T > agx::QuatT< T >::asVec3 |
Definition at line 508 of file QuatTemplate.h.
| Vec4T< T > agx::QuatT< T >::asVec4 |
Definition at line 502 of file QuatTemplate.h.
| T agx::QuatT< T >::at | ( | size_t | i | ) |
Definition at line 811 of file QuatTemplate.h.
| QuatT< T > agx::QuatT< T >::conj |
Definition at line 737 of file QuatTemplate.h.
| 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 | ( | 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 | ( | 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 |
Multiplicative inverse method: q^(-1) = q^*/(q.q^*)
Definition at line 743 of file QuatTemplate.h.
Referenced by agx::QuatT< T >::operator/(), and agx::QuatT< T >::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 641 of file QuatTemplate.h.
| T agx::QuatT< T >::length |
Definition at line 725 of file QuatTemplate.h.
| T agx::QuatT< T >::length2 |
Definition at line 731 of file QuatTemplate.h.
| T agx::QuatT< T >::normalize |
Normalize the quat so that it has unit length.
Returns the previous length of the quat.
Definition at line 796 of file QuatTemplate.h.
| bool agx::QuatT< T >::operator!= | ( | const QuatT< T > & | v | ) | const |
v is not identical to this quaternion Definition at line 496 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| 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 617 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
|
inline |
Rotate a vector by this quaternion.
Definition at line 783 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator* | ( | T | rhs | ) | const |
Multiply by scalar rhs.
Definition at line 601 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 626 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| QuatT< T > & agx::QuatT< T >::operator*= | ( | T | rhs | ) |
Unary multiply by scalar rhs.
Definition at line 607 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator+ | ( | const QuatT< T > & | rhs | ) | const |
| QuatT< T > & agx::QuatT< T >::operator+= | ( | const QuatT< T > & | rhs | ) |
| const QuatT< T > agx::QuatT< T >::operator- |
Negation operator - returns the negative of the quaternion.
Basically just calls operator - () on the Vec4
Definition at line 719 of file QuatTemplate.h.
| const QuatT< T > agx::QuatT< T >::operator- | ( | const QuatT< T > & | rhs | ) | const |
Binary subtraction.
Definition at line 702 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| QuatT< T > & agx::QuatT< T >::operator-= | ( | const QuatT< T > & | rhs | ) |
Unary subtraction.
Definition at line 709 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| const QuatT< T > agx::QuatT< T >::operator/ | ( | const QuatT< T > & | denom | ) | const |
Binary divide.
Definition at line 672 of file QuatTemplate.h.
References agx::QuatT< T >::inverse().
| QuatT< T > agx::QuatT< T >::operator/ | ( | T | rhs | ) | const |
Divide by scalar rhs.
Definition at line 654 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator/= | ( | const QuatT< T > & | denom | ) |
| QuatT< T > & agx::QuatT< T >::operator/= | ( | T | rhs | ) |
Unary divide by scalar rhs.
Definition at line 661 of file QuatTemplate.h.
| QuatT< T > & agx::QuatT< T >::operator= | ( | const QuatT< T > & | v | ) |
Assignment operator.
Definition at line 480 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| bool agx::QuatT< T >::operator== | ( | const QuatT< T > & | v | ) | const |
Test for equality.
v Definition at line 490 of file QuatTemplate.h.
References agx::QuatT< T >::m_data.
| T & agx::QuatT< T >::operator[] | ( | size_t | i | ) |
Definition at line 532 of file QuatTemplate.h.
References agxAssert.
| T agx::QuatT< T >::operator[] | ( | size_t | i | ) | const |
Definition at line 539 of file QuatTemplate.h.
References agxAssert.
| T * agx::QuatT< T >::ptr |
Definition at line 823 of file QuatTemplate.h.
| const T * agx::QuatT< T >::ptr |
Definition at line 829 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 647 of file QuatTemplate.h.
|
static |
Static method which constructs and returns a Quaternion from rotating vector from to vector to.
Definition at line 774 of file QuatTemplate.h.
References agx::QuatT< T >::setRotate().
|
static |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector vec.
Definition at line 756 of file QuatTemplate.h.
References agx::QuatT< T >::setRotate().
|
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 750 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 764 of file QuatTemplate.h.
References agx::QuatT< T >::setRotate().
| 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 EulerAngles & | euler | ) |
Set this quaternion with the rotation described by the EulerAngles representation.
| QuatT<T>& agx::QuatT< T >::set | ( | const OrthoMatrix3x3 & | matrix | ) |
Set this quaternion with the rotation described by a OrthoMatrix3x3.
| void agx::QuatT< T >::set | ( | const Vec4T< T > & | v | ) |
Set the four elements of the quaternion as an Vec4.
Definition at line 523 of file QuatTemplate.h.
References agx::Vec4T< T >::w(), agx::Vec4T< T >::x(), agx::Vec4T< T >::y(), and agx::Vec4T< T >::z().
| void agx::QuatT< T >::set | ( | T | val, |
| size_t | i | ||
| ) |
Set the value of element i. Mainly for accessing QuatT<T> in Lua.
Definition at line 817 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 514 of file QuatTemplate.h.
| 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 >::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 | 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< T >::rotate(), agx::AffineMatrix4x4T< T >::setRotate(), and agx::Matrix4x4T< T >::setRotate().
| 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 >::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 564 of file QuatTemplate.h.
| T agx::QuatT< T >::w |
Definition at line 588 of file QuatTemplate.h.
| T & agx::QuatT< T >::x |
Definition at line 546 of file QuatTemplate.h.
| T agx::QuatT< T >::x |
Definition at line 570 of file QuatTemplate.h.
| T & agx::QuatT< T >::y |
Definition at line 552 of file QuatTemplate.h.
| T agx::QuatT< T >::y |
Definition at line 576 of file QuatTemplate.h.
| T & agx::QuatT< T >::z |
Definition at line 558 of file QuatTemplate.h.
| T agx::QuatT< T >::z |
Definition at line 582 of file QuatTemplate.h.
|
inline |
Definition at line 594 of file QuatTemplate.h.
|
protected |
Definition at line 409 of file QuatTemplate.h.
Referenced by agx::QuatT< T >::operator!=(), agx::QuatT< T >::operator*(), agx::QuatT< T >::operator*=(), agx::QuatT< T >::operator+(), agx::QuatT< T >::operator+=(), agx::QuatT< T >::operator-(), agx::QuatT< T >::operator-=(), agx::QuatT< T >::operator=(), and agx::QuatT< T >::operator==().