|
Momentum Scripting v1
|
#include <Quat.h>
Public Member Functions | |
| Quat () | |
| Quat (const AffineMatrix4x4 &matrix) | |
| Quat (const EulerAngles &euler) | |
| Quat (const Quat ©) | |
| Quat (const Vec3 &from, const Vec3 &to) | |
| Quat (const Vec4 &v) | |
| Quat (double angle, const Vec3 &axis) | |
| Quat (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3) | |
| Quat (double x, double y, double z, double w) | |
| Vec3 | asVec3 () const |
| Vec4 | asVec4 () const |
| Quat | conj () const |
| AffineMatrix4x4 | get (const AffineMatrix4x4 &matrix) const |
| std::pair< double, Vec3 > | getAsAngleAndVector () const |
| Vec3 | getAsEulerAngles (EulerConvention::Convention convention=EulerConvention::Convention::DEFAULT_CONVENTION) const |
| std::pair< double, Vec3 > | getRotate () const |
| Quat | inverse () const |
| const Quat | leftMult (const Quat &rhs) const |
| double | length () const |
| double | length2 () const |
| double | normalize () |
| bool | operator!= (const Quat &v) const |
| const Quat | operator* (const Quat &rhs) const |
| Vec3 | operator* (const Vec3 &v) const |
| const Quat | operator* (double rhs) const |
| Quat | operator*= (const Quat &rhs) |
| Quat | operator*= (double rhs) |
| const Quat | operator+ (const Quat &rhs) const |
| Quat | operator+= (const Quat &rhs) |
| const Quat | operator- () const |
| const Quat | operator- (const Quat &rhs) const |
| Quat | operator-= (const Quat &rhs) |
| const Quat | operator/ (const Quat &denom) const |
| Quat | operator/ (double rhs) const |
| Quat | operator/= (const Quat &denom) |
| Quat | operator/= (double rhs) |
| Quat | operator= (const Quat &v) |
| bool | operator== (const Quat &v) const |
| double & | operator[] (int i) |
| double | operator[] (int i) const |
| const Quat | rightMult (const Quat &rhs) const |
| Quat | set (const AffineMatrix4x4 &matrix) |
| Quat | set (const EulerAngles &euler) |
| void | set (const Vec4 &v) |
| void | set (double x, double y, double z, double w) |
| void | setRotate (const Vec3 &from, const Vec3 &to) |
| void | setRotate (double angle, const Vec3 &vec) |
| void | setRotate (double angle, double x, double y, double z) |
| void | setRotate (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3) |
| double | setW (double val) |
| double | setX (double val) |
| double | setY (double val) |
| double | setZ (double val) |
| void | slerp (double t, const Quat &from, const Quat &to) |
| double | w () const |
| double | x () const |
| double | y () const |
| double | z () const |
| bool | zeroRotation () const |
Static Public Member Functions | |
| static Quat | rotate (const Vec3 &from, const Vec3 &to) |
| static Quat | rotate (double angle, const Vec3 &vec) |
| static Quat | rotate (double angle, double x, double y, double z) |
| static Quat | rotate (double angle1, const Vec3 &axis1, double angle2, const Vec3 &axis2, double angle3, const Vec3 &axis3) |
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 convention adopted for quaternions is that they map a moving frame to the fixed global reference.
| MOMENTUM_NAMESPACE::Quat::Quat | ( | ) |
Default constructor. Create a Quaternion with an identity rotation.
| MOMENTUM_NAMESPACE::Quat::Quat | ( | double | x, |
| double | y, | ||
| double | z, | ||
| double | w | ||
| ) |
Create a Quaternion with the specified scalar values.
|
explicit |
Create a Quaternion based on the 4D vector (x,y,z,w)
| MOMENTUM_NAMESPACE::Quat::Quat | ( | double | angle, |
| const Vec3 & | axis | ||
| ) |
Create a Quaternion calculated from a rotation of angle radians around the rotation axis axis.
| MOMENTUM_NAMESPACE::Quat::Quat | ( | double | angle1, |
| const Vec3 & | axis1, | ||
| double | angle2, | ||
| const Vec3 & | axis2, | ||
| double | angle3, | ||
| const Vec3 & | axis3 | ||
| ) |
Create a Quaternion based on the concatenation between the three specified angle and axis.
Create a Quaternion which maps the rotation from vector from to the vector to.
|
explicit |
Create a Quaternion based on the rotation from euler specified as a EulerAngle.
| MOMENTUM_NAMESPACE::Quat::Quat | ( | const Quat & | copy | ) |
Copy constructor.
|
explicit |
Create a Quaternion based on the rotation part in the specified Affine 4x4 transformation matrix.
| Quat MOMENTUM_NAMESPACE::Quat::conj | ( | ) | const |
| AffineMatrix4x4 MOMENTUM_NAMESPACE::Quat::get | ( | const AffineMatrix4x4 & | matrix | ) | const |
Set the Rotational part of matrix from this quaternion.
| matrix | - reference to the matrix where the result will be written. |
| std::pair< double, Vec3 > MOMENTUM_NAMESPACE::Quat::getAsAngleAndVector | ( | ) | const |
Convert a Quaternion to an axis and angle representation.
| Vec3 MOMENTUM_NAMESPACE::Quat::getAsEulerAngles | ( | EulerConvention::Convention | convention = EulerConvention::Convention::DEFAULT_CONVENTION | ) | const |
Convert to Euler anglers.
and retrieve as a Vec3 with the angles stored.
| convention | - The specified convention for EulerAngles |
| std::pair< double, Vec3 > MOMENTUM_NAMESPACE::Quat::getRotate | ( | ) | const |
Get the angle and vector represented by the quaternion.
| Quat MOMENTUM_NAMESPACE::Quat::inverse | ( | ) | const |
Multiplicative inverse method: q^(-1) = q^*/(q.q^*)
Binary left multiplication: q = p * rhs; results in the OTHER WAY AROUND: q = rhs quatmultiply p;.
| double MOMENTUM_NAMESPACE::Quat::length | ( | ) | const |
| double MOMENTUM_NAMESPACE::Quat::length2 | ( | ) | const |
| double MOMENTUM_NAMESPACE::Quat::normalize | ( | ) |
Normalize the quat so that it has unit length.
Returns the previous length of the quat.
| bool MOMENTUM_NAMESPACE::Quat::operator!= | ( | const Quat & | v | ) | const |
v is not identical to this quaternion Binary LEFT multiply: result is q = rhs quatmultiply this, even though the notation is q = this * rhs ;.
Rotate a vector by this quaternion.
| const Quat MOMENTUM_NAMESPACE::Quat::operator* | ( | double | rhs | ) | const |
Multiply by scalar rhs.
Unary LEFT multiply: result is this = rhs quatmultiply this, which makes sense since the notation suggests this = rhs * this ;.
| Quat MOMENTUM_NAMESPACE::Quat::operator*= | ( | double | rhs | ) |
Unary multiply by scalar rhs.
| const Quat MOMENTUM_NAMESPACE::Quat::operator- | ( | ) | const |
Negation operator - returns the negative of the quaternion.
Basically just calls operator - () on the Vec4
| Quat MOMENTUM_NAMESPACE::Quat::operator/ | ( | double | rhs | ) | const |
Divide by scalar rhs.
| Quat MOMENTUM_NAMESPACE::Quat::operator/= | ( | double | rhs | ) |
Unary divide by scalar rhs.
| bool MOMENTUM_NAMESPACE::Quat::operator== | ( | const Quat & | v | ) | const |
Test for equality.
v | double & MOMENTUM_NAMESPACE::Quat::operator[] | ( | int | i | ) |
| double MOMENTUM_NAMESPACE::Quat::operator[] | ( | int | i | ) | const |
Binary RIGHT multiplication: q = p * rhs ; results in q = p quatmultiply rhs ;.
Static method which constructs and returns a Quaternion from rotating vector from to vector to.
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector vec.
|
static |
Static method which constructs and returns a Quaternion from a rotation given as angle radians around the vector (x, y, z)
|
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
| Quat MOMENTUM_NAMESPACE::Quat::set | ( | const AffineMatrix4x4 & | matrix | ) |
Set this quaternion with the rotational part of matrix.
| Quat MOMENTUM_NAMESPACE::Quat::set | ( | const EulerAngles & | euler | ) |
Set this quaternion with the rotation described by the EulerAngles representation.
| void MOMENTUM_NAMESPACE::Quat::set | ( | const Vec4 & | v | ) |
Set the four elements of the quaternion as an Vec4.
| void MOMENTUM_NAMESPACE::Quat::set | ( | double | x, |
| double | y, | ||
| double | z, | ||
| double | w | ||
| ) |
Set the 4 elements of the quaternion as 4 scalars.
Make a rotation Quat 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 MOMENTUM_NAMESPACE::Quat::setRotate | ( | double | angle, |
| const Vec3 & | vec | ||
| ) |
Set the rotation of this Quaternion as a rotation angle radians around the vector vec.
| void MOMENTUM_NAMESPACE::Quat::setRotate | ( | double | angle, |
| double | x, | ||
| double | y, | ||
| double | z | ||
| ) |
Set the rotation of the Quaternion as a rotation angle radians around the vector (x, y, z)
| void MOMENTUM_NAMESPACE::Quat::setRotate | ( | double | angle1, |
| const Vec3 & | axis1, | ||
| double | angle2, | ||
| const Vec3 & | axis2, | ||
| double | angle3, | ||
| const Vec3 & | axis3 | ||
| ) |
Set the rotation of this Quaternion as a concatenation of the three angle/axis rotations:
this = q1*q2*q3
| double MOMENTUM_NAMESPACE::Quat::setW | ( | double | val | ) |
| double MOMENTUM_NAMESPACE::Quat::setX | ( | double | val | ) |
| double MOMENTUM_NAMESPACE::Quat::setY | ( | double | val | ) |
| double MOMENTUM_NAMESPACE::Quat::setZ | ( | double | val | ) |
Spherical Linear Interpolation.
As t goes from 0 to 1, the Quat object goes from from to to.
| double MOMENTUM_NAMESPACE::Quat::w | ( | ) | const |
| double MOMENTUM_NAMESPACE::Quat::x | ( | ) | const |
| double MOMENTUM_NAMESPACE::Quat::y | ( | ) | const |
| double MOMENTUM_NAMESPACE::Quat::z | ( | ) | const |
| bool MOMENTUM_NAMESPACE::Quat::zeroRotation | ( | ) | const |