FastBox.hpp
Go to the documentation of this file.
1 
28  /*
29  * FastBox.h
30  *
31  * Created on: 03.03.2011
32  * Author: Thomas Wiemann
33  */
34 
35 #ifndef _LVR2_RECONSTRUCTION_FASTBOX_H_
36 #define _LVR2_RECONSTRUCTION_FASTBOX_H_
37 
40 
41 #include "lvr2/geometry/Normal.hpp"
42 
43 #include "QueryPoint.hpp"
44 
45 #include <vector>
46 #include <limits>
47 
48 using std::vector;
49 using std::numeric_limits;
50 
51 namespace lvr2
52 {
53 
54 template<typename BoxT>
55 struct BoxTraits
56 {
57  const static string type;
58 };
59 
64 template<typename BaseVecT>
65 class FastBox
66 {
67 public:
68 
73  FastBox(BaseVecT center);
74 
78  virtual ~FastBox() {};
79 
88  void setVertex(int index, uint value);
89 
98  void setNeighbor(int index, FastBox<BaseVecT>* cell);
99 
106  uint getVertex(int index);
107 
108 
109  FastBox<BaseVecT>* getNeighbor(int index);
110 
111  inline BaseVecT getCenter() { return m_center; }
112 
113 
125  virtual void getSurface(
127  vector<QueryPoint<BaseVecT>>& query_points,
128  uint &globalIndex
129  );
130 
131  virtual void getSurface(
132  BaseMesh<BaseVecT>& mesh,
133  vector<QueryPoint<BaseVecT>>& query_points,
134  uint& globalIndex,
136  vector<unsigned int>& duplicates,
137  float comparePrecision
138  );
139 
141  static float m_voxelsize;
142 
145 
147  OptionalVertexHandle m_intersections[12];
150 
152  BaseVecT m_center;
153 
155  FastBox<BaseVecT>* m_neighbors[27];
156 
157 protected:
158 
159 
160  inline bool compareFloat(double num1, double num2)
161  {
162  if(fabs(num1 - num2) < std::numeric_limits<double>::epsilon())
163  return true;
164  else
165  return false;
166  }
167 
171  int getIndex(vector<QueryPoint<BaseVecT>>& query_points);
172 
181  void getIntersections(BaseVecT* corners, float* distance, BaseVecT* positions);
182 
189  void getCorners(BaseVecT corners[], vector<QueryPoint<BaseVecT>>& query_points);
190 
197  void getDistances(float distances[], vector<QueryPoint<BaseVecT>>& query_points);
198 
199  /***
200  * @brief Interpolates the intersection between x1 and x1.
201  *
202  * @param x1 The first coordinate
203  * @param x2 The second coordinate
204  * @param d1 The distance value for the first coordinate
205  * @param d2 The distance value for the second coordinate
206  * @return The interpolated distance.
207  */
208  float calcIntersection(float x1, float x2, float d1, float d2);
209 
210  float distanceToBB(const BaseVecT& v, const BoundingBox<BaseVecT>& bb) const;
211 
212 
214  uint m_vertices[8];
215 
216  template <typename T> friend class BilinearFastBox;
217 
219 };
220 
221 } // namespace lvr2
222 
223 #include "lvr2/reconstruction/FastBox.tcc"
224 
225 #endif /* _LVR2_RECONSTRUCTION_FASTBOX_H_ */
FastBox< BaseVecT > BoxType
Definition: FastBox.hpp:218
BaseVecT m_center
The box center.
Definition: FastBox.hpp:152
HalfEdgeMesh< Vec > mesh
bool m_extruded
Definition: FastBox.hpp:148
static uint INVALID_INDEX
An index value that is used to reference vertices that are not in the grid.
Definition: FastBox.hpp:144
Semantically equivalent to boost::optional<VertexHandle>
Definition: Handles.hpp:176
Interface for triangle-meshes with adjacency information.
Definition: BaseMesh.hpp:140
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
static float m_voxelsize
The voxelsize of the reconstruction grid.
Definition: FastBox.hpp:141
static const string type
Definition: FastBox.hpp:57
A query Vector for marching cubes reconstructions. It represents a Vector in space together with a &#39;d...
Definition: QueryPoint.hpp:48
bool compareFloat(double num1, double num2)
Definition: FastBox.hpp:160
BaseVecT getCenter()
Definition: FastBox.hpp:111
virtual ~FastBox()
Destructor.NormalT.
Definition: FastBox.hpp:78
unsigned int uint
Definition: Model.hpp:46
bool m_duplicate
Definition: FastBox.hpp:149
A volume representation used by the standard Marching Cubes implementation.
Definition: FastBox.hpp:65


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Mon Feb 28 2022 22:46:06