ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Math::Quaternion Class Reference

#include <quat.h>

Inheritance diagram for Math::Quaternion:
Collaboration diagram for Math::Quaternion:

List of all members.

Public Member Functions

 Quaternion ()
 Default Constructor, creates an identity Quaternion with no rotation.
 Quaternion (float lx, float ly, float lz, float lw)
 Constructor from four floats in the order X,Y,Z,W The initial values should be normalized, otherwise call normalize() after creation.
 Quaternion (const Quaternion &q)
 Constructor from an existing Quaternion.
 Quaternion (const Vector4d &vec)
 Constructor from a vector of four floats in the order X,Y,Z,W The initial values should be normalized, otherwise call normalize() after creation.
 Quaternion (const Matrix3 &m)
 Constructor from a rotation matrix.
 Quaternion (const Matrix4 &m)
 Constructor from a rotation matrix.
void fromMatrix (const Matrix3 &m)
 Set the Quaternion from a rotation matrix.
 Quaternion (const Vector3d &axis, const Angle &angle)
 Constructor from an axis vector and the angle to rotate on that axis.
void getEuler (Angle *first, Angle *second, Angle *third, EulerOrder order) const
 Returns Euler Angles based on the Euler Order.
Quaternionnormalize ()
 Normalize the Quaternion.
void transform (Vector3d &v) const
 Rotate a vector by a Quaternion.
Matrix4 toMatrix () const
 Converts from this Quaternion to a Matrix4 representation.
void toMatrix (Matrix4 &dst) const
 Converts from this Quaternion to a Matrix4 representation.
Quaternion inverse () const
 Make a new Quaternion that's the inverse of this Quaternion.
Quaternion slerpQuat (const Quaternion &to, const float t) const
 Slerps between this quaternion and to by factor t.
Vector3d directionVector (const int col) const
 Get the direction vector specified by col.
Angle getAngleBetween (const Quaternion &to)
 Get the angle between two quaternions.
Quaternionoperator= (Vector4d &vec)
 Assignment operator for assigning a vector of values (X,Y,Z,W) to a Quaternion.
Quaternion operator* (const Quaternion &quat) const
 Multiply two Quaternions.
Quaternionoperator*= (const Quaternion &quat)
Quaternion operator* (const float c) const
 Multiply this Quaternion by a constant.
Quaternion operator+ (const Quaternion &o) const
 Sum two quaternions.
Quaternionoperator+= (const Quaternion &o)
bool operator== (const Quaternion &o) const
 Compare quaternions.
bool operator!= (const Quaternion &o) const

Static Public Member Functions

static Quaternion fromEuler (const Angle &first, const Angle &second, const Angle &third, EulerOrder order)
 Constructs a Quaternion from Euler Coordinates.
static Quaternion xAxis (const Angle &angle)
 Create a Quaternion from a rotation around the X Axis.
static Quaternion yAxis (const Angle &angle)
 Create a Quaternion from a rotation around the Y Axis.
static Quaternion zAxis (const Angle &angle)
 Create a Quaternion from a rotation around the Z Axis.

Detailed Description

Definition at line 47 of file quat.h.


Constructor & Destructor Documentation

Math::Quaternion::Quaternion (  )  [inline]

Default Constructor, creates an identity Quaternion with no rotation.

Definition at line 52 of file quat.h.

Math::Quaternion::Quaternion ( float  lx,
float  ly,
float  lz,
float  lw 
) [inline]

Constructor from four floats in the order X,Y,Z,W The initial values should be normalized, otherwise call normalize() after creation.

Parameters:
lx The X value of the Quaternion
ly The Y value of the Quaternion
lz The Z value of the Quaternion
lw The W value of the Quaternion

Definition at line 62 of file quat.h.

Math::Quaternion::Quaternion ( const Quaternion q  )  [inline]

Constructor from an existing Quaternion.

Parameters:
q The existing quaternion
Returns:
The new Quaternion

Definition at line 69 of file quat.h.

Math::Quaternion::Quaternion ( const Vector4d vec  )  [inline]

Constructor from a vector of four floats in the order X,Y,Z,W The initial values should be normalized, otherwise call normalize() after creation.

Parameters:
vec The vector of floats comprising the quaternion
Returns:
The new Quaternion

Definition at line 77 of file quat.h.

Math::Quaternion::Quaternion ( const Matrix3 m  ) 

Constructor from a rotation matrix.

Parameters:
m The rotation matrix
Returns:
The new Quaternion

Definition at line 46 of file quat.cpp.

Math::Quaternion::Quaternion ( const Matrix4 m  ) 

Constructor from a rotation matrix.

Parameters:
m The rotation matrix
Returns:
The new Quaternion

Definition at line 51 of file quat.cpp.

Math::Quaternion::Quaternion ( const Vector3d axis,
const Angle angle 
)

Constructor from an axis vector and the angle to rotate on that axis.

Parameters:
axis The axis to perform the rotation around
angle The angle amount to rotate
Returns:
The new Quaternion

Definition at line 55 of file quat.cpp.


Member Function Documentation

Vector3d Math::Quaternion::directionVector ( const int  col  )  const

Get the direction vector specified by col.

Parameters:
col Column in the rotation matrix to get the direction vector from
Returns:
The resulting Vector3d

Definition at line 205 of file quat.cpp.

Quaternion Math::Quaternion::fromEuler ( const Angle first,
const Angle second,
const Angle third,
EulerOrder  order 
) [static]

Constructs a Quaternion from Euler Coordinates.

Parameters:
first The Euler Angle for the first Axis
second The Euler Angle for the second Axis
third The Euler Angle for the third Axis
order The Euler Order, specified in Rotation3D
Returns:
The new Quaternion

Definition at line 216 of file quat.cpp.

void Math::Quaternion::fromMatrix ( const Matrix3 m  ) 

Set the Quaternion from a rotation matrix.

Parameters:
m The matrix used to set the Quaternion

Definition at line 122 of file quat.cpp.

Angle Math::Quaternion::getAngleBetween ( const Quaternion to  ) 

Get the angle between two quaternions.

Parameters:
to The quaternion we're comparing against
Returns:
The angle between the two

Definition at line 210 of file quat.cpp.

void Math::Quaternion::getEuler ( Angle first,
Angle second,
Angle third,
EulerOrder  order 
) const

Returns Euler Angles based on the Euler Order.

Parameters:
first The Euler Angle for the first Axis
second The Euler Angle for the second Axis
third The Euler Angle for the third Axis
order The Euler Order, specified in Rotation3D
Returns:
The new Quaternion

Definition at line 224 of file quat.cpp.

Quaternion Math::Quaternion::inverse (  )  const

Make a new Quaternion that's the inverse of this Quaternion.

Returns:
The resulting Quaternion

Definition at line 196 of file quat.cpp.

Quaternion & Math::Quaternion::normalize (  ) 

Normalize the Quaternion.

Returns:
A reference to this quaternion

Definition at line 107 of file quat.cpp.

bool Math::Quaternion::operator!= ( const Quaternion o  )  const

Definition at line 282 of file quat.cpp.

Quaternion Math::Quaternion::operator* ( const Quaternion quat  )  const

Multiply two Quaternions.

Parameters:
quat The Quaternion multiplicand
Returns:
The result of the multiplication

Definition at line 241 of file quat.cpp.

Quaternion Math::Quaternion::operator* ( const float  c  )  const

Multiply this Quaternion by a constant.

Parameters:
quat The Quaternion multiplicand
Returns:
The result of the multiplication

Definition at line 250 of file quat.cpp.

Quaternion & Math::Quaternion::operator*= ( const Quaternion quat  ) 

Definition at line 254 of file quat.cpp.

Quaternion Math::Quaternion::operator+ ( const Quaternion o  )  const

Sum two quaternions.

Parameters:
quat The Quaternion to be added
Returns:
The result of the addition

Definition at line 259 of file quat.cpp.

Quaternion & Math::Quaternion::operator+= ( const Quaternion o  ) 

Definition at line 263 of file quat.cpp.

Quaternion& Math::Quaternion::operator= ( Vector4d vec  ) 

Assignment operator for assigning a vector of values (X,Y,Z,W) to a Quaternion.

Parameters:
vec The source vector
Returns:
A reference to this Quaternion
bool Math::Quaternion::operator== ( const Quaternion o  )  const

Compare quaternions.

Parameters:
quat The Quaternion to be compared
Returns:
The result of the comparison

Definition at line 268 of file quat.cpp.

Quaternion Math::Quaternion::slerpQuat ( const Quaternion to,
const float  t 
) const

Slerps between this quaternion and to by factor t.

Parameters:
to the quaternion to slerp between
t factor to slerp by.
Returns:
the resulting quaternion.

Definition at line 76 of file quat.cpp.

void Math::Quaternion::toMatrix ( Matrix4 dst  )  const

Converts from this Quaternion to a Matrix4 representation.

Parameters:
dst The resulting matrix

Definition at line 167 of file quat.cpp.

Matrix4 Math::Quaternion::toMatrix (  )  const

Converts from this Quaternion to a Matrix4 representation.

Returns:
The resulting matrix

Definition at line 190 of file quat.cpp.

void Math::Quaternion::transform ( Vector3d v  )  const

Rotate a vector by a Quaternion.

Parameters:
v The Vector to be rotated

Definition at line 117 of file quat.cpp.

Quaternion Math::Quaternion::xAxis ( const Angle angle  )  [static]

Create a Quaternion from a rotation around the X Axis.

Parameters:
angle The Euler Angle for rotation
Returns:
The resulting Quaternion

Definition at line 61 of file quat.cpp.

Quaternion Math::Quaternion::yAxis ( const Angle angle  )  [static]

Create a Quaternion from a rotation around the Y Axis.

Parameters:
angle The Euler Angle for rotation
Returns:
The resulting Quaternion

Definition at line 66 of file quat.cpp.

Quaternion Math::Quaternion::zAxis ( const Angle angle  )  [static]

Create a Quaternion from a rotation around the Z Axis.

Parameters:
angle The Euler Angle for rotation
Returns:
The resulting Quaternion

Definition at line 71 of file quat.cpp.


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


Generated on Sat Nov 16 2019 05:03:25 for ResidualVM by doxygen 1.7.1
curved edge   curved edge