Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Repere.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
16 #ifndef REPERE_H
17 #define REPERE_H
18 
19 #include "Geometry/mathlib.h"
20 #include "Base.h"
21 
25 class Repere : public Base
26 {
27 
28 public:
30  Repere() : Base()
31  {
32  name = "unknown repere";
33  };
34  Repere(vec3 _U, vec3 _V, vec3 _W, vec3 _O);
35  Repere(const Repere& repere);
36 
38  virtual ~Repere(){};
39 
41  void set(vec3 _U, vec3 _V, vec3 _W, vec3 _O)
42  {
43  U = vec3(_U);
44  V = vec3(_V);
45  W = vec3(_W);
46  O = vec3(_O);
48  }
49  void setU(vec3 _U)
50  {
51  U = vec3(_U);
53  }
54  void setV(vec3 _V)
55  {
56  V = vec3(_V);
58  }
59  void setW(vec3 _W)
60  {
61  W = vec3(_W);
63  }
64  void setO(vec3 _O)
65  {
66  O = vec3(_O);
68  }
69 
71  vec3 getU() const
72  {
73  return U;
74  }
75  vec3 getV() const
76  {
77  return V;
78  }
79  vec3 getW() const
80  {
81  return W;
82  }
83  vec3 getO() const
84  {
85  return O;
86  }
87 
89  vec3 vectorFromLocalToGlobal(const vec3& local);
91  vec3 vectorFromGlobalToLocal(const vec3& global);
92 
94  vec3 positionFromLocalToGlobal(const vec3& local);
96  vec3 positionFromGlobalToLocal(const vec3& global);
97 
98 protected:
100  void updateMatrices();
101 
102  vec3 U;
103  vec3 V;
104  vec3 W;
105  vec3 O;
106 
107  decimal LtoG[4][4];
108  decimal GtoL[4][4];
109 };
110 
111 #endif
Base class of Event, Material, PostFilter, Ray, Repere, Scene, Shape, Simulation, Source.
Definition: Base.h:25
std::string name
Each instantiated object may be named.
Definition: Base.h:52
Frame class.
Definition: Repere.h:26
vec3 getU() const
Get global coordinates of local axis U,V,W and origin O.
Definition: Repere.h:71
void setW(vec3 _W)
Definition: Repere.h:59
vec3 U
Coordinates of local axis U in global frame.
Definition: Repere.h:102
vec3 getV() const
Definition: Repere.h:75
decimal LtoG[4][4]
Local to global frame matrix.
Definition: Repere.h:107
vec3 vectorFromGlobalToLocal(const vec3 &global)
Get local coordinates of vector expressed in global coordinates.
Definition: Repere.cpp:94
vec3 positionFromLocalToGlobal(const vec3 &local)
Get global coordinates of a point expressed in local coordinates.
Definition: Repere.cpp:104
virtual ~Repere()
Destructor.
Definition: Repere.h:38
void setV(vec3 _V)
Definition: Repere.h:54
vec3 V
Coordinates of local axis V in global frame.
Definition: Repere.h:103
void updateMatrices()
Update the global and local frame matrices.
Definition: Repere.cpp:41
Repere()
Constructors.
Definition: Repere.h:30
vec3 W
Coordinates of local axis W in global frame.
Definition: Repere.h:104
decimal GtoL[4][4]
Global to local frame matrix.
Definition: Repere.h:108
void set(vec3 _U, vec3 _V, vec3 _W, vec3 _O)
Set global coordinates of local axis U,V,W and origin O.
Definition: Repere.h:41
vec3 getO() const
Definition: Repere.h:83
vec3 vectorFromLocalToGlobal(const vec3 &local)
Get global coordinates of vector expressed in local coordinates.
Definition: Repere.cpp:84
void setO(vec3 _O)
Definition: Repere.h:64
vec3 getW() const
Definition: Repere.h:79
vec3 positionFromGlobalToLocal(const vec3 &global)
Get local coordinates of a point expressed in global coordinates.
Definition: Repere.cpp:119
void setU(vec3 _U)
Definition: Repere.h:49
vec3 O
Origin of the local frame in the global frame.
Definition: Repere.h:105
float decimal
Definition: mathlib.h:45
base_vec3< decimal > vec3
Definition: mathlib.h:381