This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.
#include <ofQuaternion.h>
Public Member Functions | |
Constructor | |
ofQuaternion () | |
ofQuaternion (float x, float y, float z, float w) | |
ofQuaternion (const ofVec4f &v) | |
ofQuaternion (float angle, const ofVec3f &axis) | |
ofQuaternion (float angle1, const ofVec3f &axis1, float angle2, const ofVec3f &axis2, float angle3, const ofVec3f &axis3) | |
ofQuaternion (const glm::quat &q) | |
operator glm::quat () const | |
Setters | |
void | set (float x, float y, float z, float w) |
void | set (const ofVec4f &v) |
void | set (const ofMatrix4x4 &matrix) |
Getters | |
float & | operator[] (int i) |
float | operator[] (int i) const |
void | get (ofMatrix4x4 &matrix) const |
float & | x () |
float & | y () |
float & | z () |
float & | w () |
float | x () const |
float | y () const |
float | z () const |
float | w () const |
ofVec4f | asVec4 () const |
ofVec3f | asVec3 () const |
Functions | |
bool | zeroRotation () const |
return true if the Quat represents a zero rotation, and therefore can be ignored in computations. | |
float | length () const |
Length of the quaternion = sqrt(vec . vec) | |
float | length2 () const |
Length of the quaternion = vec . vec. | |
ofQuaternion | conj () const |
Conjugate. | |
const ofQuaternion | inverse () const |
Multiplicative inverse method. | |
void | makeRotate (float angle, float x, float y, float z) |
void | makeRotate (float angle, const ofVec3f &vec) |
void | makeRotate (float angle1, const ofVec3f &axis1, float angle2, const ofVec3f &axis2, float angle3, const ofVec3f &axis3) |
void | makeRotate (const ofVec3f &vec1, const ofVec3f &vec2) |
Make a rotation Quat which will rotate vec1 to vec2. 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 | makeRotate_original (const ofVec3f &vec1, const ofVec3f &vec2) |
void | getRotate (float &angle, float &x, float &y, float &z) const |
Return the angle and vector components represented by the quaternion. | |
void | getRotate (float &angle, ofVec3f &vec) const |
ofVec3f | getEuler () const |
Calculate and return the rotation as euler angles. | |
void | slerp (float t, const ofQuaternion &from, const ofQuaternion &to) |
Spherical Linear Interpolation. | |
void | normalize () |
Operators | |
ofQuaternion & | operator= (const ofQuaternion &q) |
bool | operator== (const ofQuaternion &q) const |
bool | operator!= (const ofQuaternion &q) const |
const ofQuaternion | operator* (float rhs) const |
Multiply by scalar. | |
const ofQuaternion | operator* (const ofQuaternion &rhs) const |
Binary multiply. | |
ofVec3f | operator* (const ofVec3f &v) const |
Rotate a vector by this quaternion. | |
ofQuaternion & | operator*= (float rhs) |
Unary multiply by scalar. | |
ofQuaternion & | operator*= (const ofQuaternion &rhs) |
Unary multiply. | |
ofQuaternion | operator/ (float rhs) const |
Divide by scalar. | |
const ofQuaternion | operator/ (const ofQuaternion &denom) const |
Binary divide. | |
ofQuaternion & | operator/= (float rhs) |
Unary divide by scalar. | |
ofQuaternion & | operator/= (const ofQuaternion &denom) |
Unary divide. | |
const ofQuaternion | operator+ (const ofQuaternion &rhs) const |
Binary addition. | |
ofQuaternion & | operator+= (const ofQuaternion &rhs) |
Unary addition. | |
ofQuaternion & | operator-= (const ofQuaternion &rhs) |
Unary subtraction. | |
const ofQuaternion | operator- (const ofQuaternion &rhs) const |
Binary subtraction. | |
const ofQuaternion | operator- () const |
returns the negative of the quaternion. calls operator -() on the Vec4 | |
std::ostream & | operator<< (std::ostream &os, const ofQuaternion &q) |
std::istream & | operator>> (std::istream &is, ofQuaternion &q) |
Constructor & Destructor Documentation
◆ ofQuaternion() [1/6]
|
inline |
◆ ofQuaternion() [2/6]
|
inline |
◆ ofQuaternion() [3/6]
|
inline |
◆ ofQuaternion() [4/6]
|
inline |
◆ ofQuaternion() [5/6]
|
inline |
◆ ofQuaternion() [6/6]
ofQuaternion::ofQuaternion | ( | const glm::quat & | q | ) |
Member Function Documentation
◆ asVec3()
|
inline |
◆ asVec4()
|
inline |
◆ conj()
|
inline |
Conjugate.
◆ get()
void ofQuaternion::get | ( | ofMatrix4x4 & | matrix | ) | const |
◆ getEuler()
ofVec3f ofQuaternion::getEuler | ( | ) | const |
Calculate and return the rotation as euler angles.
◆ getRotate() [1/2]
void ofQuaternion::getRotate | ( | float & | angle, |
float & | x, | ||
float & | y, | ||
float & | z | ||
) | const |
Return the angle and vector components represented by the quaternion.
◆ getRotate() [2/2]
void ofQuaternion::getRotate | ( | float & | angle, |
ofVec3f & | vec | ||
) | const |
◆ inverse()
|
inline |
Multiplicative inverse method.
q^(-1) = q^*‍/(q.q^*)
◆ length()
|
inline |
Length of the quaternion = sqrt(vec . vec)
◆ length2()
|
inline |
Length of the quaternion = vec . vec.
◆ makeRotate() [1/4]
Make a rotation Quat which will rotate vec1 to vec2. 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.
Make a rotation Quat which will rotate vec1 to vec2
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
- Note
- This is the rotation with shortest angle, which is the one equivalent to the acos/sin transform method. Other rotations exists, for example to additionally keep a local horizontal attitude.
◆ makeRotate() [2/4]
void ofQuaternion::makeRotate | ( | float | angle, |
const ofVec3f & | vec | ||
) |
◆ makeRotate() [3/4]
void ofQuaternion::makeRotate | ( | float | angle, |
float | x, | ||
float | y, | ||
float | z | ||
) |
\briefSet a quaternion which will perform a rotation of an angle around the axis given by the vector(x,y,z).
Define Spherical Linear interpolation method also
Set the elements of the Quat to represent a rotation of angle (degrees) around the axis (x,y,z)
◆ makeRotate() [4/4]
void ofQuaternion::makeRotate | ( | float | angle1, |
const ofVec3f & | axis1, | ||
float | angle2, | ||
const ofVec3f & | axis2, | ||
float | angle3, | ||
const ofVec3f & | axis3 | ||
) |
◆ makeRotate_original()
◆ normalize()
|
inline |
◆ operator glm::quat()
ofQuaternion::operator glm::quat | ( | ) | const |
◆ operator!=()
|
inline |
◆ operator*() [1/3]
|
inline |
Binary multiply.
◆ operator*() [2/3]
Rotate a vector by this quaternion.
◆ operator*() [3/3]
|
inline |
Multiply by scalar.
◆ operator*=() [1/2]
|
inline |
Unary multiply.
◆ operator*=() [2/2]
|
inline |
Unary multiply by scalar.
◆ operator+()
|
inline |
Binary addition.
◆ operator+=()
|
inline |
Unary addition.
◆ operator-() [1/2]
|
inline |
returns the negative of the quaternion. calls operator -() on the Vec4
◆ operator-() [2/2]
|
inline |
Binary subtraction.
◆ operator-=()
|
inline |
Unary subtraction.
◆ operator/() [1/2]
|
inline |
Binary divide.
◆ operator/() [2/2]
|
inline |
Divide by scalar.
◆ operator/=() [1/2]
|
inline |
Unary divide.
◆ operator/=() [2/2]
|
inline |
Unary divide by scalar.
◆ operator=()
|
inline |
◆ operator==()
|
inline |
◆ operator[]() [1/2]
|
inline |
◆ operator[]() [2/2]
|
inline |
◆ set() [1/3]
void ofQuaternion::set | ( | const ofMatrix4x4 & | matrix | ) |
◆ set() [2/3]
|
inline |
◆ set() [3/3]
|
inline |
◆ slerp()
void ofQuaternion::slerp | ( | float | t, |
const ofQuaternion & | from, | ||
const ofQuaternion & | to | ||
) |
Spherical Linear Interpolation.
As t goes from 0 to 1, the Quat object goes from "from" to "to".
Spherical Linear Interpolation As t goes from 0 to 1, the Quat object goes from "from" to "to" Reference: Shoemake at SIGGRAPH 89 See also http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm
◆ w() [1/2]
|
inline |
◆ w() [2/2]
|
inline |
◆ x() [1/2]
|
inline |
◆ x() [2/2]
|
inline |
◆ y() [1/2]
|
inline |
◆ y() [2/2]
|
inline |
◆ z() [1/2]
|
inline |
◆ z() [2/2]
|
inline |
◆ zeroRotation()
|
inline |
return true if the Quat represents a zero rotation, and therefore can be ignored in computations.
Friends And Related Symbol Documentation
◆ operator<<
|
friend |
◆ operator>>
|
friend |
The documentation for this class was generated from the following files:
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/math/ofQuaternion.h
- /Users/icq4ever/Desktop/oF0120/libs/openFrameworks/math/ofQuaternion.cpp