inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/rotf
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_rotf
00005 #define inlib_rotf
00006 
00007 // rotation done with quaternion.
00008 
00009 #include "qrot"
00010 #include "vec3f"
00011 
00012 namespace inlib {
00013 
00014 class rotf : public qrot<float> {
00015 public:
00016   rotf()
00017   :qrot<float>()   //zero rotation around the positive Z axis.
00018   {}
00019   rotf(const vec3f& a_axis,float a_radians)
00020   :qrot<float>(a_axis,a_radians)
00021   {}
00022   virtual ~rotf(){}
00023 public:
00024   rotf(const rotf& a_from)
00025   :qrot<float>(a_from)
00026   {}
00027   rotf& operator=(const rotf& a_from){
00028     qrot<float>::operator=(a_from);
00029     return *this;
00030   }
00031 private:
00032   rotf(float a_q0,float a_q1,float a_q2,float a_q3)
00033   :qrot<float>(a_q0,a_q1,a_q2,a_q3)
00034   {}
00035 public:
00036   rotf& operator*=(const rotf& a_q) {
00037     qrot<float>::operator*=(a_q);
00038     return *this;
00039   }
00040   rotf operator*(const rotf& a_r) const {
00041     rotf tmp(*this);
00042     tmp *= a_r;
00043     return tmp;
00044   }
00045 public:
00046   //NOTE : don't handle a static object because of mem balance.
00047   //static const rotf& identity() {
00048   //  static const rotf s_v(0,0,0,1);
00049   //  return s_v;
00050   //}
00051 };
00052 
00053 }
00054 
00055 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines