|
TrueReality
v0.1.1912
|
Represents a quaternion, that is used for angular calculations and transformations. More...
#include <Quat.h>
Public Types | |
| using | value_type = double |
Public Member Functions | |
| Quat () | |
| Default constructor. More... | |
| Quat (const Quat &q) | |
| Copy constructor. More... | |
| Quat (const osg::Quat &q) | |
| Constructor. More... | |
| Quat (value_type x, value_type y, value_type z, value_type w) | |
| Constructor. More... | |
| Quat (const Vec4f &v) | |
| Constructor. More... | |
| Quat (const Vec4d &v) | |
| Constructor. More... | |
| Quat (value_type angle, const Vec3f &axis) | |
| Constructor. More... | |
| Quat (value_type angle, const Vec3d &axis) | |
| Constructor. More... | |
| Quat (value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3) | |
| Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together. More... | |
| Quat (value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3) | |
| Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together. More... | |
| osg::Quat & | GetOSGQuat () |
| Returns a reference to the internal OSG Quat. More... | |
| const osg::Quat & | GetOSGQuat () const |
| Returns a reference to the internal OSG Quat. More... | |
| Vec4d | AsVec4 () const |
| Converts this object to a vector 4. More... | |
| Vec3d | AsVec3 () const |
| Converts this object to a vector 3. More... | |
| void | Set (const Quat &q) |
| Sets the given q. More... | |
| void | Set (const osg::Quat &q) |
| Sets the given q. More... | |
| void | Set (value_type x, value_type y, value_type z, value_type w) |
| Sets. More... | |
| void | Set (const Vec4f &v) |
| Sets the given v. More... | |
| void | Set (const Vec4d &v) |
| Sets the given v. More... | |
| void | Set (const Matrixf &matrix) |
| Sets the quaternion from the given matrix. More... | |
| void | Set (const Matrixd &matrix) |
| Sets the quaternion from the given matrix. More... | |
| void | Get (Matrixf &matrix) const |
| Sets the quaternion from the given matrix. More... | |
| void | Get (Matrixd &matrix) const |
| Sets the quaternion from the given matrix. More... | |
| void | Set (const osg::Matrixf &matrix) |
| Sets the given matrix. More... | |
| void | Set (const osg::Matrixd &matrix) |
| Sets the given matrix. More... | |
| void | Get (osg::Matrixf &matrix) const |
| Gets a the values of the internal matrix. More... | |
| void | Get (osg::Matrixd &matrix) const |
| Gets a the values of the internal matrix. More... | |
| bool | IsZeroRotation () const |
| return true if the Quat represents a zero rotation, and therefore can be ignored in computations. More... | |
| value_type | Length () const |
| Length of the quaternion = sqrt( vec . More... | |
| value_type | Length2 () const |
| (Length*Length) of the quaternion = vec . More... | |
| trBase::Quat | Conj () const |
| Conjugate. More... | |
| const trBase::Quat | Inverse () const |
| Multiplicative inverse method: q^(-1) = q^* /(q.q^*) More... | |
| void | MakeRotate (value_type angle, value_type x, value_type y, value_type z) |
| Set a quaternion which will perform a rotation of an angle around the axis given by the vector(x, y, z). More... | |
| void | MakeRotate (value_type angle, const Vec3f &vec) |
| Set a quaternion which will perform a rotation of an angle around the axis given by the vector(x, y, z). More... | |
| void | MakeRotate (value_type angle, const Vec3d &vec) |
| Set a quaternion which will perform a rotation of an angle around the axis given by the vector(x, y, z). More... | |
| void | MakeRotate (value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3) |
| Set a quaternion which will perform a rotation of an angles around three axes given by the vectors(x, y, z). More... | |
| void | MakeRotate (value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3) |
| Set a quaternion which will perform a rotation of an angles around three axes given by the vectors(x, y, z). More... | |
| void | MakeRotate (const Vec3f &vec1, const Vec3f &vec2) |
| Make a rotation Quat which will rotate vec1 to vec2. More... | |
| void | MakeRotate (const Vec3d &vec1, const Vec3d &vec2) |
| Make a rotation Quat which will rotate vec1 to vec2. More... | |
| void | GetRotate (value_type &angle, value_type &x, value_type &y, value_type &z) const |
| Return the angle and vector components represented by the quaternion. More... | |
| void | GetRotate (value_type &angle, Vec3f &vec) const |
| Return the angle and vector represented by the quaternion. More... | |
| void | GetRotate (value_type &angle, Vec3d &vec) const |
| Return the angle and vector represented by the quaternion. More... | |
| void | Clear () |
| Clears this object to its blank/initial state. More... | |
| void | Slerp (value_type t, const Quat &from, const Quat &to) |
| Spherical Linear Interpolation. More... | |
| value_type & | X () |
| Returns the X component of the quaternion/. More... | |
| value_type & | Y () |
| Returns the Y component of the quaternion/. More... | |
| value_type & | Z () |
| Returns the Z component of the quaternion/. More... | |
| value_type & | W () |
| Returns the W component of the quaternion/. More... | |
| value_type | X () const |
| Returns the X component of the quaternion/. More... | |
| value_type | Y () const |
| Returns the Y component of the quaternion/. More... | |
| value_type | Z () const |
| Returns the Z component of the quaternion/. More... | |
| value_type | W () const |
| Returns the W component of the quaternion/. More... | |
| value_type & | operator[] (int i) |
| Index operator. More... | |
| value_type | operator[] (int i) const |
| Index operator. More... | |
| Quat & | operator= (const Quat &v) |
| Set operator. More... | |
| bool | operator== (const Quat &v) const |
| Equals operator. More... | |
| bool | operator!= (const Quat &v) const |
| Not equals operator. More... | |
| bool | operator< (const Quat &v) const |
| Less than operator. More... | |
| bool | operator> (const Quat &v) const |
| Greater than operator. More... | |
| const Quat | operator* (value_type rhs) const |
| Multiply by scalar. More... | |
| Vec3f | operator* (const Vec3f &v) const |
| Rotate a vector by this quaternion. More... | |
| Vec3d | operator* (const Vec3d &v) const |
| Rotate a vector by this quaternion. More... | |
| Quat & | operator*= (value_type rhs) |
| Unary multiply by scalar. More... | |
| const Quat | operator* (const Quat &rhs) const |
| Binary multiply. More... | |
| Quat & | operator*= (const Quat &rhs) |
| Unary multiply. More... | |
| Quat | operator/ (value_type rhs) const |
| Divide by scalar. More... | |
| Quat & | operator/= (value_type rhs) |
| Unary divide by scalar. More... | |
| const Quat | operator/ (const Quat &denom) const |
| Binary divide. More... | |
| Quat & | operator/= (const Quat &denom) |
| Unary divide. More... | |
| const Quat | operator+ (const Quat &rhs) const |
| Binary addition. More... | |
| Quat & | operator+= (const Quat &rhs) |
| Unary addition. More... | |
| const Quat | operator- (const Quat &rhs) const |
| Binary subtraction. More... | |
| Quat & | operator-= (const Quat &rhs) |
| Unary subtraction. More... | |
| const Quat | operator- () const |
| Negation operator - returns the negative of the quaternion. More... | |
| operator osg::Quat () const | |
| Implicit conversion operator to OSG Quaternion. More... | |
| operator osg::Quat & () | |
| Implicit conversion operator to OSG Quaternion. More... | |
| operator const osg::Quat & () const | |
| Implicit conversion operator to OSG Quaternion. More... | |
| operator osg::Quat * () | |
| Implicit conversion operator to OSG Quaternion. More... | |
| std::string | ToString (int precision=-1) |
| Convert this object into a string representation. More... | |
Protected Attributes | |
| osg::Quat | mQuat |
Represents a quaternion, that is used for angular calculations and transformations.
| using trBase::Quat::value_type = double |
| trBase::Quat::Quat | ( | ) |
Default constructor.
Definition at line 29 of file Quat.cpp.
Referenced by Conj(), operator*(), operator+(), operator-(), and operator/().

| trBase::Quat::Quat | ( | const Quat & | q | ) |
| trBase::Quat::Quat | ( | const osg::Quat & | q | ) |
| trBase::Quat::Quat | ( | value_type | x, |
| value_type | y, | ||
| value_type | z, | ||
| value_type | w | ||
| ) |
| trBase::Quat::Quat | ( | const Vec4f & | v | ) |
| trBase::Quat::Quat | ( | const Vec4d & | v | ) |
| trBase::Quat::Quat | ( | value_type | angle, |
| const Vec3f & | axis | ||
| ) |
| trBase::Quat::Quat | ( | value_type | angle, |
| const Vec3d & | axis | ||
| ) |
| trBase::Quat::Quat | ( | value_type | angle1, |
| const Vec3f & | axis1, | ||
| value_type | angle2, | ||
| const Vec3f & | axis2, | ||
| value_type | angle3, | ||
| const Vec3f & | axis3 | ||
| ) |
Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together.
Q = q(angle1, axis1)*q(angle2, axis2)*q(angle3, axis3)
| angle1 | The first angle. |
| axis1 | The first axis. |
| angle2 | The second angle. |
| axis2 | The second axis. |
| angle3 | The third angle. |
| axis3 | The third axis. |
| trBase::Quat::Quat | ( | value_type | angle1, |
| const Vec3d & | axis1, | ||
| value_type | angle2, | ||
| const Vec3d & | axis2, | ||
| value_type | angle3, | ||
| const Vec3d & | axis3 | ||
| ) |
Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together.
Q = q(angle1, axis1)*q(angle2, axis2)*q(angle3, axis3)
| angle1 | The first angle. |
| axis1 | The first axis. |
| angle2 | The second angle. |
| axis2 | The second axis. |
| angle3 | The third angle. |
| axis3 | The third axis. |
| Vec3d trBase::Quat::AsVec3 | ( | ) | const |
| Vec4d trBase::Quat::AsVec4 | ( | ) | const |
| void trBase::Quat::Clear | ( | ) |
| trBase::Quat trBase::Quat::Conj | ( | ) | const |
| void trBase::Quat::Get | ( | Matrixf & | matrix | ) | const |
| void trBase::Quat::Get | ( | Matrixd & | matrix | ) | const |
| void trBase::Quat::Get | ( | osg::Matrixf & | matrix | ) | const |
| void trBase::Quat::Get | ( | osg::Matrixd & | matrix | ) | const |
| osg::Quat & trBase::Quat::GetOSGQuat | ( | ) |
| const osg::Quat & trBase::Quat::GetOSGQuat | ( | ) | const |
| void trBase::Quat::GetRotate | ( | value_type & | angle, |
| value_type & | x, | ||
| value_type & | y, | ||
| value_type & | z | ||
| ) | const |
| void trBase::Quat::GetRotate | ( | value_type & | angle, |
| Vec3f & | vec | ||
| ) | const |
| void trBase::Quat::GetRotate | ( | value_type & | angle, |
| Vec3d & | vec | ||
| ) | const |
| const trBase::Quat trBase::Quat::Inverse | ( | ) | const |
Multiplicative inverse method: q^(-1) = q^* /(q.q^*)
Definition at line 229 of file Quat.cpp.
References Conj(), and Length2().
Referenced by operator/(), and operator/=().


| bool trBase::Quat::IsZeroRotation | ( | ) | const |
| Quat::value_type trBase::Quat::Length | ( | ) | const |
| Quat::value_type trBase::Quat::Length2 | ( | ) | const |
| void trBase::Quat::MakeRotate | ( | value_type | angle, |
| value_type | x, | ||
| value_type | y, | ||
| value_type | z | ||
| ) |
| void trBase::Quat::MakeRotate | ( | value_type | angle, |
| const Vec3f & | vec | ||
| ) |
| void trBase::Quat::MakeRotate | ( | value_type | angle, |
| const Vec3d & | vec | ||
| ) |
| void trBase::Quat::MakeRotate | ( | value_type | angle1, |
| const Vec3f & | axis1, | ||
| value_type | angle2, | ||
| const Vec3f & | axis2, | ||
| value_type | angle3, | ||
| const Vec3f & | axis3 | ||
| ) |
Set a quaternion which will perform a rotation of an angles around three axes given by the vectors(x, y, z).
Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together. Q = q(angle1, axis1)*q(angle2, axis2)*q(angle3, axis3)
| angle1 | The first angle. |
| axis1 | The first axis. |
| angle2 | The second angle. |
| axis2 | The second axis. |
| angle3 | The third angle. |
| axis3 | The third axis. |
Definition at line 253 of file Quat.cpp.
References mQuat.
| void trBase::Quat::MakeRotate | ( | value_type | angle1, |
| const Vec3d & | axis1, | ||
| value_type | angle2, | ||
| const Vec3d & | axis2, | ||
| value_type | angle3, | ||
| const Vec3d & | axis3 | ||
| ) |
Set a quaternion which will perform a rotation of an angles around three axes given by the vectors(x, y, z).
Creates a quaternion after making three individual quaternions, one for each angle and axis, and multiplying them together. Q = q(angle1, axis1)*q(angle2, axis2)*q(angle3, axis3)
| angle1 | The first angle. |
| axis1 | The first axis. |
| angle2 | The second angle. |
| axis2 | The second axis. |
| angle3 | The third angle. |
| axis3 | The third axis. |
Definition at line 259 of file Quat.cpp.
References mQuat.
Make a rotation Quat which will rotate vec1 to vec2.
Watch out for the two special cases when the vectors are co-incident or opposite in direction. This routine uses only fast geometric transforms, without costly acos/sin computations. It's exact, fast, and with less degenerate cases than the acos/sin method.
For an explanation of the math used, you may see for example: http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf
| vec1 | The first vector. |
| vec2 | The second vector. |
Definition at line 265 of file Quat.cpp.
References mQuat.
Make a rotation Quat which will rotate vec1 to vec2.
Watch out for the two special cases when the vectors are co-incident or opposite in direction. This routine uses only fast geometric transforms, without costly acos/sin computations. It's exact, fast, and with less degenerate cases than the acos/sin method.
For an explanation of the math used, you may see for example: http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf
| vec1 | The first vector. |
| vec2 | The second vector. |
Definition at line 271 of file Quat.cpp.
References mQuat.
| trBase::Quat::operator const osg::Quat & | ( | ) | const |
| trBase::Quat::operator osg::Quat | ( | ) | const |
| trBase::Quat::operator osg::Quat & | ( | ) |
| trBase::Quat::operator osg::Quat * | ( | ) |
| bool trBase::Quat::operator!= | ( | const Quat & | v | ) | const |
| const Quat trBase::Quat::operator* | ( | value_type | rhs | ) | const |
| Quat & trBase::Quat::operator*= | ( | value_type | rhs | ) |
| const Quat trBase::Quat::operator- | ( | ) | const |
| Quat trBase::Quat::operator/ | ( | value_type | rhs | ) | const |
| Quat & trBase::Quat::operator/= | ( | value_type | rhs | ) |
| bool trBase::Quat::operator< | ( | const Quat & | v | ) | const |
| bool trBase::Quat::operator== | ( | const Quat & | v | ) | const |
| bool trBase::Quat::operator> | ( | const Quat & | v | ) | const |
| Quat::value_type & trBase::Quat::operator[] | ( | int | i | ) |
| Quat::value_type trBase::Quat::operator[] | ( | int | i | ) | const |
| void trBase::Quat::Set | ( | const Quat & | q | ) |
| void trBase::Quat::Set | ( | const osg::Quat & | q | ) |
| void trBase::Quat::Set | ( | value_type | x, |
| value_type | y, | ||
| value_type | z, | ||
| value_type | w | ||
| ) |
| void trBase::Quat::Set | ( | const Vec4f & | v | ) |
Sets the given v.
| v | The v to set. |
Definition at line 139 of file Quat.cpp.
References mQuat, trBase::Vec4f::W(), trBase::Vec4f::X(), trBase::Vec4f::Y(), and trBase::Vec4f::Z().

| void trBase::Quat::Set | ( | const Vec4d & | v | ) |
Sets the given v.
| v | The v to set. |
Definition at line 148 of file Quat.cpp.
References mQuat, trBase::Vec4d::W(), trBase::Vec4d::X(), trBase::Vec4d::Y(), and trBase::Vec4d::Z().

| void trBase::Quat::Set | ( | const Matrixf & | matrix | ) |
| void trBase::Quat::Set | ( | const Matrixd & | matrix | ) |
| void trBase::Quat::Set | ( | const osg::Matrixf & | matrix | ) |
| void trBase::Quat::Set | ( | const osg::Matrixd & | matrix | ) |
| void trBase::Quat::Slerp | ( | value_type | t, |
| const Quat & | from, | ||
| const Quat & | to | ||
| ) |
| std::string trBase::Quat::ToString | ( | int | precision = -1 | ) |
| Quat::value_type & trBase::Quat::W | ( | ) |
Returns the W component of the quaternion/.
Definition at line 325 of file Quat.cpp.
References mQuat.
Referenced by trBase::operator<<(), and Set().

| Quat::value_type trBase::Quat::W | ( | ) | const |
| Quat::value_type & trBase::Quat::X | ( | ) |
Returns the X component of the quaternion/.
Definition at line 307 of file Quat.cpp.
References mQuat.
Referenced by trBase::operator<<(), and Set().

| Quat::value_type trBase::Quat::X | ( | ) | const |
| Quat::value_type & trBase::Quat::Y | ( | ) |
Returns the Y component of the quaternion/.
Definition at line 313 of file Quat.cpp.
References mQuat.
Referenced by trBase::operator<<(), and Set().

| Quat::value_type trBase::Quat::Y | ( | ) | const |
| Quat::value_type & trBase::Quat::Z | ( | ) |
Returns the Z component of the quaternion/.
Definition at line 319 of file Quat.cpp.
References mQuat.
Referenced by trBase::operator<<(), and Set().

| Quat::value_type trBase::Quat::Z | ( | ) | const |
|
protected |
Definition at line 595 of file Quat.h.
Referenced by AsVec3(), AsVec4(), Clear(), Conj(), Get(), GetOSGQuat(), GetRotate(), IsZeroRotation(), Length(), Length2(), MakeRotate(), operator const osg::Quat &(), operator osg::Quat(), operator osg::Quat &(), operator osg::Quat *(), operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), operator<(), operator=(), operator==(), operator>(), operator[](), Set(), Slerp(), ToString(), W(), X(), Y(), and Z().