GlobeEngine
FDEBCommand.h
Go to the documentation of this file.
1 
8 #ifndef GlobeEngine_FDEBCommand_h
9 #define GlobeEngine_FDEBCommand_h
10 
11 #include <vector>
12 #include <vmmlib/vmmlib.hpp>
13 #include "OpenGL_Includes.h"
14 #include "GPUProgramFactory.h"
15 #include "VBOVertex.h"
16 #include "BundlingCommand.h"
17 #include "PolyLine.h"
18 #include "Timer.h"
20 #include <memory>
21 
22 namespace geGIS {
23 
24  class CommuterObject;
25 
27  {
30  double stiffness;
31  double threshold;
32  double move_factor;
33 
34  };
35 
37  {
38  /*struct CompatibilityMeasure
39  {
40  double* ca; // angle
41  double* cs; // scale
42  double* cp; // position
43  double* cv; // visibility
44  double* ce; // all together
45  double* l_avg; // all together
46  CompatibilityMeasure(int _edgeCount) {
47  this->ca = new double[_edgeCount];
48  this->cs = new double[_edgeCount];
49  this->cp = new double[_edgeCount];
50  this->cv = new double[_edgeCount];
51  this->ce = new double[_edgeCount];
52  this->l_avg = new double[_edgeCount];
53  }
54 
55  ~CompatibilityMeasure() {
56  if (this->ca != NULL) {
57  delete [] this->ca;
58  this->ca = NULL;
59  }
60  if (this->cs != NULL) {
61  delete [] this->cs;
62  this->cs = NULL;
63  }
64  if (this->cp != NULL) {
65  delete [] this->cp;
66  this->cp = NULL;
67  }
68  if (this->cv != NULL) {
69  delete [] this->cv;
70  this->cv = NULL;
71  }
72  if (this->ce != NULL) {
73  delete [] this->ce;
74  this->ce = NULL;
75  }
76  if (this->l_avg != NULL) {
77  delete [] this->l_avg;
78  this->l_avg = NULL;
79  }
80  }
81 
82  };*/
83 
84  public:
85  FDEBCommand();
86  ~FDEBCommand();
87  void clear();
88  void create(CommuterObject* _refInformation, const FDEBCommandProperties* _properties);
89  void processing(ge::GPUProgram* _program=NULL, ge::GPUProgramFactory* _manager=NULL);
90 
91 
92  void processingGPU();
93  void calculateForcesGPU();
94 
95 
96  void createSubdivisionsCPU();
97  //void doBasicLineSetup();
98  void calculateMeasures();
99  void calculateForcesCPU();
100  void setGPUMode(bool _input);
101  bool isGPUModeOn() { return this->gpumode; };
102  bool isOnlyUpdate() { return this->onlyUpdate; };
103 
104  void setInitialValues();
105  void setSubdivisions(int _input);
106  int getSubdivisions() const;
107  void setStiffness(double _input);
108  void setThreshold(double _input);
109  void setIterations(int _input);
110  void setMoveFactor(double _input);
111 
112  vmml::Vector2d rotation(vmml::Vector2d _point, double _alpha);
113  void calculateMeasureCA(int _idx_1, int _idx_2);
114  void calculateMeasureCS(int _idx_1, int _idx_2);
115  void calculateMeasureCP(int _idx_1, int _idx_2);
116 
117  const std::vector<vmml::Vector3d> getBundlingResult()const;
118  std::shared_ptr<geData::PolyLine> getResultLine(int _idx) const;
119 
120  int getPointsPerLine() const;
121  int getSegementsPerLine() const;
122 
123  void printMeasures();
124 
125  int getMultiObjectReferenceID() const;
126  void setMultiObjectReferenceID(int _idx);
127 
128  private:
129  using geGIS::BundlingCommand::create; // implicitly hidden
130  using geGIS::BundlingCommand::processing; // implicitly hidden
131 
132  void clearLineData();
133  vmml::Vector3d leftTilt(vmml::Vector3d _in);
134  vmml::Vector3d rightTilt(vmml::Vector3d _in);
135  double getDistToIm(vmml::Vector3d _Qmid, vmml::Vector3d _Q0Q1,vmml::Vector3d _P0, vmml::Vector3d _P0P1);
136  double getDistToImTest(vmml::Vector3d _Qmid, vmml::Vector3d _normQ0Q1,vmml::Vector3d _P0, vmml::Vector3d _P0P1, double s);
137  double getDistanceWheighting(vmml::Vector3d _Pm, vmml::Vector3d _Im, vmml::Vector3d _I0, vmml::Vector3d _I1);
138  double calculateCVMeasure(int _idx1, int _idx2);
139 
140  std::vector<vmml::Vector3d> midpoints;
141  std::vector<vmml::Vector3d> lineDirections;
142  std::vector<vmml::Vector3d> lineStrips;
143  std::vector<double> lengths;
144  //std::vector<CompatibilityMeasure*> measures;
145  std::vector< std::shared_ptr<FDEBCompatibilityMeasure> > measures;
146 
147  bool gpumode; // Calcuation mode on GPU or not (CPU)
148  bool onlyUpdate;
149  //int segments_per_line;
150  int points_per_line;
151 
152  int measure_arrayssize;
153  double* result_ca;
154 
155  double* entities_0;
156  double* entities_1;
157  double* resultSubDivLines;
158 
159  //vmml::Vector3d* linestrips;
160  //std::vector<PolyLine*> resPolyLines;
161  std::vector< std::shared_ptr<geData::PolyLine> > resPolyLines;
162  // GPU processing pointers
163  ge::GPUProgram* program;
164  ge::GPUProgramFactory* manager;
165 
166  FDEBCommandProperties properties;
167 
168  ge::Timer timer;
169 
170  // Reference to multiobject id
171  int multiObjectRefID;
172  };
173 }
174 #endif
void setMoveFactor(double _input)
Definition: FDEBCommand.cpp:700
bool isGPUModeOn()
Definition: FDEBCommand.h:101
virtual void processing()
Definition: BundlingCommand.h:25
double move_factor
Definition: FDEBCommand.h:32
std::shared_ptr< geData::PolyLine > getResultLine(int _idx) const
Definition: FDEBCommand.cpp:403
void processingGPU()
Definition: FDEBCommand.cpp:412
void setIterations(int _input)
Definition: FDEBCommand.cpp:695
Definition: BundlingCommand.h:18
void create(CommuterObject *_refInformation, const FDEBCommandProperties *_properties)
Definition: FDEBCommand.cpp:65
void calculateForcesGPU()
Definition: FDEBCommand.cpp:538
int getSubdivisions() const
Definition: FDEBCommand.cpp:680
Definition: ClusterGrid.h:17
int getPointsPerLine() const
Definition: FDEBCommand.cpp:710
Definition: GPUProgramFactory.h:24
void calculateMeasureCS(int _idx_1, int _idx_2)
Definition: FDEBCommand.cpp:358
void setThreshold(double _input)
Definition: FDEBCommand.cpp:690
int getSegementsPerLine() const
Definition: FDEBCommand.cpp:715
void setMultiObjectReferenceID(int _idx)
Definition: FDEBCommand.cpp:725
void clear()
Definition: FDEBCommand.cpp:20
void setStiffness(double _input)
Definition: FDEBCommand.cpp:685
void calculateMeasures()
Definition: FDEBCommand.cpp:231
bool isOnlyUpdate()
Definition: FDEBCommand.h:102
~FDEBCommand()
Definition: FDEBCommand.cpp:15
int subdivisions
Definition: FDEBCommand.h:29
double stiffness
Definition: FDEBCommand.h:30
void setGPUMode(bool _input)
Definition: FDEBCommand.cpp:705
virtual void create(CommuterObject *_refInformation)
Definition: BundlingCommand.cpp:22
void setInitialValues()
Definition: FDEBCommand.cpp:55
void createSubdivisionsCPU()
Definition: FDEBCommand.cpp:115
int iterations
Definition: FDEBCommand.h:28
Definition: FDEBCommand.h:26
void calculateMeasureCA(int _idx_1, int _idx_2)
Definition: FDEBCommand.cpp:351
Definition: CommuterObject.h:39
void setSubdivisions(int _input)
Definition: FDEBCommand.cpp:674
double threshold
Definition: FDEBCommand.h:31
const std::vector< vmml::Vector3d > getBundlingResult() const
Definition: FDEBCommand.cpp:398
Definition: Timer.h:17
int getMultiObjectReferenceID() const
Definition: FDEBCommand.cpp:720
void calculateForcesCPU()
Definition: FDEBCommand.cpp:273
FDEBCommand()
Definition: FDEBCommand.cpp:7
Definition: GPUProgramFactory.h:30
vmml::Vector2d rotation(vmml::Vector2d _point, double _alpha)
Definition: FDEBCommand.cpp:197
Definition: FDEBCommand.h:36
void calculateMeasureCP(int _idx_1, int _idx_2)
Definition: FDEBCommand.cpp:374
void printMeasures()
Definition: FDEBCommand.cpp:380