g4tools  5.4.0
mat4d
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_mat4d
5 #define tools_mat4d
6 
7 #include "mat4"
8 #include <cmath>
9 
10 namespace tools {
11 
12 class mat4d : public mat4<double> {
13  typedef mat4<double> parent;
14 public:
15  mat4d(){}
16  virtual ~mat4d() {}
17 public:
18  mat4d(const mat4d& a_from):parent(a_from){}
19  mat4d& operator=(const mat4d& a_from){
20  parent::operator=(a_from);
21  return *this;
22  }
23 public:
24  mat4d(double a_00,double a_01,double a_02,double a_03, //first row
25  double a_10,double a_11,double a_12,double a_13, //second row
26  double a_20,double a_21,double a_22,double a_23, //third row
27  double a_30,double a_31,double a_32,double 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  mat4d(const parent& a_from):parent(a_from){}
34  mat4d& operator=(const parent& a_from){
35  parent::operator=(a_from);
36  return *this;
37  }
38 public:
39  mat4d(const mat4<float>& a_from):parent(){
40  for(unsigned int index=0;index<16;index++) {
41  m_vec[index] = a_from.data()[index];
42  }
43  }
44  mat4d& operator=(const mat4<float>& a_from){
45  for(unsigned int index=0;index<16;index++) {
46  m_vec[index] = a_from.data()[index];
47  }
48  return *this;
49  }
50 public:
51  void set_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
52  parent::set_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
53  }
54  void mul_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
55  parent::mul_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
56  }
57  void left_mul_rotate(const double& a_x,const double& a_y,const double& a_z,const double& a_angle) {
58  parent::left_mul_rotate(a_x,a_y,a_z,a_angle,::sin,::cos);
59  }
60 
61  template <class VEC>
62  void set_rotate(const VEC& a_dir,double a_angle) {
63  //WARNING : a_dir must be a normalized vector.
64  parent::set_rotate(a_dir[0],a_dir[1],a_dir[2],a_angle,::sin,::cos);
65  }
66 
67 public: //backward compatibility
68  void mul_2d(double& a_x,double& a_y) const {
69  parent::mul_2(a_x,a_y);
70  }
71  void mul_3d(double& a_x,double& a_y,double& a_z) const {
72  parent::mul_3(a_x,a_y,a_z);
73  }
74  void mul_4d(double& a_x,double& a_y,double& a_z,double& a_w) const {
75  parent::mul_4(a_x,a_y,a_z,a_w);
76  }
77 public: //operators
78 };
79 
80 }
81 
82 #endif
tools::mat4d::mat4d
mat4d(const parent &a_from)
Definition: mat4d:33
tools::mat4< double >::mul_2
void mul_2(double &a_x, double &a_y) const
Definition: mat4:198
tools::mat4d::mul_rotate
void mul_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle)
Definition: mat4d:54
tools::mat< double, 4 >::m_vec
double m_vec[D *D]
Definition: mat:85
tools::mat4< double >::left_mul_rotate
void left_mul_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle, double(*a_sin)(double), double(*a_cos)(double))
Definition: mat4:285
tools::mat4d::mat4d
mat4d(const mat4< float > &a_from)
Definition: mat4d:39
tools::mat4d
Definition: mat4d:12
tools::mat4d::operator=
mat4d & operator=(const mat4d &a_from)
Definition: mat4d:19
tools::mat4d::set_rotate
void set_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle)
Definition: mat4d:51
tools::mat4< double >::set_rotate
void set_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle, double(*a_sin)(double), double(*a_cos)(double))
Definition: mat4:61
tools::mat4d::mul_3d
void mul_3d(double &a_x, double &a_y, double &a_z) const
Definition: mat4d:71
tools::mat4< double >::operator=
mat4 & operator=(const mat4 &a_from)
Definition: mat4:27
tools::mat4< double >::mul_4
void mul_4(double &a_x, double &a_y, double &a_z, double &a_p) const
Definition: mat4:168
tools::mat4d::mul_4d
void mul_4d(double &a_x, double &a_y, double &a_z, double &a_w) const
Definition: mat4d:74
mat4
tools::mat4d::operator=
mat4d & operator=(const mat4< float > &a_from)
Definition: mat4d:44
tools::mat4< double >::mul_3
void mul_3(double &a_x, double &a_y, double &a_z) const
Definition: mat4:184
tools::mat4d::~mat4d
virtual ~mat4d()
Definition: mat4d:16
tools::mat4
Definition: mat4:14
tools::mat4d::mat4d
mat4d(double a_00, double a_01, double a_02, double a_03, double a_10, double a_11, double a_12, double a_13, double a_20, double a_21, double a_22, double a_23, double a_30, double a_31, double a_32, double a_33)
Definition: mat4d:24
tools::mat4d::operator=
mat4d & operator=(const parent &a_from)
Definition: mat4d:34
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::mat4d::mul_2d
void mul_2d(double &a_x, double &a_y) const
Definition: mat4d:68
tools::mat4d::mat4d
mat4d()
Definition: mat4d:15
tools::mat4< double >::mul_rotate
void mul_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle, double(*a_sin)(double), double(*a_cos)(double))
Definition: mat4:279
tools::mat4d::left_mul_rotate
void left_mul_rotate(const double &a_x, const double &a_y, const double &a_z, const double &a_angle)
Definition: mat4d:57
tools::mat4d::mat4d
mat4d(const mat4d &a_from)
Definition: mat4d:18
tools::mat4d::set_rotate
void set_rotate(const VEC &a_dir, double a_angle)
Definition: mat4d:62