libalmath  2.5.11.14a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
AL::Math::Rotation Struct Reference

A 3*3 rotation matrix. More...

#include <alrotation.h>

Public Member Functions

 Rotation ()
 Create a Rotation initialized to identity. More...
 
 Rotation (const std::vector< float > &pFloats)
 Create a Rotation with an std::vector. More...
 
Rotationoperator*= (const Rotation &pRot2)
 Overloading of operator *= for Rotation. More...
 
Rotation operator* (const Rotation &pRot2) const
 Overloading of operator * for Rotation. More...
 
bool operator== (const Rotation &pRot2) const
 Overloading of operator == for Rotation. More...
 
bool operator!= (const Rotation &pRot2) const
 Overloading of operator != for Rotation. More...
 
bool isNear (const Rotation &pRot2, const float &pEpsilon=0.0001f) const
 Check if the actual Rotation is near the one give in argument. More...
 
void normalizeRotation (void)
 Normalize data, if needed, to have Rotation properties. More...
 
bool isRotation (const float &pEpsilon=0.0001f) const
 Check if the rotation is correct. The condition checks are: $R^t * R = I$ and determinant(R) = 1.0 More...
 
Rotation transpose () const
 Compute the rotation transpose (inverse) of the actual Rotation: More...
 
float determinant () const
 Compute the determinant of the Rotation: More...
 
void toVector (std::vector< float > &pReturnValue) const
 Return the Rotation as a vector of float: More...
 
std::vector< float > toVector (void) const
 

Static Public Member Functions

static Rotation fromQuaternion (const float pA, const float pB, const float pC, const float pD)
 Creates a 3*3 Rotation Matrix from a normalized quaternion ( |a + bi + cj + dk| = 1). More...
 
static Rotation fromAngleDirection (const float pAngle, const float pX, const float pY, const float pZ)
 Creates a 3*3 Rotation Matrix from a an angle and a normalized direction( |pX, pY, pZ| = 1). More...
 
static Rotation fromRotX (const float pRotX)
 Create a Rotation initialized with explicit rotation around x axis. More...
 
static Rotation fromRotXPi ()
 
static Rotation fromRotY (const float pRotY)
 Create a Rotation initialized with explicit rotation around y axis. More...
 
static Rotation fromRotYPi ()
 
static Rotation fromRotZ (const float pRotZ)
 Create a Rotation initialized with explicit rotation around z axis. More...
 
static Rotation fromRotZPi ()
 Create a Rotation initialized with rotation of pi around z axis. More...
 
static Rotation fromRotZHalfPi ()
 Create a Rotation initialized with rotation of pi/2 around z axis. More...
 
static Rotation from3DRotation (const float &pWX, const float &pWY, const float &pWZ)
 Create a Rotation initialized with euler angle. More...
 

Public Attributes

float r1_c1
 row 1 column 1. More...
 
float r1_c2
 row 1 column 2. More...
 
float r1_c3
 row 1 column 3. More...
 
float r2_c1
 row 2 column 1. More...
 
float r2_c2
 row 2 column 2. More...
 
float r2_c3
 row 2 column 3. More...
 
float r3_c1
 row 3 column 1. More...
 
float r3_c2
 row 3 column 2. More...
 
float r3_c3
 row 3 column 3. More...
 

Detailed Description

A 3*3 rotation matrix.

$ \left[\begin{array}{ccc} r_1c_1 & r_1c_2 & r_1c_3 \\ r_2c_1 & r_2c_2 & r_2c_3 \\ r_3c_1 & r_3c_2 & r_3c_3 \end{array}\right]$

more information

Definition at line 30 of file alrotation.h.

Constructor & Destructor Documentation

AL::Math::Rotation::Rotation ( )

Create a Rotation initialized to identity.

$ \left[\begin{array}{ccc} r_1c_1 & r_1c_2 & r_1c_3 \\ r_2c_1 & r_2c_2 & r_2c_3 \\ r_3c_1 & r_3c_2 & r_3c_3 \end{array}\right] = \left[\begin{array}{ccc} 1.0 & 0.0 & 0.0 \\ 0.0 & 1.0 & 0.0 \\ 0.0 & 0.0 & 1.0 \end{array}\right]$

AL::Math::Rotation::Rotation ( const std::vector< float > &  pFloats)

Create a Rotation with an std::vector.

Parameters
pFloatsAn std::vector<float> of size 9, 12 or 16 for respectively:

For std::vector<float> of size 9

$ \left[\begin{array}{cccc} r_1c_1 & r_1c_2 & r_1c_3 \\ r_2c_1 & r_2c_2 & r_2c_3 \\ r_3c_1 & r_3c_2 & r_3c_3 \end{array}\right] = \left[\begin{array}{cccc} pFloats[0] & pFloats[1] & pFloats[2] \\ pFloats[3] & pFloats[4] & pFloats[5] \\ pFloats[6] & pFloats[7] & pFloats[8] \end{array}\right]$ For std::vector<float> of size 12 or 16: $ \left[\begin{array}{cccc} r_1c_1 & r_1c_2 & r_1c_3 \\ r_2c_1 & r_2c_2 & r_2c_3 \\ r_3c_1 & r_3c_2 & r_3c_3 \end{array}\right] = \left[\begin{array}{cccc} pFloats[0] & pFloats[1] & pFloats[2] \\ pFloats[4] & pFloats[5] & pFloats[6] \\ pFloats[8] & pFloats[9] & pFloats[10] \end{array}\right]$

Member Function Documentation

float AL::Math::Rotation::determinant ( ) const

Compute the determinant of the Rotation:

$pRot.r_1c_1*pRot.r_2c_2*pRot.r_3c_3 + pRot.r_1c_2*pRot.r_2c_3*pRot.r_3c_1 + pRot.r_1c_3*pRot.r_2c_1*pRot.r_3c_2 - pRot.r_1c_1*pRot.r_2c_3*pRot.r_3c_2 - pRot.r_1c_2*pRot.r_2c_1*pRot.r_3c_3 - pRot.r_1c_3*pRot.r_2c_2*pRot.r_3c_1$

Returns
the float determinant of the Rotation
static Rotation AL::Math::Rotation::from3DRotation ( const float &  pWX,
const float &  pWY,
const float &  pWZ 
)
static

Create a Rotation initialized with euler angle.

Rot = fromRotZ(pWZ)*fromRotY(pWY)*fromRotX(pWX)

Parameters
pWXthe float value for euler angle x in radian
pWYthe float value for euler angle y in radian
pWZthe float value for euler angle z in radian
static Rotation AL::Math::Rotation::fromAngleDirection ( const float  pAngle,
const float  pX,
const float  pY,
const float  pZ 
)
static

Creates a 3*3 Rotation Matrix from a an angle and a normalized direction( |pX, pY, pZ| = 1).

Parameters
pAnglethe float value of angle in radian
pXthe X direction of the vector of the rotation
pYthe Y direction of the vector of the rotation
pZthe Z direction of the vector of the rotation
static Rotation AL::Math::Rotation::fromQuaternion ( const float  pA,
const float  pB,
const float  pC,
const float  pD 
)
static

Creates a 3*3 Rotation Matrix from a normalized quaternion ( |a + bi + cj + dk| = 1).

Parameters
pACoefficient a of the normalized quaternion
pBCoefficient b of the normalized quaternion
pCCoefficient c of the normalized quaternion
pDCoefficient d of the normalized quaternion
static Rotation AL::Math::Rotation::fromRotX ( const float  pRotX)
static

Create a Rotation initialized with explicit rotation around x axis.

$ pRot = \left[\begin{array}{cccc} 1.0 & 0.0 & 0.0 \\ 0.0 & cos(pRotX) & -sin(pRotX) \\ 0.0 & sin(pRotX) & cos(pRotX) \end{array}\right]$

Parameters
pRotXthe float value for angle rotation in radian around x axis
static Rotation AL::Math::Rotation::fromRotXPi ( )
inlinestatic

Definition at line 250 of file alrotation.h.

static Rotation AL::Math::Rotation::fromRotY ( const float  pRotY)
static

Create a Rotation initialized with explicit rotation around y axis.

$ pT = \left[\begin{array}{cccc} cos(pRotY) & 0.0 & sin(pRotY) \\ 0.0 & 1.0 & 0.0 \\ -sin(pRotY) & 0.0 & cos(pRotY) \end{array}\right]$

Parameters
pRotYthe float value for angle rotation in radian around y axis
static Rotation AL::Math::Rotation::fromRotYPi ( )
inlinestatic

Definition at line 270 of file alrotation.h.

static Rotation AL::Math::Rotation::fromRotZ ( const float  pRotZ)
static

Create a Rotation initialized with explicit rotation around z axis.

$ pT = \left[\begin{array}{cccc} cos(pRotZ) & -sin(pRotZ) & 0.0 \\ sin(pRotZ) & cos(pRotZ) & 0.0 \\ 0.0 & 0.0 & 1.0 \end{array}\right]$

Parameters
pRotZthe float value for angle rotation in radian around z axis
static Rotation AL::Math::Rotation::fromRotZHalfPi ( )
inlinestatic

Create a Rotation initialized with rotation of pi/2 around z axis.

Definition at line 303 of file alrotation.h.

static Rotation AL::Math::Rotation::fromRotZPi ( )
inlinestatic

Create a Rotation initialized with rotation of pi around z axis.

Definition at line 293 of file alrotation.h.

bool AL::Math::Rotation::isNear ( const Rotation pRot2,
const float &  pEpsilon = 0.0001f 
) const

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

Parameters
pRot2the second Rotation
pEpsilonan optionnal epsilon distance: default: 0.0001
Returns
true if the distance between the two rotations is less than pEpsilon
bool AL::Math::Rotation::isRotation ( const float &  pEpsilon = 0.0001f) const

Check if the rotation is correct. The condition checks are: $R^t * R = I$ and determinant(R) = 1.0

Parameters
pEpsilonan optionnal epsilon distance. Default: 0.0001
Returns
true if the Rotation is correct
void AL::Math::Rotation::normalizeRotation ( void  )

Normalize data, if needed, to have Rotation properties.

bool AL::Math::Rotation::operator!= ( const Rotation pRot2) const

Overloading of operator != for Rotation.

Parameters
pRot2the second Rotation
Rotation AL::Math::Rotation::operator* ( const Rotation pRot2) const

Overloading of operator * for Rotation.

Parameters
pRot2the second Rotation
Rotation& AL::Math::Rotation::operator*= ( const Rotation pRot2)

Overloading of operator *= for Rotation.

Parameters
pRot2the second Rotation
bool AL::Math::Rotation::operator== ( const Rotation pRot2) const

Overloading of operator == for Rotation.

Parameters
pRot2the second Rotation
void AL::Math::Rotation::toVector ( std::vector< float > &  pReturnValue) const

Return the Rotation as a vector of float:

$ \begin{array}{cccc} [r_1c_1, & r_1c_2, & r_1c_3, \\ r_2c_1, & r_2c_2, & r_2c_3, \\ r_3c_1, & r_3c_2, & r_3c_3] \end{array}$

std::vector<float> AL::Math::Rotation::toVector ( void  ) const
Rotation AL::Math::Rotation::transpose ( ) const

Compute the rotation transpose (inverse) of the actual Rotation:

Returns
the Rotation transpose

Member Data Documentation

float AL::Math::Rotation::r1_c1

row 1 column 1.

Definition at line 35 of file alrotation.h.

float AL::Math::Rotation::r1_c2

row 1 column 2.

Definition at line 39 of file alrotation.h.

float AL::Math::Rotation::r1_c3

row 1 column 3.

Definition at line 43 of file alrotation.h.

float AL::Math::Rotation::r2_c1

row 2 column 1.

Definition at line 47 of file alrotation.h.

float AL::Math::Rotation::r2_c2

row 2 column 2.

Definition at line 51 of file alrotation.h.

float AL::Math::Rotation::r2_c3

row 2 column 3.

Definition at line 55 of file alrotation.h.

float AL::Math::Rotation::r3_c1

row 3 column 1.

Definition at line 59 of file alrotation.h.

float AL::Math::Rotation::r3_c2

row 3 column 2.

Definition at line 63 of file alrotation.h.

float AL::Math::Rotation::r3_c3

row 3 column 3.

Definition at line 67 of file alrotation.h.


The documentation for this struct was generated from the following file: