Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Quat Class Reference

A quaternion class. More...

List of all members.

Public Methods

 Quat ()
 Quat (float x, float y, float z, float w)
 Quat (const Vec4 &v)
Vec4 & asVec4 ()
const Vec4 & asVec4 () const
const Vec3 asVec3 () const
void set (const float x, const float y, const float z, const float w)
void set (const osg::Vec4 &v)
float & operator[] (int i)
float operator[] (int i) const
float & x ()
float & y ()
float & z ()
float & w ()
float x () const
float y () const
float z () const
float w () const
const Quat operator * (const float rhs) const
 Multiply by scalar.

Quat & operator *= (const float rhs)
 Unary multiply by scalar.

const Quat operator * (const Quat &rhs) const
 Binary multiply.

Quat & operator *= (const Quat &rhs)
 Unary multiply.

const Quat operator/ (const float &rhs) const
 Divide by scalar.

Quat & operator/= (const float &rhs)
 Unary divide by scalar.

const Quat operator/ (const Quat &denom) const
 Binary divide.

Quat & operator/= (const Quat &denom)
 Unary divide.

const Quat operator+ (const Quat &rhs) const
 Binary addition.

Quat & operator+= (const Quat &rhs)
 Unary addition.

const Quat operator- (const Quat &rhs) const
 Binary subtraction.

Quat & operator-= (const Quat &rhs)
 Unary subtraction.

const Quat operator- () const
 Negation operator- returns the negative of the quaternion.

const float length () const
 Length of the quaternion = sqrt( vec . vec ).

const float length2 () const
 Length of the quaternion = vec . vec.

const Quat conj () const
 Conjugate.

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

void makeRotate (const float angle, const float x, const float y, const float z)
void makeRotate (const float angle, const Vec3 &vec)
void makeRotate (float angle1, const Vec3 &axis1, float angle2, const Vec3 &axis2, float angle3, const Vec3 &axis3)
void makeRotate (const Vec3 &vec1, const Vec3 &vec2)
 Make a rotation Quat which will rotate vec1 to 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, Vec3 &vec) const
 Return the angle and vector represented by the quaternion.

void slerp (const float t, const Quat &from, const Quat &to)
 Spherical Linear Interpolation.

void set (const Matrix &m)
 Set quaternion to be equivalent to specified matrix.

void get (Matrix &m) const
 Get the equivalent matrix for this quaternion.

Matrix getMatrix () const
 Get the equivalent matrix for this quaternion.


Public Attributes

Vec4 _fv

Friends

std::ostream & operator<< (std::ostream &output, const Quat &vec)


Detailed Description

A quaternion class.

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


Constructor & Destructor Documentation

osg::Quat::Quat (    )  [inline]
 

osg::Quat::Quat (  float    x,
float    y,
float    z,
float    w
)  [inline]
 

osg::Quat::Quat (  const Vec4 &    v )  [inline]
 


Member Function Documentation

const Vec3 osg::Quat::asVec3 (    )  const [inline]
 

const Vec4& osg::Quat::asVec4 (    )  const [inline]
 

Vec4& osg::Quat::asVec4 (    )  [inline]
 

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

Conjugate.

void osg::Quat::get (  Matrix &    m )  const
 

Get the equivalent matrix for this quaternion.

Matrix osg::Quat::getMatrix (    )  const [inline]
 

Get the equivalent matrix for this quaternion.

void osg::Quat::getRotate (  float &    angle,
Vec3 &    vec
)  const
 

Return the angle and vector represented by the quaternion.

void osg::Quat::getRotate (  float &    angle,
float &    x,
float &    y,
float &    z
)  const
 

Return the angle and vector components represented by the quaternion.

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

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

const float osg::Quat::length (    )  const [inline]
 

Length of the quaternion = sqrt( vec . vec ).

const float osg::Quat::length2 (    )  const [inline]
 

Length of the quaternion = vec . vec.

void osg::Quat::makeRotate (  const Vec3 &    vec1,
const Vec3 &    vec2
) 
 

Make a rotation Quat which will rotate vec1 to vec2.

Generally take adot 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 (  float    angle1,
const Vec3 &    axis1,
float    angle2,
const Vec3 &    axis2,
float    angle3,
const Vec3 &    axis3
) 
 

void osg::Quat::makeRotate (  const float    angle,
const Vec3 &    vec
) 
 

void osg::Quat::makeRotate (  const float    angle,
const float    x,
const float    y,
const float    z
) 
 

const Quat osg::Quat::operator * (  const Quat &    rhs )  const [inline]
 

Binary multiply.

const Quat osg::Quat::operator * (  const float    rhs )  const [inline]
 

Multiply by scalar.

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

Unary multiply.

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

Unary multiply by scalar.

const Quat osg::Quat::operator+ (  const Quat &    rhs )  const [inline]
 

Binary addition.

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

Unary addition.

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

Negation operator- returns the negative of the quaternion.

Basically just calls operator-() on the Vec4

const Quat osg::Quat::operator- (  const Quat &    rhs )  const [inline]
 

Binary subtraction.

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

Unary subtraction.

const Quat osg::Quat::operator/ (  const Quat &    denom )  const [inline]
 

Binary divide.

const Quat osg::Quat::operator/ (  const float &    rhs )  const [inline]
 

Divide by scalar.

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

Unary divide.

Quat& osg::Quat::operator/= (  const float &    rhs )  [inline]
 

Unary divide by scalar.

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

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

void osg::Quat::set (  const Matrix &    m ) 
 

Set quaternion to be equivalent to specified matrix.

void osg::Quat::set (  const osg::Vec4 &    v )  [inline]
 

void osg::Quat::set (  const float    x,
const float    y,
const float    z,
const float    w
)  [inline]
 

void osg::Quat::slerp (  const float    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".

float osg::Quat::w (    )  const [inline]
 

float& osg::Quat::w (    )  [inline]
 

float osg::Quat::x (    )  const [inline]
 

float& osg::Quat::x (    )  [inline]
 

float osg::Quat::y (    )  const [inline]
 

float& osg::Quat::y (    )  [inline]
 

float osg::Quat::z (    )  const [inline]
 

float& osg::Quat::z (    )  [inline]
 


Friends And Related Function Documentation

std::ostream& operator<< (  std::ostream &    output,
const Quat &    vec
)  [friend]
 


Member Data Documentation

Vec4 osg::Quat::_fv
 


The documentation for this class was generated from the following file:
Generated at Wed Sep 18 13:55:37 2002 for the Open Scene Graph by doxygen 1.2.16.