Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Recepteur.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 RECEPTEUR_H
17 #define RECEPTEUR_H
18 
19 #include "Geometry/Shape.h"
20 #include "Geometry/Sphere.h"
21 #include "Geometry/mathlib.h"
22 #include "Base.h"
23 
27 class Recepteur : public Sphere
28 {
29 public:
31  Recepteur(){};
33  Recepteur(const vec3& pos, const decimal& r) : Sphere(pos, r)
34  {
35  name = "unknow receptor";
36  }
38  Recepteur(const Recepteur& other) : Sphere(other)
39  {
40  id = other.id;
41  }
43  virtual ~Recepteur() {}
46  {
47  return dynamic_cast<Shape*>(this);
48  }
49 
52  {
53  return this->getBBox().centroid;
54  }
55 
57  bool intersectionRecepteur(vec3& origine, vec3& directeur, float tmax, Intersection& result);
58 
60  unsigned int getId()
61  {
62  return id;
63  }
64  void setId(unsigned int _id)
65  {
66  id = _id;
67  }
68 
69 protected:
70  unsigned int id;
71 };
72 
73 #endif
vec3 centroid
Center point of the BBox.
Definition: BBox.h:37
std::string name
Each instantiated object may be named.
Definition: Base.h:52
Receptor inherits from a Sphere Shape.
Definition: Recepteur.h:28
Recepteur(const Recepteur &other)
Copy constructor.
Definition: Recepteur.h:38
Shape * getShape()
Return the Shape.
Definition: Recepteur.h:45
unsigned int id
Shape identification.
Definition: Recepteur.h:70
virtual ~Recepteur()
Destructor.
Definition: Recepteur.h:43
bool intersectionRecepteur(vec3 &origine, vec3 &directeur, float tmax, Intersection &result)
Get the Intersection between a ray and this shape.
Definition: Recepteur.cpp:19
unsigned int getId()
Get/Set identification.
Definition: Recepteur.h:60
void setId(unsigned int _id)
Definition: Recepteur.h:64
Recepteur()
Default constructor.
Definition: Recepteur.h:31
vec3 getPosition()
Get the center of the bounding box.
Definition: Recepteur.h:51
Recepteur(const vec3 &pos, const decimal &r)
Constructor.
Definition: Recepteur.h:33
base class for shapes (Cylindre, Mesh, Sphere, Triangle,...)
Definition: Shape.h:57
BBox getBBox()
Return the bounding box.
Definition: Shape.h:117
Sphere Shape.
Definition: Sphere.h:25
float decimal
Definition: mathlib.h:45
base_vec3< decimal > vec3
Definition: mathlib.h:381
Intersection struct.
Definition: Shape.h:46