MezzanineEngine March 18, 2012

Mezzanine::Quaternion Class Reference

This is used to store information about rotation in 3d space. More...

#include <quaternion.h>

List of all members.

Public Member Functions

 Quaternion ()
 Blank Constructor.
 Quaternion (const Real &X, const Real &Y, const Real &Z, const Real &W)
 Constructor.
 Quaternion (const Matrix3x3 &Mat)
 Rotation Matrix Constructor.
 Quaternion (const Mezzanine::Quaternion &Other)
 Copy Constructor.
 Quaternion (const Vector3 &AxisX, const Vector3 &AxisY, const Vector3 &AxisZ)
 Axes Constructor.
 Quaternion (const Real &Angle, const Vector3 &Axis)
 Axis and Rotation Constructor.
 Quaternion (const btQuaternion &Theirs)
 Bullet Quaternion constructor.
 Quaternion (const Ogre::Quaternion &Theirs)
 Ogre Quaternion constructor.
Real DotProduct (const Quaternion &Other) const
 Gets the Dot Product of this quaternion and another quaternion.
void ExtractBulletQuaternion (const btQuaternion &Ours)
 Copies an existing Bullet quaternion.
void ExtractOgreQuaternion (const Ogre::Quaternion &Ours)
 Copies an existing Ogre quaternion.
btQuaternion GetBulletQuaternion (bool normalize=false) const
 Gets a Bullet quaternion.
Quaternion GetInverse () const
 Inverses this Quaternion.
Quaternion GetNormalizedCopy () const
 Get a normalized copy of this Quaternion without changing this one.
Ogre::Quaternion GetOgreQuaternion (bool normalize=false) const
 Gets a Ogre quaternion.
Real Length () const
 Gets the length of the quaternion.
Real LengthSqrd () const
 Gets the squared length(len^2) of the quaternion.
QuaternionNormalize ()
 Normalizes this Quaternion.
Quaternion operator* (const Mezzanine::Quaternion &Other) const
 Multiplication operator with Mezzanine::Quaternion and Mezzanine::Quaternion.
Quaternion operator* (const Ogre::Quaternion &Other) const
 Multiplication operator with Mezzanine::Quaternion and Ogre::Quaternion.
Quaternion operator* (const btQuaternion &Other) const
 Multiplication operator with Mezzanine::Quaternion and btQuaternion.
Vector3 operator* (const Vector3 &Other) const
 Rotates a vector by the provided quaternion.
Quaternion operator* (const Real &Scalar) const
 Scaling by multiplication.
Quaternion operator+ (const Mezzanine::Quaternion &Other) const
 Addition operator with Mezzanine::Quaternion and Mezzanine::Quaternion.
Quaternion operator+ (const Ogre::Quaternion &Other) const
 Addition operator with Mezzanine::Quaternion and Ogre::Quaternion.
Quaternion operator+ (const btQuaternion &Other) const
 Addition operator with Mezzanine::Quaternion and btQuaternion.
Quaternionoperator+= (const Mezzanine::Quaternion &Other)
 Incrementing operator with Mezzanine::Quaternion and Mezzanine::Quaternion.
Quaternionoperator+= (const Ogre::Quaternion &Other)
 Incrementing operator with Mezzanine::Quaternion and Ogre::Quaternion.
Quaternionoperator+= (const btQuaternion &Other)
 Incrementing operator with Mezzanine::Quaternion and btQuaternion.
Quaternion operator- (const Mezzanine::Quaternion &Other) const
 Subtraction operator with Mezzanine::Quaternion and Mezzanine::Quaternion.
Quaternion operator- (const Ogre::Quaternion &Other) const
 Subtraction operator with Mezzanine::Quaternion and Ogre::Quaternion.
Quaternion operator- (const btQuaternion &Other) const
 Subtraction operator with Mezzanine::Quaternion and btQuaternion.
Quaternionoperator-= (const btQuaternion &Other)
 Decrementing operator with Mezzanine::Quaternion and btQuaternion.
Quaternionoperator-= (const Ogre::Quaternion &Other)
 Decrementing operator with Mezzanine::Quaternion and Ogre::Quaternion.
Quaternionoperator-= (const Mezzanine::Quaternion &Other)
 Decrementing operator with Mezzanine::Quaternion and Mezzanine::Quaternion.
Quaternion operator/ (const Real &Scalar) const
 Scaling by division.
Quaternionoperator= (const btQuaternion &Other)
 Assignment Operator from btQuaternion.
Quaternionoperator= (const Mezzanine::Quaternion &Other)
 Assignment Operator from Mezzanine::Quaternion.
Quaternionoperator= (const Ogre::Quaternion &Other)
 Assignment Operator from Ogre::Quaternion.
bool operator== (const btQuaternion &Other) const
 Equality Comparison Operator from btQuaternion.
bool operator== (const Ogre::Quaternion &Other) const
 Equality Comparison Operator from Ogre::Quaternion.
bool operator== (const Mezzanine::Quaternion &Other) const
 Equality Comparison Operator from Mezzanine::Quaternion.
Real operator[] (const Whole &Index) const
 Allows Array style access to the members of this class.
Realoperator[] (const Whole &Index)
 Allows Array style access to the members of this class.
virtual void ProtoDeSerialize (const xml::Node &OneNode)
 Take the data stored in an XML and overwrite this instance of this object with it.
virtual void ProtoSerialize (xml::Node &CurrentRoot) const
 Convert this class to an xml::Node ready for serialization.
void SetFromAxes (const Vector3 &AxisX, const Vector3 &AxisY, const Vector3 &AxisZ)
 Generates and sets the values of this quaternion from 3 Axis vectors.
void SetFromAxisAngle (const Real &Angle, const Vector3 &Axis)
 Generates and sets the values of this quaternion to a rotation from an axis and angle on that axis.
void SetFromMatrix3x3 (const Matrix3x3 &Mat)
 Sets this quaternions values to express the same rotation as a Matrix3x3.
void SetIdentity ()
 Sets default/identity values to the members of this quaternion.
void SetValues (const Real &X, const Real &Y, const Real &Z, const Real &W)
 Sets the individual values of this quaterion directly.

Static Public Member Functions

static String SerializableName ()
 Get the name of the the XML tag this class will leave behind as its instances are serialized.

Public Attributes

Real W
 Rotation on the Axis X, Y and Z defined.
Real X
 The X component of the Axis.
Real Y
 The Y component of the Axis.
Real Z
 The Z component of the Axis.

Detailed Description

This is used to store information about rotation in 3d space.

This is used to store information about rotation in 3d space. The X, Y and Z are used to identify a ray from the origin (0,0,0), about which W represents an amount of rotation.

Definition at line 64 of file quaternion.h.


Constructor & Destructor Documentation

Mezzanine::Quaternion::Quaternion ( )

Blank Constructor.

Basic no-initialization constructor.

Definition at line 61 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Real X,
const Real Y,
const Real Z,
const Real W 
)

Constructor.

Constructor that sets all four axis' of rotation.

Parameters:
XThe X component of the Axis.
YThe Y component of the Axis.
ZThe Z component of the Axis.
WRotation on the Axis X, Y and Z defined.

Definition at line 64 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Real Angle,
const Vector3 Axis 
)

Axis and Rotation Constructor.

This assembles a quaternion based on an axis and a rotation in radians.

Parameters:
AngleReal representing the angle to be applied along the axis in radians.
AxisVector3 representing the axis to apply the rotation.

Definition at line 67 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Matrix3x3 Mat)

Rotation Matrix Constructor.

Parameters:
MatThe matrix to set this quaternion from.

Definition at line 70 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Vector3 AxisX,
const Vector3 AxisY,
const Vector3 AxisZ 
)

Axes Constructor.

Parameters:
AxisXThe vector expressing the X axis.
AxisYThe vector expressing the Y axis.
AxisZThe vector expressing the Z axis.

Definition at line 73 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const btQuaternion &  Theirs) [explicit]

Bullet Quaternion constructor.

Constructor that sets all values to match the Bullet quaternion.

Parameters:
TheirsThe quaternion to be copied to make this quaternion.

Definition at line 76 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Ogre::Quaternion &  Theirs) [explicit]

Ogre Quaternion constructor.

Constructor that sets all values to match the Ogre quaternion.

Parameters:
TheirsThe quaternion to be copied to make this quaternion.

Definition at line 79 of file quaternion.cpp.

Mezzanine::Quaternion::Quaternion ( const Mezzanine::Quaternion Other)

Copy Constructor.

Parameters:
OtherThe Quaternion to copy.

Definition at line 82 of file quaternion.cpp.


Member Function Documentation

Real Mezzanine::Quaternion::DotProduct ( const Quaternion Other) const

Gets the Dot Product of this quaternion and another quaternion.

Parameters:
OtherThe other quaternion to calculate the dot product from.
Returns:
Returns a Real that is the Dot Product of the two quaternions.

Definition at line 169 of file quaternion.cpp.

void Mezzanine::Quaternion::ExtractBulletQuaternion ( const btQuaternion &  Ours)

Copies an existing Bullet quaternion.

This function will copy the values stored in an existing Bullet quaternion and set the values of this class to be the same.

Parameters:
OursThe quaternion to be extracted.

Definition at line 221 of file quaternion.cpp.

void Mezzanine::Quaternion::ExtractOgreQuaternion ( const Ogre::Quaternion &  Ours)

Copies an existing Ogre quaternion.

This function will copy the values stored in an existing Ogre quaternion and set the values of this class to be the same.

Parameters:
OursThe quaternion to be extracted.

Definition at line 241 of file quaternion.cpp.

btQuaternion Mezzanine::Quaternion::GetBulletQuaternion ( bool  normalize = false) const

Gets a Bullet quaternion.

Creates a Bullet quaternion with values equal to this class and returns it.

Parameters:
normalizeWhether or not you want this function to normalize the quaternion for you.
Returns:
A btQuaternion that has the same contents as this Mezzanine::Quaternion.

Definition at line 209 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::GetInverse ( ) const

Inverses this Quaternion.

Returns:
Returns a quaternion that is a copy of this one after it has been inversed.

Definition at line 194 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::GetNormalizedCopy ( ) const

Get a normalized copy of this Quaternion without changing this one.

Returns:
A Copy of this Quaternion after the copy has been normalized.

Definition at line 190 of file quaternion.cpp.

Ogre::Quaternion Mezzanine::Quaternion::GetOgreQuaternion ( bool  normalize = false) const

Gets a Ogre quaternion.

Creates a Ogre quaternion with values equal to this class and returns it.

Parameters:
normalizeWhether or not you want this function to normalize the quaternion for you.

Definition at line 229 of file quaternion.cpp.

Real Mezzanine::Quaternion::Length ( ) const

Gets the length of the quaternion.

Returns:
Returns a Real representing the length of the quaternion.

Definition at line 174 of file quaternion.cpp.

Real Mezzanine::Quaternion::LengthSqrd ( ) const

Gets the squared length(len^2) of the quaternion.

Returns:
Returns a Real representing the squared length(len^2) of the quaternion.

Definition at line 179 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::Normalize ( )

Normalizes this Quaternion.

Returns:
Returns a normalized reference of this quaternion.

Definition at line 184 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator* ( const Real Scalar) const

Scaling by multiplication.

Parameters:
ScalarThis is the amount to scale the quaternion by.
Returns:
Returns a scaled quaternion.

Definition at line 281 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator* ( const Mezzanine::Quaternion Other) const

Multiplication operator with Mezzanine::Quaternion and Mezzanine::Quaternion.

Parameters:
OtherThe other Quaternion to multiply from this one.
Returns:
A Mezzanine::Quaternion with the result.

Definition at line 314 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator* ( const Ogre::Quaternion &  Other) const

Multiplication operator with Mezzanine::Quaternion and Ogre::Quaternion.

Parameters:
OtherThe other Quaternion to multiply from this one.
Returns:
A Mezzanine::Quaternion with the result.

Definition at line 325 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator* ( const btQuaternion &  Other) const

Multiplication operator with Mezzanine::Quaternion and btQuaternion.

Parameters:
OtherThe other Quaternion to multiply from this one.
Returns:
A Mezzanine::Quaternion with the result.

Definition at line 336 of file quaternion.cpp.

Vector3 Mezzanine::Quaternion::operator* ( const Vector3 Other) const

Rotates a vector by the provided quaternion.

Parameters:
OtherThe vector to rotate.
Returns:
Returns a rotated version of the provided vector.

Definition at line 350 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator+ ( const Mezzanine::Quaternion Other) const

Addition operator with Mezzanine::Quaternion and Mezzanine::Quaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
A Mezzanine::Quaternion with the sum.

Definition at line 296 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator+ ( const Ogre::Quaternion &  Other) const

Addition operator with Mezzanine::Quaternion and Ogre::Quaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
A Mezzanine::Quaternion with the sum.

Definition at line 299 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator+ ( const btQuaternion &  Other) const

Addition operator with Mezzanine::Quaternion and btQuaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
A Mezzanine::Quaternion with the sum.

Definition at line 302 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator+= ( const btQuaternion &  Other)

Incrementing operator with Mezzanine::Quaternion and btQuaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
This Mezzanine::Quaternion with the sum.

Definition at line 382 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator+= ( const Mezzanine::Quaternion Other)

Incrementing operator with Mezzanine::Quaternion and Mezzanine::Quaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
This Mezzanine::Quaternion with the sum.

Definition at line 364 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator+= ( const Ogre::Quaternion &  Other)

Incrementing operator with Mezzanine::Quaternion and Ogre::Quaternion.

Parameters:
OtherThe other Quaternion to add to this one.
Returns:
This Mezzanine::Quaternion with the sum.

Definition at line 373 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator- ( const Mezzanine::Quaternion Other) const

Subtraction operator with Mezzanine::Quaternion and Mezzanine::Quaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
A Mezzanine::Quaternion with the difference.

Definition at line 305 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator- ( const Ogre::Quaternion &  Other) const

Subtraction operator with Mezzanine::Quaternion and Ogre::Quaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
A Mezzanine::Quaternion with the difference.

Definition at line 308 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator- ( const btQuaternion &  Other) const

Subtraction operator with Mezzanine::Quaternion and btQuaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
A Mezzanine::Quaternion with the difference.

Definition at line 311 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator-= ( const Mezzanine::Quaternion Other)

Decrementing operator with Mezzanine::Quaternion and Mezzanine::Quaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
This Mezzanine::Quaternion with the difference.

Definition at line 391 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator-= ( const Ogre::Quaternion &  Other)

Decrementing operator with Mezzanine::Quaternion and Ogre::Quaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
This Mezzanine::Quaternion with the difference.

Definition at line 400 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator-= ( const btQuaternion &  Other)

Decrementing operator with Mezzanine::Quaternion and btQuaternion.

Parameters:
OtherThe other Quaternion to subtract from this one.
Returns:
This Mezzanine::Quaternion with the difference.

Definition at line 409 of file quaternion.cpp.

Quaternion Mezzanine::Quaternion::operator/ ( const Real Scalar) const

Scaling by division.

Parameters:
ScalarThis is the amount to scale the quaternion by.
Returns:
Returns a scaled quaternion.

Definition at line 286 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator= ( const Ogre::Quaternion &  Other)

Assignment Operator from Ogre::Quaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
This Quaternion after being assigned fresh values.

Definition at line 434 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator= ( const Mezzanine::Quaternion Other)

Assignment Operator from Mezzanine::Quaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
This Quaternion after being assigned fresh values.

Definition at line 420 of file quaternion.cpp.

Quaternion & Mezzanine::Quaternion::operator= ( const btQuaternion &  Other)

Assignment Operator from btQuaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
This Quaternion after being assigned fresh values.

Definition at line 428 of file quaternion.cpp.

bool Mezzanine::Quaternion::operator== ( const Ogre::Quaternion &  Other) const

Equality Comparison Operator from Ogre::Quaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
True if the Quaternions are semantically equal, false otherwise.

Definition at line 446 of file quaternion.cpp.

bool Mezzanine::Quaternion::operator== ( const Mezzanine::Quaternion Other) const

Equality Comparison Operator from Mezzanine::Quaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
True if the Quaternions are semantically equal, false otherwise.

Definition at line 443 of file quaternion.cpp.

bool Mezzanine::Quaternion::operator== ( const btQuaternion &  Other) const

Equality Comparison Operator from btQuaternion.

Parameters:
OtherThe other quaternion to overwrite this one.
Returns:
True if the Quaternions are semantically equal, false otherwise.

Definition at line 449 of file quaternion.cpp.

Real Mezzanine::Quaternion::operator[] ( const Whole Index) const

Allows Array style access to the members of this class.

Parameters:
IndexThe number corresponding to the Index you want. 0 = X, 1 = Y, 2 = Z, 3 = W.
Returns:
Returns a copy of the number at the index requested.

Definition at line 252 of file quaternion.cpp.

Real & Mezzanine::Quaternion::operator[] ( const Whole Index)

Allows Array style access to the members of this class.

Parameters:
IndexThe number corresponding to the Index you want. 0 = X, 1 = Y, 2 = Z, 3 = W.
Returns:
Returns a writable reference to the number at the index requested.

Definition at line 265 of file quaternion.cpp.

void Mezzanine::Quaternion::ProtoDeSerialize ( const xml::Node OneNode) [virtual]

Take the data stored in an XML and overwrite this instance of this object with it.

Parameters:
OneNodeand xml::Node containing the data.

Definition at line 478 of file quaternion.cpp.

void Mezzanine::Quaternion::ProtoSerialize ( xml::Node CurrentRoot) const [virtual]

Convert this class to an xml::Node ready for serialization.

Parameters:
CurrentRootThe point in the XML hierarchy that all this quaternion should be appended to.

Definition at line 454 of file quaternion.cpp.

String Mezzanine::Quaternion::SerializableName ( ) [static]

Get the name of the the XML tag this class will leave behind as its instances are serialized.

Returns:
A string containing "Quaternion"

Definition at line 496 of file quaternion.cpp.

void Mezzanine::Quaternion::SetFromAxes ( const Vector3 AxisX,
const Vector3 AxisY,
const Vector3 AxisZ 
)

Generates and sets the values of this quaternion from 3 Axis vectors.

Parameters:
AxisXThe vector expressing the X axis.
AxisYThe vector expressing the Y axis.
AxisZThe vector expressing the Z axis.

Definition at line 152 of file quaternion.cpp.

void Mezzanine::Quaternion::SetFromAxisAngle ( const Real Angle,
const Vector3 Axis 
)

Generates and sets the values of this quaternion to a rotation from an axis and angle on that axis.

Parameters:
AngleReal representing the angle to be applied along the axis in radians.
AxisVector3 representing the axis to apply the rotation.

Definition at line 109 of file quaternion.cpp.

void Mezzanine::Quaternion::SetFromMatrix3x3 ( const Matrix3x3 Mat)

Sets this quaternions values to express the same rotation as a Matrix3x3.

Parameters:
MatThe matrix to set this quaternion from.

Definition at line 119 of file quaternion.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines