Krig Game Engine
Quaternion.h
Go to the documentation of this file.
1 
8 #ifndef _QUATERNION_H_
9 #define _QUATERNION_H_
10 
11 #include "Matrix.h"
12 #include "Vector.h"
13 
14 class Quaternion {
15  public:
16  Quaternion();
17  Quaternion(const Vector&);
18  Quaternion(const float&, const float&, const float&);
19  Quaternion(const Vector&, const float&);
20  Quaternion(const float&, const float&, const float&, const float&);
21  Quaternion(const Quaternion &);
22  ~Quaternion() {}
23 
24  void normalize();
25 
26  void buildFromEuler(const Vector&);
27  void buildFromEuler(const float&, const float&, const float&);
28  void buildFromAxis(const Vector&, const float&);
29  void buildFromAxis(const float&, const float&, const float&);
30 
31  void loadMultIdentity();
32  void loadAddIdentity();
33 
34  void getEulerAngles(Vector&);
35 
36  void buildRotationMatrix(Matrix&);
37  void rotate(const float&);
38  void slerp (const Quaternion &, const float&, const Quaternion&);
39 
40  // accessor functions
41  float getX() const { return(x); }
42  float getY() const { return(y); }
43  float getZ() const { return(z); }
44  float getW() const { return(w); }
45 
46  // overloaded operators
47  Quaternion operator+(const Quaternion&);
48  Quaternion operator*(const Quaternion&);
49  Quaternion& operator=(const Quaternion&);
50 
51  private:
52  float x, y, z, w;
53 };
54 
55 #endif
Definition: Quaternion.h:14
Definition: Vector.h:15
Definition: matrix.h:15
Represent and operate on vectors.