1 #ifndef __BRAIN_QUATERNION 2 #define __BRAIN_QUATERNION 3 4 class Quaternion { 5 public: 6 Quaternion(); 7 Quaternion(FILE *fp); 8 9 bool operator==(Quaternion &q); 10 bool operator!=(Quaternion &q); 11 12 bool load(FILE *fp); 13 bool save(FILE *fp); 14 15 void to_matrix(float *m); 16 17 void to_axis_angle(float *axis,float *angle); 18 void from_axis_angle(float *axis,float angle); 19 20 void to_axis_angle(Vector *axis,double *angle); 21 void from_axis_angle(Vector axis,double angle); 22 23 void post_multiply(Quaternion *q); 24 void pre_multiply(Quaternion *q); 25 26 void rotate_vector(float *in,float *out); 27 void rotate_vector(Vector in,Vector &out); 28 29 void normalize(void); 30 31 void print(void); 32 33 private: 34 double w,x,y,z; 35 }; 36 37 #endif 38