libalmath  1.14.5
 All Classes Namespaces Functions Variables
Public Member Functions | Static Public Member Functions | Public Attributes
AL::Math::Quaternion Struct Reference

Create and play with a Quaternion. More...

#include <alquaternion.h>

List of all members.

Public Member Functions

 Quaternion ()
 Create a Quaternion initialize with 0.0f.
 Quaternion (float pW, float pX, float pY, float pZ)
 Create a Quaternion initialize with explicit value.
 Quaternion (const std::vector< float > &pFloats)
 Create a Quaternion with an std::vector.
Quaternionoperator*= (const Quaternion &pQu2)
 Overloading of operator *= for Quaternion.
Quaternion operator* (const Quaternion &pQua2) const
 Overloading of operator * for Quaternion.
bool operator== (const Quaternion &pQua2) const
 Overloading of operator == for Quaternion.
bool operator!= (const Quaternion &pQua2) const
 Overloading of operator != for Quaternion.
Quaternionoperator*= (float pVal)
 Overloading of operator *= for Quaternion.
Quaternionoperator/= (float pVal)
 Overloading of operator /= for Quaternion.
bool isNear (const Quaternion &pQua2, const float &pEpsilon=0.0001f) const
 Check if the actual Quaternion is near the one give in argument.
float norm () const
 Compute the norm of the actual Quaternion.
Quaternion normalize () const
 Normalize the actual Quaterion.
Quaternion inverse () const
 Compute the quaternion inverse of the actual Quaternion.
std::vector< float > toVector () const
 Return the Quaternion as a vector of float [w, x, y, z].

Static Public Member Functions

static Quaternion fromAngleAndAxisRotation (const float pAngle, const float pAxisX, const float pAxisY, const float pAxisZ)
 Create a Quaternion initialized with explicit angle and axis rotation.

Public Attributes

float w
float x
float y
float z

Detailed Description

Create and play with a Quaternion.

A Quaternion is just defined by w, x, y and z.

Definition at line 23 of file alquaternion.h.


Constructor & Destructor Documentation

Create a Quaternion initialize with 0.0f.

$ \left[\begin{array}{c} w \\ x \\ y \\ z \end{array}\right] = \left[\begin{array}{c} 0.0 \\ 0.0 \\ 0.0 \\ 0.0 \end{array}\right]$

AL::Math::Quaternion::Quaternion ( float  pW,
float  pX,
float  pY,
float  pZ 
)

Create a Quaternion initialize with explicit value.

$ \left[\begin{array}{c} w \\ x \\ y \\ z \end{array}\right] = \left[\begin{array}{c} pW \\ pX \\ pY \\ pZ \end{array}\right]$

Parameters:
pWthe float value for w
pXthe float value for x
pYthe float value for y
pZthe float value for z
AL::Math::Quaternion::Quaternion ( const std::vector< float > &  pFloats)

Create a Quaternion with an std::vector.

$ \left[\begin{array}{c} w \\ x \\ y \\ z \end{array}\right] = \left[\begin{array}{c} pFloats[0] \\ pFloats[1] \\ pFloats[2] \\ pFloats[3] \end{array}\right]$

Parameters:
pFloatsAn std::vector<float> of size 4 for respectively: w, x, y and z

Member Function Documentation

static Quaternion AL::Math::Quaternion::fromAngleAndAxisRotation ( const float  pAngle,
const float  pAxisX,
const float  pAxisY,
const float  pAxisZ 
) [static]

Create a Quaternion initialized with explicit angle and axis rotation.

Parameters:
pAnglethe float value for angle in radian around axis rotation
pAxisXthe float value for x value of axis rotation
pAxisYthe float value for y value of axis rotation
pAxisZthe float value for z value of axis rotation

Compute the quaternion inverse of the actual Quaternion.

Returns:
the Quaternion inverse
bool AL::Math::Quaternion::isNear ( const Quaternion pQua2,
const float &  pEpsilon = 0.0001f 
) const

Check if the actual Quaternion is near the one give in argument.

Parameters:
pQua2the second Quaternion
pEpsilonan optionnal epsilon distance
Returns:
true if the distance between the two Quaternion is less than pEpsilon Check if |Qua1+Qua2| < epsilon or |Qua1-Qua2| < epsilon
float AL::Math::Quaternion::norm ( ) const

Compute the norm of the actual Quaternion.

$\sqrt{pQua.w^2+pQua.x^2+pQua.y^2+pQua.z^2}$

Returns:
the float norm of the Quaternion

Normalize the actual Quaterion.

$result = \frac{pQua}{norm(pQua)}$

Returns:
the Quaternion normalized
bool AL::Math::Quaternion::operator!= ( const Quaternion pQua2) const

Overloading of operator != for Quaternion.

Parameters:
pQua2the second Quaternion
Quaternion AL::Math::Quaternion::operator* ( const Quaternion pQua2) const

Overloading of operator * for Quaternion.

Parameters:
pQua2the second Quaternion
Quaternion& AL::Math::Quaternion::operator*= ( const Quaternion pQu2)

Overloading of operator *= for Quaternion.

Parameters:
pQua2the second Quaternion
Quaternion& AL::Math::Quaternion::operator*= ( float  pVal)

Overloading of operator *= for Quaternion.

Parameters:
pValthe float factor
Quaternion& AL::Math::Quaternion::operator/= ( float  pVal)

Overloading of operator /= for Quaternion.

Parameters:
pValthe float factor
bool AL::Math::Quaternion::operator== ( const Quaternion pQua2) const

Overloading of operator == for Quaternion.

Parameters:
pQua2the second Quaternion
std::vector<float> AL::Math::Quaternion::toVector ( ) const

Return the Quaternion as a vector of float [w, x, y, z].


Member Data Documentation

Definition at line 25 of file alquaternion.h.

Definition at line 27 of file alquaternion.h.

Definition at line 29 of file alquaternion.h.

Definition at line 31 of file alquaternion.h.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables