Code_TYMPAN  4.2.0
Industrial site acoustic simulation
geometry_modifier.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 __GEOMETRY_MODIFIER_H
17 #define __GEOMETRY_MODIFIER_H
18 
19 #include <qlist.h>
20 #include <string>
21 #include <memory>
22 
27 
28 class Lancer;
29 
30 using namespace std;
31 
36 {
37 public:
39  virtual ~IGeometryModifier() {};
40 
42  virtual void clear() = 0;
43 
47  virtual void buildNappe(const Lancer& shot) = 0;
48 
54  virtual vec3 fonction_h(const vec3& P) = 0;
55 
61  virtual vec3 fonction_h_inverse(const vec3& P) = 0;
62 
64  virtual void save_to_file(std::string fileName) = 0;
65 
66 protected:
68 };
69 
70 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71 
73  public IGeometryModifier
74 {
75 public:
78 
79  virtual void clear() {}
80 
81  virtual void buildNappe(const Lancer& shot) {}
82 
83  virtual vec3 fonction_h(const vec3& P) { return P; }
84 
85  virtual vec3 fonction_h_inverse(const vec3& P) { return P; }
86 
87  virtual void save_to_file(std::string fileName) {}
88 };
89 
90 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
91 
93  public IGeometryModifier
94 {
95 public:
96 
98  geometry_modifier_z_correction() : _scene( std::unique_ptr<Scene>( new Scene() ) ) {}
99 
102 
103  virtual void buildNappe(const Lancer& shot);
104 
105  virtual vec3 fonction_h(const vec3& P);
106 
107  virtual vec3 fonction_h_inverse(const vec3& P);
108 
109  virtual void clear() {}
110 
111  virtual void save_to_file(std::string fileName) { _scene->export_to_ply(fileName); }
112 
114  const Scene* get_scene() { return _scene.get(); }
115 
116 private :
117  void append_triangles_to_scene(QList<OPoint3D>& Liste_vertex, QList<OTriangle>& Liste_triangles);
118  double compute_h(const vec3& P);
119 
120  std::unique_ptr<Scene> _scene;
121 };
122 
123 #endif //__GEOMETRY_MODIFIER_H
Describes analytical ray curve tracing.
Definition: Lancer.h:37
virtual ~IGeometryModifier()
Destructor.
vec3 pos_center
Source position.
STL namespace.
virtual vec3 fonction_h(const vec3 &P)
Pure virtual function for a point transformation.
virtual void save_to_file(std::string fileName)
Export to a file.
virtual void clear()
Clear all the arrays.
virtual vec3 fonction_h_inverse(const vec3 &P)
Pure virtual function for an inverse point transformation.
3D vector Vector defined with 3 float numbers
Definition: mathlib.h:107
geometry_modifier_z_correction()
Constructor.
const Scene * get_scene()
Get the scene.
virtual void buildNappe(const Lancer &shot)
Pure virtual function to create the triangles mesh built with rays.
std::unique_ptr< Scene > _scene
Support de la structure acceleratrice pour la nappe.
Math library.
This class mainly define a mesh (list of Shape) used by the Simulation object.
Definition: Scene.h:50
virtual void clear()
Clear all the arrays.
Class to modify the scene geometry.
virtual void save_to_file(std::string fileName)
Export to a file.