Commit | Autor | Alter
|
45edef
|
1 |
/************************************************************************
|
JS |
2 |
|
|
3 |
POLHEMUS PROPRIETARY
|
|
4 |
|
|
5 |
Polhemus
|
|
6 |
P.O. Box 560
|
|
7 |
Colchester, Vermont 05446
|
|
8 |
(802) 655-3159
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
Copyright © 2005 by Polhemus
|
|
14 |
All Rights Reserved.
|
|
15 |
|
|
16 |
|
|
17 |
*************************************************************************/
|
|
18 |
|
|
19 |
// Quaternion.h: interface for the CQuaternion class.
|
|
20 |
//
|
|
21 |
//////////////////////////////////////////////////////////////////////
|
|
22 |
|
|
23 |
#if !defined(AFX_QUATERNION_H__D76D8B96_F74D_41A4_869E_C3A397F9AA7A__INCLUDED_)
|
|
24 |
#define AFX_QUATERNION_H__D76D8B96_F74D_41A4_869E_C3A397F9AA7A__INCLUDED_
|
|
25 |
|
|
26 |
const float PI=3.14159265f;
|
|
27 |
const float DEG2RADS=PI/180.0f;
|
|
28 |
|
|
29 |
|
|
30 |
class CQuaternion
|
|
31 |
{
|
|
32 |
private:
|
|
33 |
void Normalize();
|
|
34 |
float q0;
|
|
35 |
float q1;
|
|
36 |
float q2;
|
|
37 |
float q3;
|
|
38 |
public:
|
|
39 |
CQuaternion Slerp(const CQuaternion& q, float t) const;
|
|
40 |
CQuaternion operator+(const CQuaternion& q1) const;
|
|
41 |
void GetAngle(float& a,bool deg=true);
|
|
42 |
void SetFromEulers(float* eul, bool deg=true);
|
|
43 |
void MakeLargestElementPos();
|
|
44 |
static void Quats2Eul(float* eul,float* quats,bool isDeg=true);
|
|
45 |
static void Eul2Quat(float* quat,float* eul,bool isDeg=true);
|
|
46 |
bool IsIdentity();
|
|
47 |
void SetQuatVals(const float w,const float x,const float y,const float z);
|
|
48 |
void SetQuatVals(const float val[4]);
|
|
49 |
float GetQuatVal(int ind) const;
|
|
50 |
void GetQuatVal(float vals[4]) const;
|
|
51 |
CQuaternion operator-(const CQuaternion& quat)const;
|
|
52 |
CQuaternion GetDeltaQuat(const CQuaternion& quat) const;
|
|
53 |
void GetAxisAngle(float vect[3],float& angle,bool deg=true) const;
|
|
54 |
CQuaternion operator -() const;
|
|
55 |
CQuaternion operator*(const CQuaternion& quat2) const;
|
|
56 |
CQuaternion operator*(const float ) const;
|
|
57 |
void operator *=(const CQuaternion &quat);
|
|
58 |
void GetAttMat(float mat[3][3]) const;
|
|
59 |
void GetEuler(float aer[3],bool deg=true) const;
|
|
60 |
void GetEuler(float& az,float& el,float& rl,bool deg=true) const;
|
|
61 |
CQuaternion(const float vect[3],float angle,bool deg=true);
|
|
62 |
CQuaternion(float q0,float q1,float q2,float q3);
|
|
63 |
CQuaternion(const float q[4]);
|
|
64 |
CQuaternion(float az, float el,float roll,bool deg=true);
|
|
65 |
CQuaternion();
|
|
66 |
virtual ~CQuaternion();
|
|
67 |
|
|
68 |
};
|
|
69 |
|
|
70 |
#endif // !defined(AFX_QUATERNION_H__D76D8B96_F74D_41A4_869E_C3A397F9AA7A__INCLUDED_)
|