inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/rotd
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_rotd
00005 #define inlib_rotd
00006 
00007 // rotation done with quaternion.
00008 
00009 #include "qrot"
00010 #include "vec3d"
00011 
00012 namespace inlib {
00013 
00014 class rotd : public qrot<double> {
00015 public:
00016   rotd()
00017   :qrot<double>()   //zero rotation around the positive Z axis.
00018   {}
00019   rotd(const vec3d& a_axis,double a_radians)
00020   :qrot<double>(a_axis,a_radians)
00021   {}
00022   virtual ~rotd(){}
00023 public:
00024   rotd(const rotd& a_from)
00025   :qrot<double>(a_from)
00026   {}
00027   rotd& operator=(const rotd& a_from){
00028     qrot<double>::operator=(a_from);
00029     return *this;
00030   }
00031 private:
00032   rotd(double a_q0,double a_q1,double a_q2,double a_q3)
00033   :qrot<double>(a_q0,a_q1,a_q2,a_q3)
00034   {}
00035 public:
00036   rotd& operator*=(const rotd& a_q) {
00037     qrot<double>::operator*=(a_q);
00038     return *this;
00039   }
00040   rotd operator*(const rotd& a_r) const {
00041     rotd 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 rotd& identity() {
00048   //  static const rotd 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