altEngine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
quaternion.h
Go to the documentation of this file.
1 #include "vector.h"
2 #include "matrix.h"
3 
4 #ifndef QUATERNION_H
5 #define QUATERNION_H
6 
7 class quaternion
8 {
9 public:
11 
12  quaternion();
13  quaternion(float s, vec3 v);
14  quaternion(float s, float x, float y, float z);
15  quaternion conjugate() const;
18  float magnitude() const;
19 
20  quaternion &operator=(const quaternion &q);
21  quaternion operator+(const quaternion &q) const ;
22  quaternion operator-(const quaternion &q) const;
23  quaternion operator-() const;
24  quaternion operator*(const float scalar) const;
25  quaternion operator/(const float scalar) const;
26  quaternion operator*(const vec3 &vec) const;
27  quaternion operator*(const quaternion &q) const;
28  quaternion &operator*=(const quaternion &q);
29  quaternion &operator+=(const quaternion &q);
30  quaternion &operator-=(const quaternion &q);
31 
32  static void slerp(const quaternion &q, const quaternion &p, float time, quaternion &result);
33 
34  vec3 rotate(float delta, const vec3 &axis, const vec3 &vector);
35 
36  float s;
37  float x;
38  float y;
39  float z;
40 };
41 
42 #endif