i6engine  1.0
i6e::math::i6eQuaternion Class Reference

Class describing a 3d rotation. More...

#include <D:/Projekte/i6engine/libs/i6engine-math/include/i6engine/math/i6eQuaternion.h>

Public Member Functions

 i6eQuaternion ()
 Creates a new vector with all values set to 0. More...
 
 i6eQuaternion (const double w, const double x, const double y, const double z)
 Creates a new vector with given values. Be careful with the ordering. i6eQuaternion expects W first, Bullet-Quaternion expects W last. More...
 
 i6eQuaternion (const i6eVector &axis, const double angle)
 Constructor for easy rotations. More...
 
 i6eQuaternion (const Ogre::Quaternion &ogre)
 Copy constructor with vector from Ogre. More...
 
 i6eQuaternion (const btQuaternion &bullet)
 Copy constructor with vector from Bullet. More...
 
 i6eQuaternion (const std::map< std::string, std::string > &params, const std::string &prefix)
 
 i6eQuaternion (const std::string &str)
 
 ~i6eQuaternion ()
 Empty. More...
 
double getW () const
 getters for the values of the quaternion More...
 
double getX () const
 
double getY () const
 
double getZ () const
 
void setW (const double w)
 setters for the values of the quaternion More...
 
void setX (const double x)
 
void setY (const double y)
 
void setZ (const double z)
 
i6eQuaternion operator+ (const i6eQuaternion &b) const
 Operator '+' for Quaternions. More...
 
i6eQuaternion operator- (const i6eQuaternion &b) const
 Operator '-' for Quaternions. More...
 
i6eQuaternion operator* (const i6eQuaternion &q) const
 Operator '*' for Quaternions. More...
 
i6eQuaternion operator* (const double &v) const
 multiplies a quaternion with a scalar More...
 
i6eQuaternion operator/ (const double &v) const
 divides a quaternion by a scalar More...
 
i6eQuaternion operator+= (const i6eQuaternion &b)
 Operator '+=' for Quaternions. More...
 
void insertInMap (const std::string &prefix, std::map< std::string, std::string > &map) const
 inserts this quaternion into an attributeMap using the given prefix More...
 
i6eQuaternion inverse () const
 return the inverted vector of the quaternion More...
 
double length () const
 return the length of the quaternion More...
 
i6eQuaternion normalize () const
 normalieses Quaternion to length 1 More...
 
bool equals (const i6eQuaternion &q, double eps=i6eQuaternion::EPSILON) const
 compares this and q More...
 
void toAxisAngle (i6eVector &axis, double &angle) const
 converts the quaternion to an angle / axis representation More...
 
bool operator== (const i6eQuaternion &b) const
 Operator '==' for Quaternions. More...
 
bool operator!= (const i6eQuaternion &b) const
 Operator '!=' for Quaternions. More...
 
i6eVector toVector () const
 creates a 3D vector containing x, y and z More...
 
Ogre::Quaternion toOgre () const
 Convert whole vector to Ogre. More...
 
btQuaternion toBullet () const
 Convert whole vector to Bullet. More...
 
std::string toString () const
 generates a string containing a readable version of the quaternion More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 serialize method for quaternion; More...
 

Static Public Attributes

static const i6eQuaternion IDENTITY
 

Detailed Description

Class describing a 3d rotation.

Descibes a 3d rotation with 4-dimensional vectors. Conversion of vectors from Ogre and Bullet possible. Implementation identical to i6eVector4.

Bullet stores X first, Ogre stores W first... not binary compatible.

Definition at line 58 of file i6eQuaternion.h.

Constructor & Destructor Documentation

i6e::math::i6eQuaternion::i6eQuaternion ( )
inline

Creates a new vector with all values set to 0.

Definition at line 67 of file i6eQuaternion.h.

i6e::math::i6eQuaternion::i6eQuaternion ( const double  w,
const double  x,
const double  y,
const double  z 
)
inline

Creates a new vector with given values. Be careful with the ordering. i6eQuaternion expects W first, Bullet-Quaternion expects W last.

Definition at line 74 of file i6eQuaternion.h.

i6e::math::i6eQuaternion::i6eQuaternion ( const i6eVector axis,
const double  angle 
)

Constructor for easy rotations.

Parameters
[in]axisthe axis around which the Object should be rotated
[in]angleangle by which the object should be rotated using in radians
i6e::math::i6eQuaternion::i6eQuaternion ( const Ogre::Quaternion ogre)
explicit

Copy constructor with vector from Ogre.

Parameters
[in]ogreVector to copy
i6e::math::i6eQuaternion::i6eQuaternion ( const btQuaternion &  bullet)
explicit

Copy constructor with vector from Bullet.

Parameters
[in]bulletVector to copy
i6e::math::i6eQuaternion::i6eQuaternion ( const std::map< std::string, std::string > &  params,
const std::string &  prefix 
)
i6e::math::i6eQuaternion::i6eQuaternion ( const std::string &  str)
explicit
i6e::math::i6eQuaternion::~i6eQuaternion ( )
inline

Empty.

Nothing to do right now, should free memory

Definition at line 116 of file i6eQuaternion.h.

Member Function Documentation

bool i6e::math::i6eQuaternion::equals ( const i6eQuaternion q,
double  eps = i6eQuaternion::EPSILON 
) const

compares this and q

Parameters
[in]qQuaternion to compare with
Returns
true if they are similar according to epsi(angle < eps)
double i6e::math::i6eQuaternion::getW ( ) const
inline

getters for the values of the quaternion

Definition at line 122 of file i6eQuaternion.h.

double i6e::math::i6eQuaternion::getX ( ) const
inline

Definition at line 123 of file i6eQuaternion.h.

double i6e::math::i6eQuaternion::getY ( ) const
inline

Definition at line 124 of file i6eQuaternion.h.

double i6e::math::i6eQuaternion::getZ ( ) const
inline

Definition at line 125 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::insertInMap ( const std::string &  prefix,
std::map< std::string, std::string > &  map 
) const

inserts this quaternion into an attributeMap using the given prefix

i6eQuaternion i6e::math::i6eQuaternion::inverse ( ) const
inline

return the inverted vector of the quaternion

Definition at line 193 of file i6eQuaternion.h.

double i6e::math::i6eQuaternion::length ( ) const

return the length of the quaternion

i6eQuaternion i6e::math::i6eQuaternion::normalize ( ) const

normalieses Quaternion to length 1

bool i6e::math::i6eQuaternion::operator!= ( const i6eQuaternion b) const
inline

Operator '!=' for Quaternions.

Definition at line 229 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator* ( const i6eQuaternion q) const
inline

Operator '*' for Quaternions.

Definition at line 152 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator* ( const double &  v) const
inline

multiplies a quaternion with a scalar

Definition at line 163 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator+ ( const i6eQuaternion b) const
inline

Operator '+' for Quaternions.

Definition at line 138 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator+= ( const i6eQuaternion b)
inline

Operator '+=' for Quaternions.

Definition at line 177 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator- ( const i6eQuaternion b) const
inline

Operator '-' for Quaternions.

Definition at line 145 of file i6eQuaternion.h.

i6eQuaternion i6e::math::i6eQuaternion::operator/ ( const double &  v) const
inline

divides a quaternion by a scalar

Definition at line 170 of file i6eQuaternion.h.

bool i6e::math::i6eQuaternion::operator== ( const i6eQuaternion b) const

Operator '==' for Quaternions.

template<class Archive >
void i6e::math::i6eQuaternion::serialize ( Archive &  ar,
const unsigned  int 
)
inline

serialize method for quaternion;

Definition at line 262 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::setW ( const double  w)
inline

setters for the values of the quaternion

Definition at line 130 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::setX ( const double  x)
inline

Definition at line 131 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::setY ( const double  y)
inline

Definition at line 132 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::setZ ( const double  z)
inline

Definition at line 133 of file i6eQuaternion.h.

void i6e::math::i6eQuaternion::toAxisAngle ( i6eVector axis,
double &  angle 
) const

converts the quaternion to an angle / axis representation

Parameters
[out]anglerotation by this angle
[out]axisaround this axis
btQuaternion i6e::math::i6eQuaternion::toBullet ( ) const

Convert whole vector to Bullet.

Returns
Vector converted to Bullet
Ogre::Quaternion i6e::math::i6eQuaternion::toOgre ( ) const

Convert whole vector to Ogre.

Returns
Vector converted to Ogre
std::string i6e::math::i6eQuaternion::toString ( ) const

generates a string containing a readable version of the quaternion

i6eVector i6e::math::i6eQuaternion::toVector ( ) const

creates a 3D vector containing x, y and z

Returns

Member Data Documentation

const i6eQuaternion i6e::math::i6eQuaternion::IDENTITY
static

Definition at line 62 of file i6eQuaternion.h.


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