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(
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 
150 
152  BaseVecT m_center;
153 
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 
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_ */
lvr2::FastBox::getDistances
void getDistances(float distances[], vector< QueryPoint< BaseVecT >> &query_points)
Calculates the distance value for the eight cell corners.
lvr2::FastBox::getCorners
void getCorners(BaseVecT corners[], vector< QueryPoint< BaseVecT >> &query_points)
Calculates the position of the eight cell corners.
lvr2::BoxTraits
Definition: FastBox.hpp:55
lvr2::BoxTraits::type
const static string type
Definition: FastBox.hpp:57
lvr2::FastBox::m_intersections
OptionalVertexHandle m_intersections[12]
The twelve intersection between box and surface.
Definition: FastBox.hpp:147
lvr2::OptionalVertexHandle
Semantically equivalent to boost::optional<VertexHandle>
Definition: Handles.hpp:176
lvr2::FastBox::~FastBox
virtual ~FastBox()
Destructor.NormalT.
Definition: FastBox.hpp:78
lvr2::FastBox::m_neighbors
FastBox< BaseVecT > * m_neighbors[27]
Pointer to all adjacent cells.
Definition: FastBox.hpp:155
lvr2::FastBox
A volume representation used by the standard Marching Cubes implementation.
Definition: FastBox.hpp:65
lvr2::FastBox::FastBox
FastBox(BaseVecT center)
Constructs a new box at the given center point defined by the used m_voxelsize}.
lvr2::FastBox::setVertex
void setVertex(int index, uint value)
Each cell vertex (0 to 7) as associated with a vertex in the reconstruction grid. This methods assign...
lvr2::FastBox::calcIntersection
float calcIntersection(float x1, float x2, float d1, float d2)
MCTable.hpp
lvr2::FastBox::BoxType
FastBox< BaseVecT > BoxType
Definition: FastBox.hpp:218
lvr2::FastBox::compareFloat
bool compareFloat(double num1, double num2)
Definition: FastBox.hpp:160
lvr2::FastBox::setNeighbor
void setNeighbor(int index, FastBox< BaseVecT > *cell)
Adjacent cells in the grid should use common vertices. This functions assigns the value of corner[ind...
lvr2::FastBox::INVALID_INDEX
static uint INVALID_INDEX
An index value that is used to reference vertices that are not in the grid.
Definition: FastBox.hpp:144
lvr2::FastBox::m_extruded
bool m_extruded
Definition: FastBox.hpp:148
lvr2::FastBox::distanceToBB
float distanceToBB(const BaseVecT &v, const BoundingBox< BaseVecT > &bb) const
lvr2::FastBox::m_vertices
uint m_vertices[8]
The eight box corners.
Definition: FastBox.hpp:214
lvr2::FastBox::m_center
BaseVecT m_center
The box center.
Definition: FastBox.hpp:152
lvr2::FastBox::getCenter
BaseVecT getCenter()
Definition: FastBox.hpp:111
lvr2::FastBox::m_voxelsize
static float m_voxelsize
The voxelsize of the reconstruction grid.
Definition: FastBox.hpp:141
lvr2::FastBox::getIndex
int getIndex(vector< QueryPoint< BaseVecT >> &query_points)
Calculated the index for the MC table.
lvr2::FastBox::getVertex
uint getVertex(int index)
Gets the vertex index of the queried cell corner.
lvr2::BoundingBox
A dynamic bounding box class.
Definition: BoundingBox.hpp:49
lvr2::FastBox::getSurface
virtual void getSurface(BaseMesh< BaseVecT > &mesh, vector< QueryPoint< BaseVecT >> &query_points, uint &globalIndex)
Performs a local reconstruction according to the standard Marching Cubes table from Paul Bourke.
lvr2::FastBox::getIntersections
void getIntersections(BaseVecT *corners, float *distance, BaseVecT *positions)
Calculated the 12 possible intersections between the cell and the surface to interpolate.
QueryPoint.hpp
lvr2::QueryPoint
A query Vector for marching cubes reconstructions. It represents a Vector in space together with a 'd...
Definition: QueryPoint.hpp:48
lvr2::FastBox::m_duplicate
bool m_duplicate
Definition: FastBox.hpp:149
lvr2
Definition: BaseBufferManipulators.hpp:39
FastBoxTables.hpp
lvr2::BaseMesh
Interface for triangle-meshes with adjacency information.
Definition: BaseMesh.hpp:140
uint
unsigned int uint
Definition: Model.hpp:46
lvr2::FastBox::getNeighbor
FastBox< BaseVecT > * getNeighbor(int index)
mesh
HalfEdgeMesh< Vec > mesh
Definition: src/tools/lvr2_gs_reconstruction/Main.cpp:26
Normal.hpp
lvr2::BilinearFastBox
Definition: BilinearFastBox.hpp:45


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 Wed Mar 2 2022 00:37:23