Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Cylindre.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 CYLINDRE_H
17 #define CYLINDRE_H
18 
19 #include "Geometry/Shape.h"
20 #include "Geometry/Repere.h"
21 
22 class Ray;
26 class Cylindre : public Shape
27 {
28 public:
30  Cylindre(Shape* _p1 = NULL, Shape* _p2 = NULL, std::vector<vec3>* _vertices = NULL, unsigned int v1 = 0,
31  unsigned int v2 = 1, decimal _epaisseur = 0.2);
32  Cylindre(const Cylindre& other);
34  virtual ~Cylindre(){};
36  virtual bool isVisible()
37  {
38  return false;
39  }
40 
41  virtual bool getIntersection(Ray& ray, Intersection& inter);
42 
44  {
45  angleOuverture = angle;
46  }
49  {
50  return angleOuverture;
51  }
52 
55  {
56  return p1;
57  }
60  {
61  return p2;
62  }
63 
65  virtual bool sample(decimal density, std::vector<vec3>& samples);
66  virtual int form()
67  {
68  return CYLINDRE;
69  }
70 
71 protected:
72  void computeMesh();
73 
74  //|\ /|
75  //| \ / |
76  //| \ / |
77  //| \ / |
78  //| \ / |
79  //| p1 \.-./ p2 |
80  //| ( \ / ) |
81  // \ |'-|-'| /
82  // \ | | | /
83  // \ | | | /
84  // \| | |/
85  // \ | /
86  // |\.|./|
87  // ( \|/ )
88  // ' - '
89 
90  Shape* p1;
91  Shape* p2;
92 
96 
98 
99  vector<vec3> points;
100  vector<Shape*> mesh;
101 };
102 
103 #endif
@ CYLINDRE
Definition: Shape.h:37
Cylinder class.
Definition: Cylindre.h:27
vector< vec3 > points
Array of points defining the mesh.
Definition: Cylindre.h:99
virtual ~Cylindre()
Destructor.
Definition: Cylindre.h:34
vector< Shape * > mesh
Cylinder mesh (array of triangles)
Definition: Cylindre.h:100
virtual int form()
Return type of the shape.
Definition: Cylindre.h:66
virtual bool sample(decimal density, std::vector< vec3 > &samples)
Uncommented cause not used:
Definition: Cylindre.cpp:177
decimal hauteur
Height.
Definition: Cylindre.h:94
decimal getAngleOuverture()
Get opening angle.
Definition: Cylindre.h:48
decimal epaisseur
Width.
Definition: Cylindre.h:93
Cylindre(Shape *_p1=NULL, Shape *_p2=NULL, std::vector< vec3 > *_vertices=NULL, unsigned int v1=0, unsigned int v2=1, decimal _epaisseur=0.2)
Constructors.
Definition: Cylindre.cpp:19
Shape * getSecondShape()
Get the second shape.
Definition: Cylindre.h:59
decimal angleOuverture
Opening angle.
Definition: Cylindre.h:95
virtual bool isVisible()
A cylinder is not visible.
Definition: Cylindre.h:36
Shape * p1
First shape of the diffraction edge represented by the Cylinder.
Definition: Cylindre.h:90
virtual bool getIntersection(Ray &ray, Intersection &inter)
Get the Intersection between a ray and this shape.
Definition: Cylindre.cpp:106
Shape * getFirstShape()
Get the first shape.
Definition: Cylindre.h:54
Shape * p2
Second shape of the diffraction edge represented by the Cylinder.
Definition: Cylindre.h:91
void setAngleOuverture(decimal angle)
Definition: Cylindre.h:43
Repere localRepere
Local frame.
Definition: Cylindre.h:97
void computeMesh()
Definition: Cylindre.cpp:129
: Describes a ray by a pair of unsigned int. The first one gives the source number (in the range 0-40...
Definition: Ray.h:38
Frame class.
Definition: Repere.h:26
base class for shapes (Cylindre, Mesh, Sphere, Triangle,...)
Definition: Shape.h:57
float decimal
Definition: mathlib.h:45
Intersection struct.
Definition: Shape.h:46