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[ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/lina/mat4f (Version 11.3.0) and /externals/g4tools/include/tools/lina/mat4f (Version 11.1.3)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_mat4f                                 4 #ifndef tools_mat4f
  5 #define tools_mat4f                                 5 #define tools_mat4f
  6                                                     6 
  7 #include "mat4"                                     7 #include "mat4"
  8 #include <cmath>                                    8 #include <cmath>
  9                                                     9 
 10 namespace tools {                                  10 namespace tools {
 11                                                    11 
 12 class mat4f : public mat4<float> {                 12 class mat4f : public mat4<float> {
 13   typedef mat4<float> parent;                      13   typedef mat4<float> parent;
 14 public:                                            14 public:
 15   mat4f(){}                                        15   mat4f(){}
 16   virtual ~mat4f() {}                              16   virtual ~mat4f() {}
 17 public:                                            17 public:
 18   mat4f(const mat4f& a_from):parent(a_from){}      18   mat4f(const mat4f& a_from):parent(a_from){}
 19   mat4f& operator=(const mat4f& a_from){           19   mat4f& operator=(const mat4f& a_from){
 20     parent::operator=(a_from);                     20     parent::operator=(a_from);
 21     return *this;                                  21     return *this;
 22   }                                                22   }
 23 public:                                            23 public:
 24   mat4f(float a_00,float a_01,float a_02,float     24   mat4f(float a_00,float a_01,float a_02,float a_03, //first  row
 25         float a_10,float a_11,float a_12,float     25         float a_10,float a_11,float a_12,float a_13, //second row
 26         float a_20,float a_21,float a_22,float     26         float a_20,float a_21,float a_22,float a_23, //third  row
 27         float a_30,float a_31,float a_32,float     27         float a_30,float a_31,float a_32,float a_33) //fourth row
 28   :parent(a_00,a_01,a_02,a_03,                     28   :parent(a_00,a_01,a_02,a_03,
 29           a_10,a_11,a_12,a_13,                     29           a_10,a_11,a_12,a_13,
 30           a_20,a_21,a_22,a_23,                     30           a_20,a_21,a_22,a_23,
 31           a_30,a_31,a_32,a_33)                     31           a_30,a_31,a_32,a_33)
 32   {}                                               32   {}
 33   mat4f(const parent& a_from):parent(a_from){}     33   mat4f(const parent& a_from):parent(a_from){}
 34   mat4f& operator=(const parent& a_from){          34   mat4f& operator=(const parent& a_from){
 35     parent::operator=(a_from);                     35     parent::operator=(a_from);
 36     return *this;                                  36     return *this;
 37   }                                                37   }
 38 public:                                            38 public:
 39   void set_rotate(const float& a_x,const float     39   void set_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
 40     //WARNING : (a_x,a_y,a_z) must be a normal     40     //WARNING : (a_x,a_y,a_z) must be a normalized vector.
 41     parent::set_rotate(a_x,a_y,a_z,a_angle,::s     41     parent::set_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
 42   }                                                42   }
 43   void mul_rotate(const float& a_x,const float     43   void mul_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
 44     parent::mul_rotate(a_x,a_y,a_z,a_angle,::s     44     parent::mul_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
 45   }                                                45   }
 46   void left_mul_rotate(const float& a_x,const      46   void left_mul_rotate(const float& a_x,const float& a_y,const float& a_z,const float& a_angle) {
 47     parent::left_mul_rotate(a_x,a_y,a_z,a_angl     47     parent::left_mul_rotate(a_x,a_y,a_z,a_angle,::sinf,::cosf);
 48   }                                                48   }
 49                                                    49 
 50   template <class VEC>                             50   template <class VEC>
 51   void set_rotate(const VEC& a_dir,float a_ang     51   void set_rotate(const VEC& a_dir,float a_angle) {
 52     //WARNING : a_dir must be a normalized vec     52     //WARNING : a_dir must be a normalized vector.
 53     parent::set_rotate(a_dir[0],a_dir[1],a_dir     53     parent::set_rotate(a_dir[0],a_dir[1],a_dir[2],a_angle,::sinf,::cosf);
 54   }                                                54   }
 55                                                    55 
 56 public: //backward compatibility                   56 public: //backward compatibility
 57   void mul_2f(float& a_x,float& a_y) const {pa     57   void mul_2f(float& a_x,float& a_y) const {parent::mul_2(a_x,a_y);}
 58   void mul_3f(float& a_x,float& a_y,float& a_z     58   void mul_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_3(a_x,a_y,a_z);}
 59   void mul_3f_opt(float& a_x,float& a_y,float& << 
 60   void mul_dir_3f(float& a_x,float& a_y,float&     59   void mul_dir_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_dir_3(a_x,a_y,a_z);}
 61   void mul_dir_3f_opt(float& a_x,float& a_y,fl << 
 62   void mul_trans_3f(float& a_x,float& a_y,floa     60   void mul_trans_3f(float& a_x,float& a_y,float& a_z) const {parent::mul_trans_3(a_x,a_y,a_z);}
 63   void mul_4f(float& a_x,float& a_y,float& a_z     61   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);}
 64   void mul_4f_opt(float& a_x,float& a_y,float& << 
 65   void mul_dir_3d(double& a_x,double& a_y,doub     62   void mul_dir_3d(double& a_x,double& a_y,double& a_z) const { //used in sg::healpix
 66     float x = float(a_x);                          63     float x = float(a_x);
 67     float y = float(a_y);                          64     float y = float(a_y);
 68     float z = float(a_z);                          65     float z = float(a_z);
 69     parent::mul_dir_3(x,y,z);                      66     parent::mul_dir_3(x,y,z);
 70     a_x = x;a_y = y;a_z = z;                       67     a_x = x;a_y = y;a_z = z;
 71   }                                                68   }
 72 public: //operators                                69 public: //operators
 73 };                                                 70 };
 74                                                    71 
 75 // for sf_vec<mat4f,float>, sf_mat4f :             72 // for sf_vec<mat4f,float>, sf_mat4f :
 76 inline const std::string& stype(const mat4f&)      73 inline const std::string& stype(const mat4f&) {
 77   static const std::string s_v("tools::mat4f")     74   static const std::string s_v("tools::mat4f");
 78   return s_v;                                      75   return s_v;
 79 }                                                  76 }
 80                                                    77 
 81 }                                                  78 }
 82                                                    79 
 83 #endif                                             80 #endif