![]() |
OpenSceneGraph
|
A quaternion class. More...
Public Types | |
enum | { num_components = 4 } |
Number of vector components. More... | |
typedef double | value_type |
Data type of vector components. More... | |
Public Member Functions | |
Quat () | |
Quat (value_type x, value_type y, value_type z, value_type w) | |
Quat (const Quat &rhs) | |
Quat (const Vec4f &v) | |
Quat (const Vec4d &v) | |
Quat (value_type angle, const Vec3f &axis) | |
Quat (value_type angle, const Vec3d &axis) | |
Quat (value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3) | |
Quat (value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3) | |
Quat & | operator= (const Quat &v) |
bool | operator== (const Quat &v) const |
bool | operator!= (const Quat &v) const |
bool | operator< (const Quat &v) const |
Vec4d | asVec4 () const |
Vec3d | asVec3 () const |
void | set (value_type x, value_type y, value_type z, value_type w) |
void | set (const osg::Vec4f &v) |
void | set (const osg::Vec4d &v) |
void | set (const Matrixf &matrix) |
void | set (const Matrixd &matrix) |
void | get (Matrixf &matrix) const |
void | get (Matrixd &matrix) const |
value_type & | operator[] (int i) |
value_type | operator[] (int i) const |
value_type & | x () |
value_type & | y () |
value_type & | z () |
value_type & | w () |
value_type | x () const |
value_type | y () const |
value_type | z () const |
value_type | w () const |
bool | zeroRotation () const |
return true if the Quat represents a zero rotation, and therefore can be ignored in computations. More... | |
const Quat | operator* (value_type rhs) const |
Multiply by scalar. 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... | |
value_type | length () const |
Length of the quaternion = sqrt( vec . vec ) More... | |
value_type | length2 () const |
Length of the quaternion = vec . vec. More... | |
Quat | conj () const |
Conjugate. More... | |
const 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) |
void | makeRotate (value_type angle, const Vec3f &vec) |
void | makeRotate (value_type angle, const Vec3d &vec) |
void | makeRotate (value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3) |
void | makeRotate (value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3) |
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 | makeRotate_original (const Vec3d &vec1, const Vec3d &vec2) |
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 | slerp (value_type t, const Quat &from, const Quat &to) |
Spherical Linear Interpolation. 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... | |
Public Attributes | |
value_type | _v [4] |
A quaternion class.
It can be used to represent an orientation in 3D space.
typedef double osg::Quat::value_type |
Data type of vector components.
|
inline |
|
inline |
|
inline |
References osg::Vec4f::w(), osg::Vec4f::x(), osg::Vec4f::y(), and osg::Vec4f::z().
|
inline |
References osg::Vec4d::w(), osg::Vec4d::x(), osg::Vec4d::y(), and osg::Vec4d::z().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Referenced by osgAnimation::TemplateTarget< osg::Vec4f >::lerp().
|
inline |
Conjugate.
void osg::Quat::get | ( | Matrixf & | matrix | ) | const |
void osg::Quat::get | ( | Matrixd & | matrix | ) | const |
void osg::Quat::getRotate | ( | value_type & | angle, |
value_type & | x, | ||
value_type & | y, | ||
value_type & | z | ||
) | const |
Return the angle and vector components represented by the quaternion.
void osg::Quat::getRotate | ( | value_type & | angle, |
Vec3f & | vec | ||
) | const |
Return the angle and vector represented by the quaternion.
void osg::Quat::getRotate | ( | value_type & | angle, |
Vec3d & | vec | ||
) | const |
Return the angle and vector represented by the quaternion.
|
inline |
Multiplicative inverse method: q^(-1) = q^*/(q.q^*)
Referenced by operator/(), and operator/=().
|
inline |
Length of the quaternion = sqrt( vec . vec )
|
inline |
Length of the quaternion = vec . vec.
Referenced by osgAnimation::TemplateTarget< osg::Vec4f >::lerp().
void osg::Quat::makeRotate | ( | value_type | angle, |
value_type | x, | ||
value_type | y, | ||
value_type | z | ||
) |
void osg::Quat::makeRotate | ( | value_type | angle, |
const Vec3f & | vec | ||
) |
void osg::Quat::makeRotate | ( | value_type | angle, |
const Vec3d & | vec | ||
) |
void osg::Quat::makeRotate | ( | value_type | angle1, |
const Vec3f & | axis1, | ||
value_type | angle2, | ||
const Vec3f & | axis2, | ||
value_type | angle3, | ||
const Vec3f & | axis3 | ||
) |
void osg::Quat::makeRotate | ( | value_type | angle1, |
const Vec3d & | axis1, | ||
value_type | angle2, | ||
const Vec3d & | axis2, | ||
value_type | angle3, | ||
const Vec3d & | axis3 | ||
) |
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.
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 of when the vectors are co-incident or opposite in direction.
|
inline |
Multiply by scalar.
|
inline |
Unary multiply by scalar.
|
inline |
Negation operator - returns the negative of the quaternion.
Basically just calls operator - () on the Vec4
|
inline |
Divide by scalar.
Binary divide.
References inverse().
|
inline |
Unary divide by scalar.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void osg::Quat::set | ( | const Matrixf & | matrix | ) |
void osg::Quat::set | ( | const Matrixd & | matrix | ) |
void osg::Quat::slerp | ( | value_type | t, |
const Quat & | from, | ||
const Quat & | to | ||
) |
Spherical Linear Interpolation.
As t goes from 0 to 1, the Quat object goes from "from" to "to".
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
return true if the Quat represents a zero rotation, and therefore can be ignored in computations.
Referenced by osg::Matrixd::postMultRotate(), osg::Matrixf::postMultRotate(), osg::Matrixd::preMultRotate(), and osg::Matrixf::preMultRotate().
value_type osg::Quat::_v[4] |
Referenced by operator!=(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator<(), osg::operator<<(), operator=(), operator==(), osg::operator>>(), and Quat().