HatchitMath
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Hatchit::Math::Quaternion Class Reference

Public Member Functions

 Quaternion (const float rawArray[])
 
 Quaternion (const Vector3 &axis, float angle)
 
 Quaternion (float x, float y, float z, float w)
 
 Quaternion (float roll, float pitch, float yaw)
 
 Quaternion (__m128 quatData)
 
void * operator new (size_t _size)
 
void operator delete (void *p)
 
void * operator new[] (size_t size)
 
void operator delete[] (void *p)
 
bool operator== (const Quaternion &p_rhs) const
 Compares the values of this Quaternion to another given Quaternion. More...
 
bool operator!= (const Quaternion &p_rhs) const
 Compares the values of this Quaternion to another given Quaternion. More...
 
Quaternion operator+ (const Quaternion &p_rhs) const
 Adds the components of this Quaternion to another given Quaternion. More...
 
Quaternion operator- (const Quaternion &p_rhs) const
 Subtracts the components of this Quaternion with another given Quaternion. More...
 
Quaternion operator* (const Quaternion &p_rhs) const
 Multiplies the quaternion with another Quaternion using the Hamilton Product. More...
 
Quaternionoperator+= (const Quaternion &p_rhs)
 Adds the components of the other quaternion into this quaternion. More...
 
Quaternionoperator-= (const Quaternion &p_rhs)
 Subtracts the components of the other quaternion from this quaternion. More...
 
Quaternionoperator*= (const Quaternion &p_rhs)
 Multiplies the two given quaternions using the Hamilton Product and stores the results back into the first Quaternion. More...
 
 operator __m128 () const
 Returns copy of internal __m128 structure. More...
 
Float4 ToFloat4 () const
 Stores values of Quaternion into Float4 type. More...
 
 Quaternion ()
 Creates an identity Quaterion with elements 1,0,0,0.
 
 Quaternion (float *m_vector)
 creates a quaternion from a pointer to an array of 4 floats
 
 Quaternion (float w, float x, float y, float z)
 Creates a Quaterion with elements set to the given values. More...
 
 Quaternion (Vector3 v)
 Creates a Quaternion based off the Euler rotation described by a Vector3. More...
 
 Quaternion (Vector4 v)
 Creates a Quaterion based on the Angle-Axis rotation described by a Vector4 where x,y,z is the axis and w is the angle. More...
 
Quaternion getInverse ()
 Returns an Quaterion that is the inverse of this one. More...
 
Vector4 getAxisAngle ()
 Returns this Quaterion's rotation in Angle-Axis form with a Vector4. More...
 
Matrix4 getRotationMatrix ()
 Returns this Quaterion's rotation in Matrix form. More...
 
Quaternion operator* (Quaternion other)
 Multiplies this quaterion with another and returns the product. More...
 
void normalize ()
 

Static Public Member Functions

static Quaternion getQuaternionIdentity ()
 Returns an identity Quaterion with the elements 1,0,0,0. More...
 

Public Attributes

union {
   __m128   m_quaternion
 
   struct {
      float   x
 
      float   y
 
      float   z
 
      float   w
 
   } 
 
   float   m_data [4]
 
}; 
 
union {
   __m128   m_vector
 
   struct {
      float   w
 
      float   x
 
      float   y
 
      float   z
 
   } 
 
   float   data [4]
 
}; 
 

Constructor & Destructor Documentation

Hatchit::Math::Quaternion::Quaternion ( float  w,
float  x,
float  y,
float  z 
)

Creates a Quaterion with elements set to the given values.

Parameters
xThe first element
yThe second element
zThe third element
wThe fourth element
Quaternion::Quaternion ( Vector3  v)

Creates a Quaternion based off the Euler rotation described by a Vector3.

Parameters
vThe Vector3 used to describe a Euler rotation
Quaternion::Quaternion ( Vector4  v)

Creates a Quaterion based on the Angle-Axis rotation described by a Vector4 where x,y,z is the axis and w is the angle.

Parameters
vThe Vector4 used to describe an Angle-Axis rotation

Member Function Documentation

Vector4 Quaternion::getAxisAngle ( )

Returns this Quaterion's rotation in Angle-Axis form with a Vector4.

Returns
The rotation described by this Quaterion in Angle-Axis form
Quaternion Quaternion::getInverse ( )

Returns an Quaterion that is the inverse of this one.

Returns
The inverse of this Quaterion
Quaternion Quaternion::getQuaternionIdentity ( )
static

Returns an identity Quaterion with the elements 1,0,0,0.

Returns
An identity Quaterion
Matrix4 Quaternion::getRotationMatrix ( )

Returns this Quaterion's rotation in Matrix form.

Returns
The rotation described by this quaterion in Matrix3 form
Quaternion::operator __m128 ( ) const
inlineexplicit

Returns copy of internal __m128 structure.

Returns
Copy of internal __m128 structure.
bool Quaternion::operator!= ( const Quaternion p_rhs) const
inline

Compares the values of this Quaternion to another given Quaternion.

Parameters
p_rhsThe Other Quaternion
Returns
True if this Quaternion does not have the same values of the other Quaternion
Quaternion Quaternion::operator* ( Quaternion  other)

Multiplies this quaterion with another and returns the product.

Parameters
otherThe other quaternion to multiply into this one
Returns
The product of this quaterion multiplied by the other one
Quaternion Quaternion::operator* ( const Quaternion p_rhs) const
inline

Multiplies the quaternion with another Quaternion using the Hamilton Product.

Parameters
p_rhsThe other Quaternion
Returns
Quaternion result of the Hamilton product of the two quaternions.
Quaternion & Quaternion::operator*= ( const Quaternion p_rhs)
inline

Multiplies the two given quaternions using the Hamilton Product and stores the results back into the first Quaternion.

Parameters
p_rhsThe other Quaternion
Returns
Reference to modified quaternion
Quaternion Quaternion::operator+ ( const Quaternion p_rhs) const
inline

Adds the components of this Quaternion to another given Quaternion.

Parameters
p_rhsThe other Quaternion
Returns
Quaternion with components summed (w = w1 + w2, ...)
Quaternion & Quaternion::operator+= ( const Quaternion p_rhs)
inline

Adds the components of the other quaternion into this quaternion.

Parameters
p_rhsThe other Quaternion
Returns
Reference to modified quaternion
Quaternion Quaternion::operator- ( const Quaternion p_rhs) const
inline

Subtracts the components of this Quaternion with another given Quaternion.

Parameters
p_rhsThe other Quaternion
Returns
Quaternion with components subtracted (w = w1 - w2, ...)
Quaternion & Quaternion::operator-= ( const Quaternion p_rhs)
inline

Subtracts the components of the other quaternion from this quaternion.

Parameters
p_rhsThe other Quaternion
Returns
Reference to modified quaternion
bool Quaternion::operator== ( const Quaternion p_rhs) const
inline

Compares the values of this Quaternion to another given Quaternion.

Parameters
p_rhsThe other Quaternion
Returns
True if this Quaternion has the same values of the other Quaternion
Float4 Quaternion::ToFloat4 ( ) const
inline

Stores values of Quaternion into Float4 type.

Returns
Float4 poplulated with Quaternion data

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