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