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

Teddy::Maths::Quaternion Class Reference

#include <Quaternion.h>

List of all members.

Public Methods

 Quaternion ()
 Quaternion (const float a, const float b, const float c, const float d)
 Quaternion (const double a, const double b, const double c, const double d)
 Quaternion (const TVector< float > &v, const double f)
 Quaternion (const TVector< float > &v)
 Quaternion (const Quaternion &q)
 Quaternion (const Matrix &m)
 Quaternion (const double *p)
 operator double * ()
double & operator[] (const int n)
 operator const double * () const
double operator[] (const int n) const
Quaternion operator- () const
void operator= (const TVector< float > &vec)
void operator= (const Quaternion &q)
void operator= (const Matrix &m)
void operator= (const double *p)
Quaternion operator+ (const double f) const
Quaternion operator- (const double f) const
Quaternion operator * (const double f) const
Quaternion operator/ (const double f) const
const Quaternion & operator+= (const double f)
const Quaternion & operator-= (const double f)
const Quaternion & operator *= (const double f)
const Quaternion & operator/= (const double f)
Quaternion operator+ (const Quaternion &q) const
Quaternion operator- (const Quaternion &q) const
Quaternion operator * (const Quaternion &q) const
const Quaternion & operator+= (const Quaternion &q)
const Quaternion & operator-= (const Quaternion &q)
const Quaternion & operator *= (const Quaternion &q)
double magnitudeSquared () const
double magnitude () const
void normalize ()
Quaternion conjugate () const
Quaternion inverse () const
Quaternion unitInverse () const
TVector< float > rotateVector (TVector< float > &v) const
void setAxisAngle (const TVector< float > &vAxis, const double fAngle)
void getAxisAngle (TVector< float > &vAxis, double &fAngle) const
void rotate (const Quaternion &q)
void rotate (const TVector< float > &vAxis, const double fAngle)
TVector< float > getViewAxis () const
TVector< float > getUpAxis () const
TVector< float > getRightAxis () const

Public Attributes

double v [4]


Detailed Description

Author:
Sean O'Neil
This class implements a 4D quaternion. Several functions and operators are defined to make working with quaternions easier. Quaternions are often used to represent rotations, and have a number of advantages over other constructs. Their main disadvantage is that they are unintuitive.

Note: This class is not templatized because integral data types don't make sense and there's no need for double-precision.

Definition at line 57 of file Quaternion.h.


Constructor & Destructor Documentation

Teddy::Maths::Quaternion::Quaternion  
 

Definition at line 48 of file Quaternion.cpp.

Referenced by conjugate, operator *, operator+, operator-, and operator/.

Teddy::Maths::Quaternion::Quaternion const float    a,
const float    b,
const float    c,
const float    d
 

Definition at line 51 of file Quaternion.cpp.

References v.

Teddy::Maths::Quaternion::Quaternion const double    a,
const double    b,
const double    c,
const double    d
 

Definition at line 57 of file Quaternion.cpp.

References v.

Teddy::Maths::Quaternion::Quaternion const TVector< float > &    v,
const double    f
 

Teddy::Maths::Quaternion::Quaternion const TVector< float > &    v
 

Teddy::Maths::Quaternion::Quaternion const Quaternion &    q
 

Definition at line 65 of file Quaternion.cpp.

Teddy::Maths::Quaternion::Quaternion const Matrix   m
 

Definition at line 66 of file Quaternion.cpp.

Teddy::Maths::Quaternion::Quaternion const double *    p
 

Definition at line 67 of file Quaternion.cpp.


Member Function Documentation

Quaternion Teddy::Maths::Quaternion::conjugate   const
 

Definition at line 105 of file Quaternion.cpp.

References Quaternion, and v.

Referenced by inverse, and unitInverse.

void Teddy::Maths::Quaternion::getAxisAngle TVector< float > &    vAxis,
double &    fAngle
const
 

Vector Teddy::Maths::Quaternion::getRightAxis   const
 

Definition at line 150 of file Quaternion.cpp.

References v, and Vector.

Referenced by Teddy::Models::Model::pitch.

Vector Teddy::Maths::Quaternion::getUpAxis   const
 

Definition at line 139 of file Quaternion.cpp.

References v, and Vector.

Referenced by Teddy::Models::Model::heading.

Vector Teddy::Maths::Quaternion::getViewAxis   const
 

Definition at line 128 of file Quaternion.cpp.

References v, and Vector.

Referenced by Teddy::Materials::Light::applyLight, Teddy::Models::Model::foward, and Teddy::Models::Model::roll.

Quaternion Teddy::Maths::Quaternion::inverse   const
 

Definition at line 106 of file Quaternion.cpp.

References conjugate, and magnitudeSquared.

double Teddy::Maths::Quaternion::magnitude   const
 

Definition at line 101 of file Quaternion.cpp.

References magnitudeSquared.

Referenced by normalize.

double Teddy::Maths::Quaternion::magnitudeSquared   const
 

Definition at line 100 of file Quaternion.cpp.

References v.

Referenced by inverse, and magnitude.

void Teddy::Maths::Quaternion::normalize  
 

Definition at line 102 of file Quaternion.cpp.

References magnitude.

Quaternion Teddy::Maths::Quaternion::operator * const Quaternion &    q const
 

Definition at line 264 of file Quaternion.cpp.

References Quaternion, and v.

Quaternion Teddy::Maths::Quaternion::operator * const double    f const
 

Definition at line 84 of file Quaternion.cpp.

References Quaternion, and v.

const Quaternion & Teddy::Maths::Quaternion::operator *= const Quaternion &    q
 

Definition at line 97 of file Quaternion.cpp.

const Quaternion & Teddy::Maths::Quaternion::operator *= const double    f
 

Definition at line 88 of file Quaternion.cpp.

References v.

Teddy::Maths::Quaternion::operator const double *   const
 

Definition at line 72 of file Quaternion.cpp.

Teddy::Maths::Quaternion::operator double *  
 

Definition at line 70 of file Quaternion.cpp.

References v.

Quaternion Teddy::Maths::Quaternion::operator+ const Quaternion &    q const
 

Definition at line 92 of file Quaternion.cpp.

References Quaternion, and v.

Quaternion Teddy::Maths::Quaternion::operator+ const double    f const
 

Definition at line 82 of file Quaternion.cpp.

References Quaternion, and v.

const Quaternion & Teddy::Maths::Quaternion::operator+= const Quaternion &    q
 

Definition at line 95 of file Quaternion.cpp.

References v.

const Quaternion & Teddy::Maths::Quaternion::operator+= const double    f
 

Definition at line 86 of file Quaternion.cpp.

References v.

Quaternion Teddy::Maths::Quaternion::operator- const Quaternion &    q const
 

Definition at line 93 of file Quaternion.cpp.

References Quaternion, and v.

Quaternion Teddy::Maths::Quaternion::operator- const double    f const
 

Definition at line 83 of file Quaternion.cpp.

References Quaternion, and v.

Quaternion Teddy::Maths::Quaternion::operator-   const
 

Definition at line 74 of file Quaternion.cpp.

const Quaternion & Teddy::Maths::Quaternion::operator-= const Quaternion &    q
 

Definition at line 96 of file Quaternion.cpp.

References v.

const Quaternion & Teddy::Maths::Quaternion::operator-= const double    f
 

Definition at line 87 of file Quaternion.cpp.

References v.

Quaternion Teddy::Maths::Quaternion::operator/ const double    f const
 

Definition at line 85 of file Quaternion.cpp.

References Quaternion, and v.

const Quaternion & Teddy::Maths::Quaternion::operator/= const double    f
 

Definition at line 89 of file Quaternion.cpp.

References v.

void Teddy::Maths::Quaternion::operator= const double *    p
 

Definition at line 79 of file Quaternion.cpp.

References v.

void Teddy::Maths::Quaternion::operator= const Matrix   m
 

Definition at line 223 of file Quaternion.cpp.

References v.

void Teddy::Maths::Quaternion::operator= const Quaternion &    q
 

Definition at line 78 of file Quaternion.cpp.

References v.

void Teddy::Maths::Quaternion::operator= const TVector< float > &    vec
 

double Teddy::Maths::Quaternion::operator[] const int    n const
 

Definition at line 73 of file Quaternion.cpp.

References v.

double & Teddy::Maths::Quaternion::operator[] const int    n
 

Definition at line 71 of file Quaternion.cpp.

References v.

void Teddy::Maths::Quaternion::rotate const TVector< float > &    vAxis,
const double    fAngle
 

void Teddy::Maths::Quaternion::rotate const Quaternion &    q
 

Definition at line 109 of file Quaternion.cpp.

Referenced by Teddy::Models::Model::heading, Teddy::Models::Model::pitch, and Teddy::Models::Model::roll.

TVector<float> Teddy::Maths::Quaternion::rotateVector TVector< float > &    v const
 

void Teddy::Maths::Quaternion::setAxisAngle const TVector< float > &    vAxis,
const double    fAngle
 

Quaternion Teddy::Maths::Quaternion::unitInverse   const
 

Definition at line 107 of file Quaternion.cpp.

References conjugate.


Member Data Documentation

double Teddy::Maths::Quaternion::v[4]
 

Definition at line 59 of file Quaternion.h.

Referenced by conjugate, getRightAxis, getUpAxis, getViewAxis, magnitudeSquared, operator *, operator *=, operator double *, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator=, operator[], and Quaternion.


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