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

# Ogre::Quaternion Class Reference

Implementation of a Quaternion, i.e. More...

`#include <OgreQuaternion.h>`

List of all members.

## Public Methods

| Quaternion (Real fW=1.0, Real fX=0.0, Real fY=0.0, Real fZ=0.0)
| Quaternion (const Quaternion &rkQ)
| Quaternion (const Matrix3 &rot)
| Construct a quaternion from a rotation matrix.
| Quaternion (const Radian &rfAngle, const Vector3 &rkAxis)
| Construct a quaternion from an angle/axis.
| Quaternion (const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis)
| Construct a quaternion from 3 orthonormal local axes.
| Quaternion (Vector3 *akAxis)
| Construct a quaternion from 3 orthonormal local axes.
void | FromRotationMatrix (const Matrix3 &kRot)
void | ToRotationMatrix (Matrix3 &kRot) const
void | FromAngleAxis (const Radian &rfAngle, const Vector3 &rkAxis)
void | ToAngleAxis (Radian &rfAngle, Vector3 &rkAxis) const
void | ToAngleAxis (Degree &dAngle, Vector3 &rkAxis) const
void | FromAxes (const Vector3 *akAxis)
void | FromAxes (const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis)
void | ToAxes (Vector3 *akAxis) const
void | ToAxes (Vector3 &xAxis, Vector3 &yAxis, Vector3 &zAxis) const
Vector3 | xAxis (void) const
| Get the local x-axis.
Vector3 | yAxis (void) const
| Get the local y-axis.
Vector3 | zAxis (void) const
| Get the local z-axis.
Quaternion & | operator= (const Quaternion &rkQ)
Quaternion | operator+ (const Quaternion &rkQ) const
Quaternion | operator- (const Quaternion &rkQ) const
Quaternion | operator * (const Quaternion &rkQ) const
Quaternion | operator * (Real fScalar) const
Quaternion | operator- () const
bool | operator== (const Quaternion &rhs) const
Real | Dot (const Quaternion &rkQ) const
Real | Norm () const
Real | normalise (void)
| Normalises this quaternion, and returns the previous length.
Quaternion | Inverse () const
Quaternion | UnitInverse () const
Quaternion | Exp () const
Quaternion | Log () const
Vector3 | operator * (const Vector3 &rkVector) const
Radian | getRoll (void) const
| Calculate the local roll element of this quaternion.
Radian | getPitch (void) const
| Calculate the local pitch element of this quaternion.
Radian | getYaw (void) const
| Calculate the local yaw element of this quaternion.

## Static Public Methods

Quaternion | Slerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false)
Quaternion | SlerpExtraSpins (Real fT, const Quaternion &rkP, const Quaternion &rkQ, int iExtraSpins)
void | Intermediate (const Quaternion &rkQ0, const Quaternion &rkQ1, const Quaternion &rkQ2, Quaternion &rka, Quaternion &rkB)
Quaternion | Squad (Real fT, const Quaternion &rkP, const Quaternion &rkA, const Quaternion &rkB, const Quaternion &rkQ, bool shortestPath=false)
Quaternion | nlerp (Real fT, const Quaternion &rkP, const Quaternion &rkQ, bool shortestPath=false)

## Public Attributes

Real | w
Real | x
Real | y
Real | z

## Static Public Attributes

const Real | ms_fEpsilon = 1e-03
const Quaternion | ZERO
const Quaternion | IDENTITY

## Friends

_OgreExport friend Quaternion | operator * (Real fScalar, const Quaternion &rkQ)
_OgreExport friend std::ostream & | operator<< (std::ostream &o, const Quaternion &q)
| Function for writing to a stream.

## Detailed Description

Implementation of a Quaternion, i.e.

a rotation around an axis.

Definition at line 49 of file OgreQuaternion.h.

## Constructor & Destructor Documentation

Ogre::Quaternion::Quaternion | ( | Real | fW = 1.0,
|  | Real | fX = 0.0,
|  | Real | fY = 0.0,
|  | Real | fZ = 0.0
| ) |

| Definition at line 52 of file OgreQuaternion.h. References Ogre::Real. Referenced by Inverse(), operator *(), operator+(), operator-(), and UnitInverse().

Ogre::Quaternion::Quaternion | ( | const Quaternion & | rkQ | ) |

| Definition at line 61 of file OgreQuaternion.h. References w, x, y, and z.

Ogre::Quaternion::Quaternion | ( | const Matrix3 & | rot | ) |

| Construct a quaternion from a rotation matrix. Definition at line 69 of file OgreQuaternion.h.

Ogre::Quaternion::Quaternion | ( | const Radian & | rfAngle,
|  | const Vector3 & | rkAxis
| ) |

| Construct a quaternion from an angle/axis. Definition at line 74 of file OgreQuaternion.h.

Ogre::Quaternion::Quaternion | ( | const Vector3 & | xAxis,
|  | const Vector3 & | yAxis,
|  | const Vector3 & | zAxis
| ) |

| Construct a quaternion from 3 orthonormal local axes. Definition at line 85 of file OgreQuaternion.h.

Ogre::Quaternion::Quaternion | ( | Vector3 * | akAxis | ) |

| Construct a quaternion from 3 orthonormal local axes. Definition at line 90 of file OgreQuaternion.h.

## Member Function Documentation

Real Ogre::Quaternion::Dot | ( | const Quaternion & | rkQ | ) | const

| Definition at line 312 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z. Referenced by Slerp(), and SlerpExtraSpins().

Quaternion Ogre::Quaternion::Exp | ( |  | ) | const

| Definition at line 343 of file OgreQuaternion.cpp. References ms_fEpsilon, Ogre::Real, Ogre::Radian::valueRadians(), w, x, y, and z. Referenced by Intermediate(), and Ogre::RotationalSpline::recalcTangents().

void Ogre::Quaternion::FromAngleAxis | ( | const Radian & | rfAngle,
|  | const Vector3 & | rkAxis
| ) |

| Definition at line 119 of file OgreQuaternion.cpp. References Ogre::Real, w, Ogre::Vector3::x, x, Ogre::Vector3::y, y, Ogre::Vector3::z, and z. Referenced by Ogre::Quake3Shader::createAsMaterial(), Ogre::BspLevel::loadEntities(), Ogre::Vector3::randomDeviant(), Ogre::Node::rotate(), Ogre::Camera::rotate(), Ogre::SceneNode::setDirection(), and Ogre::Camera::setDirection().

void Ogre::Quaternion::FromAxes | ( | const Vector3 & | xAxis,
|  | const Vector3 & | yAxis,
|  | const Vector3 & | zAxis
| ) |

| Definition at line 173 of file OgreQuaternion.cpp. References FromRotationMatrix(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::Quaternion::FromAxes | ( | const Vector3 * | akAxis | ) |

| Definition at line 159 of file OgreQuaternion.cpp. References FromRotationMatrix(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. Referenced by Ogre::SceneManager::prepareShadowTextures(), Ogre::SceneNode::setDirection(), and Ogre::Camera::setDirection().

void Ogre::Quaternion::FromRotationMatrix | ( | const Matrix3 & | kRot | ) |

| Definition at line 53 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z. Referenced by FromAxes().

Radian Ogre::Quaternion::getPitch | ( | void |  | ) | const

| Calculate the local pitch element of this quaternion. Definition at line 501 of file OgreQuaternion.cpp. References w, x, y, and z.

Radian Ogre::Quaternion::getRoll | ( | void |  | ) | const

| Calculate the local roll element of this quaternion. Definition at line 496 of file OgreQuaternion.cpp. References w, x, y, and z.

Radian Ogre::Quaternion::getYaw | ( | void |  | ) | const

| Calculate the local yaw element of this quaternion. Definition at line 506 of file OgreQuaternion.cpp. References w, x, y, and z.

void Ogre::Quaternion::Intermediate | ( | const Quaternion & | rkQ0,
|  | const Quaternion & | rkQ1,
|  | const Quaternion & | rkQ2,
|  | Quaternion & | rka,
|  | Quaternion & | rkB
| ) | `[static]`

| Definition at line 461 of file OgreQuaternion.cpp. References Exp(), Log(), and UnitInverse().

Quaternion Ogre::Quaternion::Inverse | ( |  | ) | const

Definition at line 322 of file OgreQuaternion.cpp.

References Quaternion(), Ogre::Real, w, x, y, z, and ZERO.

Referenced by Ogre::ParticleSystem::_updateBounds(), Ogre::MeshManager::createCurvedIllusionPlane(), Ogre::BillboardSet::genBillboardAxes(), Ogre::Node::makeInverseTransform(), Ogre::RotationalSpline::recalcTangents(), Ogre::Node::rotate(), Ogre::SceneNode::setDirection(), and Ogre::Node::translate().

Quaternion Ogre::Quaternion::Log | ( |  | ) | const

| Definition at line 372 of file OgreQuaternion.cpp. References ms_fEpsilon, Ogre::Real, Ogre::Radian::valueRadians(), w, x, y, and z. Referenced by Intermediate(), and Ogre::RotationalSpline::recalcTangents().

Quaternion Ogre::Quaternion::nlerp | ( | Real | fT,
|  | const Quaternion & | rkP,
|  | const Quaternion & | rkQ,
|  | bool | shortestPath = false
| ) | `[static]`

| Definition at line 511 of file OgreQuaternion.cpp. References normalise(), and Ogre::Real.

Real Ogre::Quaternion::Norm | ( |  | ) | const

| Definition at line 317 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z. Referenced by normalise().

Real Ogre::Quaternion::normalise | ( | void |  | ) |

| Normalises this quaternion, and returns the previous length. Definition at line 488 of file OgreQuaternion.cpp. References Norm(), and Ogre::Real. Referenced by nlerp(), and Slerp().

Vector3 Ogre::Quaternion::operator * | ( | const Vector3 & | rkVector | ) | const

| Definition at line 402 of file OgreQuaternion.cpp. References Ogre::Vector3::crossProduct(), w, x, y, and z.

Quaternion Ogre::Quaternion::operator * | ( | Real | fScalar | ) | const

| Definition at line 296 of file OgreQuaternion.cpp. References Quaternion(), Ogre::Real, w, x, y, and z.

Quaternion Ogre::Quaternion::operator * | ( | const Quaternion & | rkQ | ) | const

| Definition at line 282 of file OgreQuaternion.cpp. References w, x, y, and z.

Quaternion Ogre::Quaternion::operator+ | ( | const Quaternion & | rkQ | ) | const

| Definition at line 272 of file OgreQuaternion.cpp. References Quaternion(), w, x, y, and z.

Quaternion Ogre::Quaternion::operator- | ( |  | ) | const

| Definition at line 307 of file OgreQuaternion.cpp. References Quaternion(), w, x, y, and z.

Quaternion Ogre::Quaternion::operator- | ( | const Quaternion & | rkQ | ) | const

| Definition at line 277 of file OgreQuaternion.cpp. References Quaternion(), w, x, y, and z.

Quaternion& Ogre::Quaternion::operator= | ( | const Quaternion & | rkQ | ) |

| Definition at line 125 of file OgreQuaternion.h. References w, x, y, and z.

bool Ogre::Quaternion::operator== | ( | const Quaternion & | rhs | ) | const

| Definition at line 140 of file OgreQuaternion.h. References w, x, y, and z.

Quaternion Ogre::Quaternion::Slerp | ( | Real | fT,
|  | const Quaternion & | rkP,
|  | const Quaternion & | rkQ,
|  | bool | shortestPath = false
| ) | `[static]`

| Definition at line 416 of file OgreQuaternion.cpp. References Dot(), ms_fEpsilon, normalise(), Ogre::Real, and Ogre::Radian::valueRadians(). Referenced by Squad().

Quaternion Ogre::Quaternion::SlerpExtraSpins | ( | Real | fT,
|  | const Quaternion & | rkP,
|  | const Quaternion & | rkQ,
|  | int | iExtraSpins
| ) | `[static]`

| Definition at line 444 of file OgreQuaternion.cpp. References Dot(), ms_fEpsilon, Ogre::Real, and Ogre::Radian::valueRadians().

Quaternion Ogre::Quaternion::Squad | ( | Real | fT,
|  | const Quaternion & | rkP,
|  | const Quaternion & | rkA,
|  | const Quaternion & | rkB,
|  | const Quaternion & | rkQ,
|  | bool | shortestPath = false
| ) | `[static]`

| Definition at line 478 of file OgreQuaternion.cpp. References Ogre::Real, and Slerp().

void Ogre::Quaternion::ToAngleAxis | ( | Degree & | dAngle,
|  | Vector3 & | rkAxis
| ) | const

| Definition at line 99 of file OgreQuaternion.h.

void Ogre::Quaternion::ToAngleAxis | ( | Radian & | rfAngle,
|  | Vector3 & | rkAxis
| ) | const

| Definition at line 135 of file OgreQuaternion.cpp. References Ogre::Real, w, Ogre::Vector3::x, x, Ogre::Vector3::y, y, Ogre::Vector3::z, and z. Referenced by Ogre::Skeleton::_dumpContents().

void Ogre::Quaternion::ToAxes | ( | Vector3 & | xAxis,
|  | Vector3 & | yAxis,
|  | Vector3 & | zAxis
| ) | const

| Definition at line 252 of file OgreQuaternion.cpp. References ToRotationMatrix(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

void Ogre::Quaternion::ToAxes | ( | Vector3 * | akAxis | ) | const

| Definition at line 193 of file OgreQuaternion.cpp. References ToRotationMatrix(), Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z. Referenced by Ogre::SceneNode::setDirection(), and Ogre::Camera::setDirection().

void Ogre::Quaternion::ToRotationMatrix | ( | Matrix3 & | kRot | ) | const

| Definition at line 93 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z. Referenced by Ogre::Node::makeInverseTransform(), Ogre::Node::makeTransform(), ToAxes(), and Ogre::Frustum::updateView().

Quaternion Ogre::Quaternion::UnitInverse | ( |  | ) | const

| Definition at line 337 of file OgreQuaternion.cpp. References Quaternion(), w, x, y, and z. Referenced by Intermediate().

Vector3 Ogre::Quaternion::xAxis | ( | void |  | ) | const

| Get the local x-axis. Definition at line 207 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z.

Vector3 Ogre::Quaternion::yAxis | ( | void |  | ) | const

| Get the local y-axis. Definition at line 222 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z.

Vector3 Ogre::Quaternion::zAxis | ( | void |  | ) | const

| Get the local z-axis. Definition at line 237 of file OgreQuaternion.cpp. References Ogre::Real, w, x, y, and z.

## Friends And Related Function Documentation

_OgreExport friend Quaternion operator * | ( | Real | fScalar,
|  | const Quaternion & | rkQ
| ) | `[friend]`

| Definition at line 301 of file OgreQuaternion.cpp.

_OgreExport friend std::ostream& operator<< | ( | std::ostream & | o,
|  | const Quaternion & | q
| ) | `[friend]`

| Function for writing to a stream. Definition at line 199 of file OgreQuaternion.h.

## Member Data Documentation

const Quaternion Ogre::Quaternion::IDENTITY`[static]`

const Real Ogre::Quaternion::ms_fEpsilon = 1e-03`[static]`

| Definition at line 48 of file OgreQuaternion.cpp. Referenced by Exp(), Log(), Slerp(), and SlerpExtraSpins().

Real Ogre::Quaternion::w

Definition at line 194 of file OgreQuaternion.h.

Referenced by Dot(), Exp(), FromAngleAxis(), FromRotationMatrix(), getPitch(), getRoll(), Ogre::Vector3::getRotationTo(), getYaw(), Inverse(), Log(), Norm(), Ogre::operator *(), operator *(), operator+(), operator-(), operator=(), operator==(), Quaternion(), Ogre::Serializer::readObject(), Ogre::Node::setOrientation(), ToAngleAxis(), ToRotationMatrix(), Ogre::StringConverter::toString(), UnitInverse(), Ogre::Serializer::writeObject(), xAxis(), yAxis(), and zAxis().

Real Ogre::Quaternion::x

Definition at line 194 of file OgreQuaternion.h.

Referenced by Dot(), Exp(), FromAngleAxis(), FromRotationMatrix(), getPitch(), getRoll(), Ogre::Vector3::getRotationTo(), getYaw(), Inverse(), Log(), Norm(), Ogre::operator *(), operator *(), operator+(), operator-(), operator=(), operator==(), Quaternion(), Ogre::Serializer::readObject(), Ogre::Node::setOrientation(), ToAngleAxis(), ToRotationMatrix(), Ogre::StringConverter::toString(), UnitInverse(), Ogre::Serializer::writeObject(), xAxis(), yAxis(), and zAxis().

Real Ogre::Quaternion::y

Definition at line 194 of file OgreQuaternion.h.

Referenced by Dot(), Exp(), FromAngleAxis(), FromRotationMatrix(), getPitch(), getRoll(), Ogre::Vector3::getRotationTo(), getYaw(), Inverse(), Log(), Norm(), Ogre::operator *(), operator *(), operator+(), operator-(), operator=(), operator==(), Quaternion(), Ogre::Serializer::readObject(), Ogre::Node::setOrientation(), ToAngleAxis(), ToRotationMatrix(), Ogre::StringConverter::toString(), UnitInverse(), Ogre::Serializer::writeObject(), xAxis(), yAxis(), and zAxis().

Real Ogre::Quaternion::z

Definition at line 194 of file OgreQuaternion.h.

Referenced by Dot(), Exp(), FromAngleAxis(), FromRotationMatrix(), getPitch(), getRoll(), Ogre::Vector3::getRotationTo(), getYaw(), Inverse(), Log(), Norm(), Ogre::operator *(), operator *(), operator+(), operator-(), operator=(), operator==(), Quaternion(), Ogre::Serializer::readObject(), Ogre::Node::setOrientation(), ToAngleAxis(), ToRotationMatrix(), Ogre::StringConverter::toString(), UnitInverse(), Ogre::Serializer::writeObject(), xAxis(), yAxis(), and zAxis().

const Quaternion Ogre::Quaternion::ZERO`[static]`

| Referenced by Inverse().

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

- OgreQuaternion.h
- OgreQuaternion.cpp

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:51:27 2004