Code_TYMPAN  4.4.0
Industrial site acoustic simulation
Recepteur.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012-2024> <EDF-DTG> <FRANCE>
3  * This file is part of Code_TYMPAN (R).
4  * Code_TYMPAN (R) is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  * Code_TYMPAN (R) is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  * See the GNU General Public License for more details.
12  * You should have received a copy of the GNU General Public License along
13  * with Code_TYMPAN (R). If not, see <https://www.gnu.org/licenses/>.
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:387
Intersection struct.
Definition: Shape.h:46