Code_TYMPAN  4.2.0
Industrial site acoustic simulation
TargetManager.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 TARGETMANAGER_H
17 #define TARGETMANAGER_H
18 
19 #include "Geometry/mathlib.h"
20 #include <vector>
21 #include <set>
22 
27 {
28 
29 public:
33  bool registerTarget(const vec3 newTarget);
35  bool registerTargets(std::vector<vec3>& newTargets);
37  void finish();
39  unsigned int getTargetsAround(const vec3 center, unsigned int nbTargets, decimal distance, std::vector<vec3>& result);
41  std::vector<vec3>& getTargets() { return targets; }
42 
43 protected:
44  std::vector<vec3> targets;
45  std::set<vec3> uniqueTargets;
46 };
47 
48 #endif
unsigned int getTargetsAround(const vec3 center, unsigned int nbTargets, decimal distance, std::vector< vec3 > &result)
Get the targets in a distance range from a center.
std::set< vec3 > uniqueTargets
Set of single targets.
Definition: TargetManager.h:45
bool registerTargets(std::vector< vec3 > &newTargets)
Register a vector of targets.
base_vec3< decimal > vec3
Definition: mathlib.h:269
std::vector< vec3 > & getTargets()
Return the targets.
Definition: TargetManager.h:41
Class to manage targets.
Definition: TargetManager.h:26
float decimal
Definition: mathlib.h:46
std::vector< vec3 > targets
Vector of targets.
Definition: TargetManager.h:44
void finish()
Delete the uniqueTargets array.
TargetManager()
Constructor.
Definition: TargetManager.h:31
bool registerTarget(const vec3 newTarget)
Register a new target.