mirror of
https://github.com/ENSL/NS.git
synced 2024-11-27 14:52:11 +00:00
b5590dd5d9
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@144 67975925-1194-0748-b3d5-c16f83f1a3a1
43 lines
792 B
C++
43 lines
792 B
C++
#ifndef UTIL_QUAT_H
|
|
#define UTIL_QUAT_H
|
|
|
|
/**
|
|
* Quaternion class.
|
|
*/
|
|
class Quat
|
|
{
|
|
|
|
public:
|
|
|
|
Quat();
|
|
Quat(float x, float y, float z, float w);
|
|
Quat(const float angles[3]);
|
|
Quat(const float xAxis[3], const float yAxis[3], const float zAxis[3]);
|
|
Quat(float angle, const float axis[3]);
|
|
|
|
/**
|
|
* For a unit quaternion, the conjugate is the inverse.
|
|
*/
|
|
Quat Conjugate() const;
|
|
|
|
Quat Unit() const;
|
|
|
|
void GetVectors(float xAxis[3], float yAxis[3], float zAxis[3]) const;
|
|
|
|
void GetAngles(float outAngles[3]) const;
|
|
|
|
public:
|
|
|
|
float x;
|
|
float y;
|
|
float z;
|
|
float w;
|
|
|
|
};
|
|
|
|
Quat operator*(const Quat& q1, const Quat& q2);
|
|
|
|
Quat ConstantRateLerp(const Quat& src, const Quat& dst, float amount);
|
|
|
|
#endif
|
|
|