OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | List of all members
osg::Quat Class Reference

#include <Quat.h>

Public Types

typedef double value_type
 

Public Member Functions

 Quat ()
 
 Quat (value_type x, value_type y, value_type z, value_type w)
 
 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)
 
Quatoperator= (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_typeoperator[] (int i)
 
value_type operator[] (int i) const
 
value_typex ()
 
value_typey ()
 
value_typez ()
 
value_typew ()
 
value_type x () const
 
value_type y () const
 
value_type z () const
 
value_type w () const
 
bool zeroRotation () const
 
const Quat operator* (value_type rhs) const
 Multiply by scalar. More...
 
Quatoperator*= (value_type rhs)
 Unary multiply by scalar. More...
 
const Quat operator* (const Quat &rhs) const
 Binary multiply. More...
 
Quatoperator*= (const Quat &rhs)
 Unary multiply. More...
 
Quat operator/ (value_type rhs) const
 Divide by scalar. More...
 
Quatoperator/= (value_type rhs)
 Unary divide by scalar. More...
 
const Quat operator/ (const Quat &denom) const
 Binary divide. More...
 
Quatoperator/= (const Quat &denom)
 Unary divide. More...
 
const Quat operator+ (const Quat &rhs) const
 Binary addition. More...
 
Quatoperator+= (const Quat &rhs)
 Unary addition. More...
 
const Quat operator- (const Quat &rhs) const
 Binary subtraction. More...
 
Quatoperator-= (const Quat &rhs)
 Unary subtraction. More...
 
const Quat operator- () const
 
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)
 
void makeRotate (const Vec3d &vec1, const Vec3d &vec2)
 
void makeRotate_original (const Vec3d &vec1, const Vec3d &vec2)
 
void getRotate (value_type &angle, value_type &x, value_type &y, value_type &z) const
 
void getRotate (value_type &angle, Vec3f &vec) const
 
void getRotate (value_type &angle, Vec3d &vec) const
 
void slerp (value_type t, const Quat &from, const Quat &to)
 
Vec3f operator* (const Vec3f &v) const
 
Vec3d operator* (const Vec3d &v) const
 

Public Attributes

value_type _v [4]
 

Detailed Description

A quaternion class. It can be used to represent an orientation in 3D space.

Definition at line 29 of file Quat.h.

Member Typedef Documentation

typedef double osg::Quat::value_type

Definition at line 34 of file Quat.h.

Constructor & Destructor Documentation

osg::Quat::Quat ( )
inline

Definition at line 38 of file Quat.h.

osg::Quat::Quat ( value_type  x,
value_type  y,
value_type  z,
value_type  w 
)
inline

Definition at line 40 of file Quat.h.

osg::Quat::Quat ( const Vec4f v)
inline

Definition at line 48 of file Quat.h.

Here is the call graph for this function:

osg::Quat::Quat ( const Vec4d v)
inline

Definition at line 56 of file Quat.h.

Here is the call graph for this function:

osg::Quat::Quat ( value_type  angle,
const Vec3f axis 
)
inline

Definition at line 64 of file Quat.h.

osg::Quat::Quat ( value_type  angle,
const Vec3d axis 
)
inline

Definition at line 68 of file Quat.h.

osg::Quat::Quat ( value_type  angle1,
const Vec3f axis1,
value_type  angle2,
const Vec3f axis2,
value_type  angle3,
const Vec3f axis3 
)
inline

Definition at line 73 of file Quat.h.

osg::Quat::Quat ( value_type  angle1,
const Vec3d axis1,
value_type  angle2,
const Vec3d axis2,
value_type  angle3,
const Vec3d axis3 
)
inline

Definition at line 80 of file Quat.h.

Member Function Documentation

Vec3d osg::Quat::asVec3 ( ) const
inline

Definition at line 113 of file Quat.h.

Vec4d osg::Quat::asVec4 ( ) const
inline

Definition at line 108 of file Quat.h.

Here is the caller graph for this function:

Quat osg::Quat::conj ( ) const
inline

Conjugate.

Definition at line 300 of file Quat.h.

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.

const Quat osg::Quat::inverse ( ) const
inline

Multiplicative inverse method: q^(-1) = q^*/(q.q^*)

Definition at line 306 of file Quat.h.

Here is the caller graph for this function:

value_type osg::Quat::length ( ) const
inline

Length of the quaternion = sqrt( vec . vec )

Definition at line 288 of file Quat.h.

value_type osg::Quat::length2 ( ) const
inline

Length of the quaternion = vec . vec.

Definition at line 294 of file Quat.h.

Here is the caller graph for this function:

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 
)
void osg::Quat::makeRotate ( const Vec3f vec1,
const Vec3f 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 osg::Quat::makeRotate ( const Vec3d vec1,
const Vec3d 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 of when the vectors are co-incident or opposite in direction.

void osg::Quat::makeRotate_original ( const Vec3d vec1,
const Vec3d vec2 
)
bool osg::Quat::operator!= ( const Quat v) const
inline

Definition at line 91 of file Quat.h.

const Quat osg::Quat::operator* ( value_type  rhs) const
inline

Multiply by scalar.

Definition at line 176 of file Quat.h.

const Quat osg::Quat::operator* ( const Quat rhs) const
inline

Binary multiply.

Definition at line 192 of file Quat.h.

Vec3f osg::Quat::operator* ( const Vec3f v) const
inline

Rotate a vector by this quaternion.

Definition at line 362 of file Quat.h.

Vec3d osg::Quat::operator* ( const Vec3d v) const
inline

Rotate a vector by this quaternion.

Definition at line 375 of file Quat.h.

Quat& osg::Quat::operator*= ( value_type  rhs)
inline

Unary multiply by scalar.

Definition at line 182 of file Quat.h.

Quat& osg::Quat::operator*= ( const Quat rhs)
inline

Unary multiply.

Definition at line 201 of file Quat.h.

const Quat osg::Quat::operator+ ( const Quat rhs) const
inline

Binary addition.

Definition at line 247 of file Quat.h.

Quat& osg::Quat::operator+= ( const Quat rhs)
inline

Unary addition.

Definition at line 254 of file Quat.h.

const Quat osg::Quat::operator- ( const Quat rhs) const
inline

Binary subtraction.

Definition at line 264 of file Quat.h.

const Quat osg::Quat::operator- ( ) const
inline

Negation operator - returns the negative of the quaternion. Basically just calls operator - () on the Vec4

Definition at line 282 of file Quat.h.

Quat& osg::Quat::operator-= ( const Quat rhs)
inline

Unary subtraction.

Definition at line 271 of file Quat.h.

Quat osg::Quat::operator/ ( value_type  rhs) const
inline

Divide by scalar.

Definition at line 216 of file Quat.h.

const Quat osg::Quat::operator/ ( const Quat denom) const
inline

Binary divide.

Definition at line 234 of file Quat.h.

Here is the call graph for this function:

Quat& osg::Quat::operator/= ( value_type  rhs)
inline

Unary divide by scalar.

Definition at line 223 of file Quat.h.

Quat& osg::Quat::operator/= ( const Quat denom)
inline

Unary divide.

Definition at line 240 of file Quat.h.

Here is the call graph for this function:

bool osg::Quat::operator< ( const Quat v) const
inline

Definition at line 93 of file Quat.h.

Quat& osg::Quat::operator= ( const Quat v)
inline

Definition at line 87 of file Quat.h.

bool osg::Quat::operator== ( const Quat v) const
inline

Definition at line 89 of file Quat.h.

value_type& osg::Quat::operator[] ( int  i)
inline

Definition at line 151 of file Quat.h.

value_type osg::Quat::operator[] ( int  i) const
inline

Definition at line 152 of file Quat.h.

void osg::Quat::set ( value_type  x,
value_type  y,
value_type  z,
value_type  w 
)
inline

Definition at line 118 of file Quat.h.

void osg::Quat::set ( const osg::Vec4f v)
inline

Definition at line 126 of file Quat.h.

Here is the call graph for this function:

void osg::Quat::set ( const osg::Vec4d v)
inline

Definition at line 134 of file Quat.h.

Here is the call graph for this function:

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".

value_type& osg::Quat::w ( )
inline

Definition at line 157 of file Quat.h.

value_type osg::Quat::w ( ) const
inline

Definition at line 162 of file Quat.h.

value_type& osg::Quat::x ( )
inline

Definition at line 154 of file Quat.h.

value_type osg::Quat::x ( ) const
inline

Definition at line 159 of file Quat.h.

value_type& osg::Quat::y ( )
inline

Definition at line 155 of file Quat.h.

value_type osg::Quat::y ( ) const
inline

Definition at line 160 of file Quat.h.

value_type& osg::Quat::z ( )
inline

Definition at line 156 of file Quat.h.

value_type osg::Quat::z ( ) const
inline

Definition at line 161 of file Quat.h.

bool osg::Quat::zeroRotation ( ) const
inline

return true if the Quat represents a zero rotation, and therefore can be ignored in computations.

Definition at line 165 of file Quat.h.

Here is the caller graph for this function:

Member Data Documentation

value_type osg::Quat::_v[4]

Definition at line 36 of file Quat.h.


The documentation for this class was generated from the following file: