Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cQuaternionf Class Reference

#include <cQuaternion.h>

Inheritance diagram for GrayLib::cQuaternionf:
GrayLib::cQuaternionT< float > GrayLib::cVecT4< float > GrayLib::cVecTC< float, 4, cVecT4< float > >

Public Types

typedef cQuaternionT< float > SUPER_t
 
typedef cQuaternionf THIS_t
 
- Public Types inherited from GrayLib::cQuaternionT< float >
typedef cVecT4< float > SUPER_t
 
- Public Types inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
typedef float DVALUE_t
 Dimension value type. More...
 
typedef cVecTC< float, _IQTY, cVecT4< float > > THIS_t
 

Public Member Functions

 cQuaternionf () noexcept
 
 cQuaternionf (DVALUE_t _x, DVALUE_t _y, DVALUE_t _z, DVALUE_t _w)
 
 cQuaternionf (const SUPER_t &q)
 
 cQuaternionf (const cMatrix4x4f &rm)
 
 cQuaternionf (const cVector3f &vAxis, RADIANf_t fAngle)
 
THIS_t GetMulQ (const THIS_t &q) const
 
THIS_t operator* (const THIS_t &q) const
 
RADIANf_t get_EulerY () const
 
cVector3f get_EulerV () const
 
void InitIdentity ()
 
void InitSlerp (const THIS_t &q1, const THIS_t &q2, DVALUE_t t)
 
void InitRotationAxis (const cVector3f &vNorm, RADIANf_t fAngle)
 
void InitAngle (const cVector3f &v, RADIANf_t fAngle)
 
void InitMulQ (const THIS_t &q1, const THIS_t &q2)
 
void InitRotationMatrix (const cMatrix4x4f &rm)
 
void InitEulerV (const cVector3f &v)
 
void AlignToNormal (cVector3f &vNorm)
 
void SetToAngleBetween (const cVector3f &v1, const cVector3f &v2)
 
void SetEulerY (RADIANf_t fAngleY, bool bMoveNormalized)
 
 UNITTEST_FRIEND (cQuaternion)
 
- Public Member Functions inherited from GrayLib::cQuaternionT< float >
 cQuaternionT () noexcept
 
 cQuaternionT (float _x, float _y, float _z, float _w) noexcept
 
 cQuaternionT (const SUPER_t &q) noexcept
 
bool isIdentity () const noexcept
 
bool IsNearQ (const SUPER_t &q, float fDist=k_FLT_MIN2) const
 
- Public Member Functions inherited from GrayLib::cVecT4< float >
 cVecT4 () noexcept
 
 cVecT4 (const SUPER_t &v) noexcept
 
 cVecT4 (const float *pVals) noexcept
 
 cVecT4 (float n0, float n1, float n2=0, float n3=0) noexcept
 
 cVecT4 (const cVecT3< float > &v2, float _w=0)
 
const float & get_X () const noexcept
 
const float & get_Y () const noexcept
 
const float & get_Z () const noexcept
 
const float & get_W () const noexcept
 
const cVecT3< float > & get_V3 () const noexcept
 
cVecT3< float > & ref_V3 () noexcept
 
void InitCross (const THIS_t &v1, const THIS_t &v2, const THIS_t &v3)
 
- Public Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
float * get_T () noexcept
 
const float * get_CT () const noexcept
 
const cVecT4< float > & get_CR () const noexcept
 
 operator const float * () const noexcept
 
float GetElem (int i) const noexcept
 
float operator[] (int i) const noexcept
 
float & operator[] (int i)
 
bool isZero () const noexcept
 
COMPARE_t Compare (const THIS_t &v2) const noexcept
 
bool operator== (const THIS_t &v2) const noexcept
 
bool operator!= (const THIS_t &v2) const noexcept
 
bool IsNear (const THIS_t &v2, float fDist=(float) k_FLT_MIN2) const
 
float get_MagnitudeSq () const noexcept
 
float get_Magnitude () const noexcept
 
cVecT4< float > operator- () const
 
cVecT4< float > operator- (const THIS_t &v2) const
 
cVecT4< float > get_Abs () const
 
cVecT4< float > GetSum (const THIS_t &v2) const
 
cVecT4< float > operator+ (const THIS_t &v2) const
 
cVecT4< float > GetDiff (const THIS_t &v2) const
 
cVecT4< float > GetScaled (float nScale) const
 
cVecT4< float > operator* (float nScale) const
 
cVecT4< float > operator/ (float nScale) const
 
cVecT4< float > GetMul (const THIS_t &v2) const
 
cVecT4< float > GetDiv (const THIS_t &v2) const
 
float GetDistSq (const THIS_t &v2) const
 
float GetDist (const THIS_t &v2) const
 
float GetDot (const THIS_t &v2) const
 
cVecT4< float > get_Normalized () const
 
 operator float * ()
 
float & RefElem (int i) noexcept
 
void Set (const THIS_t &v)
 
void SetZero () noexcept
 
float SetNormalized (void) noexcept
 
bool put_Magnitude (float nLength)
 
void SetLerp (const THIS_t &a, const THIS_t &b, DVALUE_t t)
 
const cVecT4< float > & operator+= (const THIS_t &v2)
 
const cVecT4< float > & operator+= (float n)
 
const cVecT4< float > & operator-= (const THIS_t &v2) noexcept
 
const cVecT4< float > & operator-= (float n) noexcept
 
void DoScale (float n) noexcept
 
const cVecT4< float > & operator*= (float nScale) noexcept
 
cVecT4< float > & operator*= (const THIS_t &v2) noexcept
 
const cVecT4< float > & operator/= (float nScale)
 
cVecT4< float > & operator/= (const THIS_t &v2)
 
void DoMul (const THIS_t &v2) noexcept
 
void DoDiv (const THIS_t &v2)
 

Static Public Attributes

static const cQuaternionf k_Identity
 
- Static Public Attributes inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
static const int k_nDim
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
static float GetDot (const THIS_t &v1, const THIS_t &v2)
 
- Public Attributes inherited from GrayLib::cVecT4< float >
float m_a [4]
 
float m_x
 
float m_y
 
float m_z
 
float m_w
 
float x
 
float y
 
float z
 
float w
 
float r
 
float g
 
float b
 
float a
 
union {
   TYPE   m_a [4]
 
   struct {
      TYPE   m_x
 
      TYPE   m_y
 
      TYPE   m_z
 
      TYPE   m_w
 
   } 
 
   struct {
      TYPE   x
 
      TYPE   y
 
      TYPE   z
 
      TYPE   w
 
   } 
 
   struct {
      TYPE   r
 
      TYPE   g
 
      TYPE   b
 
      TYPE   a
 
   } 
 
}; 
 
- Protected Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
 cVecTC ()
 

Detailed Description

Angle of 3d orientation. Avoids Gimbel lock of pitch,bank/yaw,roll Euler angles for objects in motion. similar to float4 and D3DXQUATERNION Quaternions can be added to add angles.

Member Typedef Documentation

◆ SUPER_t

◆ THIS_t

Constructor & Destructor Documentation

◆ cQuaternionf() [1/5]

GrayLib::cQuaternionf::cQuaternionf ( )
inlinenoexcept

◆ cQuaternionf() [2/5]

GrayLib::cQuaternionf::cQuaternionf ( DVALUE_t  _x,
DVALUE_t  _y,
DVALUE_t  _z,
DVALUE_t  _w 
)
inline

◆ cQuaternionf() [3/5]

GrayLib::cQuaternionf::cQuaternionf ( const SUPER_t q)
inline

◆ cQuaternionf() [4/5]

GrayLib::cQuaternionf::cQuaternionf ( const cMatrix4x4f rm)
inline

◆ cQuaternionf() [5/5]

GrayLib::cQuaternionf::cQuaternionf ( const cVector3f vAxis,
RADIANf_t  fAngle 
)
inline

Create a Euler type angle for a particular axis.

Member Function Documentation

◆ AlignToNormal()

void GrayLib::cQuaternionf::AlignToNormal ( cVector3f vNorm)

Alter this orientation such that it is aligned to the vNorm normal. Modify 2 of the 3 Euler angles. but leave the heading.

  • vNorm = normalized normal vector of the ground.

◆ get_EulerV()

cVector3f GrayLib::cQuaternionf::get_EulerV ( ) const

I want a Euler angle (pitch,bank,roll) from this quaternion. from www.euclideanspace.com similar but NOT the same as D3DXQuaternionToAxisAngle

Note
was old void v::put_EulerFromQuaternion( const cQuaternionf& q );

◆ get_EulerY()

RADIANf_t GrayLib::cQuaternionf::get_EulerY ( ) const

Get the Euler value (radians) for Y only similar but NOT the same as D3DXQuaternionToAxisAngle y=yaw=heading,x=pitch,z=roll=bank

◆ GetMulQ()

THIS_t GrayLib::cQuaternionf::GetMulQ ( const THIS_t q) const
inline

multiply 2 quaternions.

◆ InitAngle()

void GrayLib::cQuaternionf::InitAngle ( const cVector3f v,
RADIANf_t  fAngle 
)
inline

http://cache-www.intel.com/cd/00/00/29/37/293748_293748.pdf v1 = the unit length axis of rotation in 3D space fAngle = the angle of rotation about the axis in radians.

◆ InitEulerV()

void GrayLib::cQuaternionf::InitEulerV ( const cVector3f v)

I have a Euler angle (pitch,bank_yaw,roll), get a cQuaternionf. y=yaw=heading,x=pitch,z=roll=bank radians ASSUME QuaternionNormalized();

Note
was old cQuaternionf v::get_QuaternionFromEuler() const;

◆ InitIdentity()

void GrayLib::cQuaternionf::InitIdentity ( )
inline

set to Identity Quaternion.

◆ InitMulQ()

void GrayLib::cQuaternionf::InitMulQ ( const THIS_t q1,
const THIS_t q2 
)
inline

multiply 2 quaternion's. D3DXQuaternionMultiply

◆ InitRotationAxis()

void GrayLib::cQuaternionf::InitRotationAxis ( const cVector3f vNorm,
RADIANf_t  fAngle 
)
inline

init q with an axis vector and an angle (radians) ASSUME v is normalized. D3DXQuaternionRotationAxis is an inverse of D3DXQuaternionToAxisAngle().

◆ InitRotationMatrix()

void GrayLib::cQuaternionf::InitRotationMatrix ( const cMatrix4x4f rm)

set this Q from rotation matrix. used by Matrix::get_RotationQ() ASSUME matrix is NOT scaled. use Normalized matrix to remove scaling first.

◆ InitSlerp()

void GrayLib::cQuaternionf::InitSlerp ( const THIS_t q1,
const THIS_t q2,
DVALUE_t  t 
)
inline

like D3DXQuaternionSlerp() not like a Calc::Lerp()

◆ operator*()

THIS_t GrayLib::cQuaternionf::operator* ( const THIS_t q) const
inline

◆ SetEulerY()

void GrayLib::cQuaternionf::SetEulerY ( RADIANf_t  fAngleY,
bool  bMoveNormalized 
)

Take on the fAngleY heading. y=yaw=heading,x=pitch,z=roll=bank

◆ SetToAngleBetween()

void GrayLib::cQuaternionf::SetToAngleBetween ( const cVector3f v1,
const cVector3f v2 
)

v1,v2 = vectors what is the shortest arc from v1 to v2

Note
v1 and v2 DONT have to be normalized http://www.euclideanspace.com/maths/algebra/vectors/angleBetween/minorlogic.htm

◆ UNITTEST_FRIEND()

GrayLib::cQuaternionf::UNITTEST_FRIEND ( cQuaternion  )

Member Data Documentation

◆ k_Identity

const cQuaternionf GrayLib::cQuaternionf::k_Identity
static

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