Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/lina/mat4f is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_mat4f
0005 #define tools_mat4f
0006 
0007 #include "mat4"
0008 #include <cmath>
0009 
0010 namespace tools {
0011 
0012 class mat4f : public mat4<float> {
0013   typedef mat4<float> parent;
0014 public:
0015   mat4f(){}
0016   virtual ~mat4f() {}
0017 public:
0018   mat4f(const mat4f& a_from):parent(a_from){}
0019   mat4f& operator=(const mat4f& a_from){
0020     parent::operator=(a_from);
0021     return *this;
0022   }
0023 public:
0024   mat4f(float a_00,float a_01,float a_02,float a_03, //first  row
0025         float a_10,float a_11,float a_12,float a_13, //second row
0026         float a_20,float a_21,float a_22,float a_23, //third  row
0027         float a_30,float a_31,float a_32,float a_33) //fourth row
0028   :parent(a_00,a_01,a_02,a_03,
0029           a_10,a_11,a_12,a_13,
0030           a_20,a_21,a_22,a_23,
0031           a_30,a_31,a_32,a_33)
0032   {}
0033   mat4f(const parent& a_from):parent(a_from){}
0034   mat4f& operator=(const parent& a_from){
0035     parent::operator=(a_from);
0036     return *this;
0037   }
0038 public:
0039   void set_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
0040     //WARNING : (a_x,a_y,a_z) must be a normalized vector.
0041     parent::set_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
0042   }
0043   void mul_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
0044     parent::mul_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
0045   }
0046   void left_mul_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
0047     parent::left_mul_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
0048   }
0049 
0050   template <class VEC>
0051   void set_rotate(const VEC& a_dir,float a_angle) {
0052     //WARNING : a_dir must be a normalized vector.
0053     parent::set_rotate(a_dir[0],a_dir[1],a_dir[2],a_angle,::sinf,::cosf);
0054   }
0055 
0056 public: //backward compatibility
0057   void mul_2f(float& a_x,float& a_y) const {parent::mul_2(a_x,a_y);}
0058   void mul_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_3(a_x,a_y,a_z);}
0059   void mul_3f_opt(float& a_x,float& a_y,float& a_z,float a_tmp[3]) const {parent::mul_3_opt(a_x,a_y,a_z,a_tmp);}
0060   void mul_dir_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_dir_3(a_x,a_y,a_z);}
0061   void mul_dir_3f_opt(float& a_x,float& a_y,float& a_z,float a_tmp[3]) const {parent::mul_dir_3_opt(a_x,a_y,a_z,a_tmp);}
0062   void mul_trans_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_trans_3(a_x,a_y,a_z);}
0063   void mul_4f(float& a_x,float& a_y,float& a_z,float& a_w) const {parent::mul_4(a_x,a_y,a_z,a_w);}
0064   void mul_4f_opt(float& a_x,float& a_y,float& a_z,float& a_w,float a_tmp[4]) const {parent::mul_4_opt(a_x,a_y,a_z,a_w,a_tmp);}
0065   void mul_dir_3d(double& a_x,double& a_y,double& a_z) const { //used in sg::healpix
0066     float x = float(a_x);
0067     float y = float(a_y);
0068     float z = float(a_z);
0069     parent::mul_dir_3(x,y,z);
0070     a_x = x;a_y = y;a_z = z;
0071   }
0072 public: //operators
0073 };
0074 
0075 // for sf_vec<mat4f,float>, sf_mat4f :
0076 inline const std::string& stype(const mat4f&) {
0077   static const std::string s_v("tools::mat4f");
0078   return s_v;
0079 }
0080 
0081 }
0082 
0083 #endif