version 3.3

VRS::Quat Class Reference

A quaternion class. More...

#include <vrs/quat.h>

Inheritance diagram for VRS::Quat:

VRS::VertexData< 4, double >

List of all members.

Public Member Functions

 Quat ()
 Quat (double x, double y, double z, double w)
 Quat (const Vector4d &v)
 Quat (double angle, const Vector &axis)
 Quat (double angle1, const Vector &axis1, double angle2, const Vector &axis2, double angle3, const Vector &axis3)
bool operator== (const Quat &v) const
bool operator!= (const Quat &v) const
bool operator< (const Quat &v) const
Vector toVec3d () const
void set (double x, double y, double z, double w)
void set (const Matrix &matrix)
void get (Matrix &matrix) const
void set (const Vector &dir, const Vector &up)
void get (Vector &dir, Vector &up) const
double & x ()
double & y ()
double & z ()
double & w ()
double x () const
double y () const
double z () const
double w () const
bool zeroRotation () const
 return true if the Quat represents a zero rotation, and therefore can be ignored in computations.
const Quat operator* (double rhs) const
 Multiply by scalar.
Quatoperator*= (double rhs)
 Unary multiply by scalar.
const Quat operator* (const Quat &rhs) const
 Binary multiply.
Quatoperator*= (const Quat &rhs)
 Unary multiply.
Quat operator/ (double rhs) const
 Divide by scalar.
Quatoperator/= (double rhs)
 Unary divide by scalar.
const Quat operator/ (const Quat &denom) const
 Binary divide.
Quatoperator/= (const Quat &denom)
 Unary divide.
const Quat operator+ (const Quat &rhs) const
 Binary addition.
Quatoperator+= (const Quat &rhs)
 Unary addition.
const Quat operator- (const Quat &rhs) const
 Binary subtraction.
Quatoperator-= (const Quat &rhs)
 Unary subtraction.
const Quat operator- () const
 Negation operator - returns the negative of the quaternion.
double abs () const
 Length of the quaternion = sqrt( vec . vec ).
double abs2 () const
 Length of the quaternion = vec . vec.
Quat conj () const
 Conjugate.
const Quat inverse () const
 Multiplicative inverse method: q^(-1) = q^*/(q.q^*).
void makeRotate (double angle, double x, double y, double z)
void makeRotate (double angle, const Vector &vec)
void makeRotate (double angle1, const Vector &axis1, double angle2, const Vector &axis2, double angle3, const Vector &axis3)
void makeRotate (const Vector &vec1, const Vector &vec2)
 Make a rotation Quat which will rotate vec1 to vec2.
void getRotate (double &angle, double &x, double &y, double &z) const
 Return the angle and vector components represented by the quaternion.
void getRotate (double &angle, Vector &vec) const
 Return the angle and vector represented by the quaternion.
void slerp (double t, const Quat &from, const Quat &to)
 Spherical Linear Interpolation.
Vector operator* (const Vector &v) const
 Rotate a vector by this quaternion.
 VRS_SERIALIZABLE_NO_SO_CLASS (Quat)

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

VRS::Quat::Quat (  )  [inline]

VRS::Quat::Quat ( double  x,
double  y,
double  z,
double  w 
) [inline]

VRS::Quat::Quat ( const Vector4d v  )  [inline]

VRS::Quat::Quat ( double  angle,
const Vector axis 
) [inline]

VRS::Quat::Quat ( double  angle1,
const Vector axis1,
double  angle2,
const Vector axis2,
double  angle3,
const Vector axis3 
) [inline]


Member Function Documentation

bool VRS::Quat::operator== ( const Quat v  )  const [inline]

bool VRS::Quat::operator!= ( const Quat v  )  const [inline]

bool VRS::Quat::operator< ( const Quat v  )  const [inline]

Vector VRS::Quat::toVec3d (  )  const [inline]

void VRS::Quat::set ( double  x,
double  y,
double  z,
double  w 
) [inline]

void VRS::Quat::set ( const Matrix matrix  ) 

void VRS::Quat::get ( Matrix matrix  )  const

void VRS::Quat::set ( const Vector dir,
const Vector up 
)

void VRS::Quat::get ( Vector dir,
Vector up 
) const

double& VRS::Quat::x (  )  [inline]

double& VRS::Quat::y (  )  [inline]

double& VRS::Quat::z (  )  [inline]

double& VRS::Quat::w (  )  [inline]

double VRS::Quat::x (  )  const [inline]

double VRS::Quat::y (  )  const [inline]

double VRS::Quat::z (  )  const [inline]

double VRS::Quat::w (  )  const [inline]

bool VRS::Quat::zeroRotation (  )  const [inline]

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

const Quat VRS::Quat::operator* ( double  rhs  )  const [inline]

Multiply by scalar.

Quat& VRS::Quat::operator*= ( double  rhs  )  [inline]

Unary multiply by scalar.

const Quat VRS::Quat::operator* ( const Quat rhs  )  const [inline]

Binary multiply.

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

Unary multiply.

Quat VRS::Quat::operator/ ( double  rhs  )  const [inline]

Divide by scalar.

Quat& VRS::Quat::operator/= ( double  rhs  )  [inline]

Unary divide by scalar.

const Quat VRS::Quat::operator/ ( const Quat denom  )  const [inline]

Binary divide.

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

Unary divide.

const Quat VRS::Quat::operator+ ( const Quat rhs  )  const [inline]

Binary addition.

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

Unary addition.

const Quat VRS::Quat::operator- ( const Quat rhs  )  const [inline]

Binary subtraction.

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

Unary subtraction.

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

Negation operator - returns the negative of the quaternion.

Basically just calls operator - () on the Vec4

double VRS::Quat::abs (  )  const [inline]

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

double VRS::Quat::abs2 (  )  const [inline]

Length of the quaternion = vec . vec.

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

Conjugate.

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

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

void VRS::Quat::makeRotate ( double  angle,
double  x,
double  y,
double  z 
)

void VRS::Quat::makeRotate ( double  angle,
const Vector vec 
)

void VRS::Quat::makeRotate ( double  angle1,
const Vector axis1,
double  angle2,
const Vector axis2,
double  angle3,
const Vector axis3 
)

void VRS::Quat::makeRotate ( const Vector vec1,
const Vector 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 VRS::Quat::getRotate ( double &  angle,
double &  x,
double &  y,
double &  z 
) const

Return the angle and vector components represented by the quaternion.

void VRS::Quat::getRotate ( double &  angle,
Vector vec 
) const

Return the angle and vector represented by the quaternion.

void VRS::Quat::slerp ( double  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".

Vector VRS::Quat::operator* ( const Vector v  )  const [inline]

Rotate a vector by this quaternion.

VRS::Quat::VRS_SERIALIZABLE_NO_SO_CLASS ( Quat   ) 


Friends And Related Function Documentation

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


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

Generated on Tue May 22 06:00:27 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact