Point Cloud Library (PCL)  1.9.1-dev
grid_projection.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id$
35  *
36  */
37 
38 #pragma once
39 
40 #include <pcl/pcl_macros.h>
41 #include <pcl/surface/boost.h>
42 #include <pcl/surface/reconstruction.h>
43 
44 #include <unordered_map>
45 
46 namespace pcl
47 {
48  /** \brief The 12 edges of a cell. */
49  const int I_SHIFT_EP[12][2] = {
50  {0, 4}, {1, 5}, {2, 6}, {3, 7},
51  {0, 1}, {1, 2}, {2, 3}, {3, 0},
52  {4, 5}, {5, 6}, {6, 7}, {7, 4}
53  };
54 
55  const int I_SHIFT_PT[4] = {
56  0, 4, 5, 7
57  };
58 
59  const int I_SHIFT_EDGE[3][2] = {
60  {0,1}, {1,3}, {1,2}
61  };
62 
63 
64  /** \brief Grid projection surface reconstruction method.
65  * \author Rosie Li
66  *
67  * \note If you use this code in any academic work, please cite:
68  * - Ruosi Li, Lu Liu, Ly Phan, Sasakthi Abeysinghe, Cindy Grimm, Tao Ju.
69  * Polygonizing extremal surfaces with manifold guarantees.
70  * In Proceedings of the 14th ACM Symposium on Solid and Physical Modeling, 2010.
71  * \ingroup surface
72  */
73  template <typename PointNT>
74  class GridProjection : public SurfaceReconstruction<PointNT>
75  {
76  public:
77  using Ptr = boost::shared_ptr<GridProjection<PointNT> >;
78  using ConstPtr = boost::shared_ptr<const GridProjection<PointNT> >;
79 
82 
84 
86  using KdTreePtr = typename KdTree::Ptr;
87 
88  /** \brief Data leaf. */
89  struct Leaf
90  {
91  Leaf () {}
92 
93  std::vector<int> data_indices;
94  Eigen::Vector4f pt_on_surface;
95  Eigen::Vector3f vect_at_grid_pt;
96  };
97 
98  typedef std::unordered_map<int, Leaf, std::hash<int>, std::equal_to<>, Eigen::aligned_allocator<std::pair<const int, Leaf>>> HashMap;
99 
100  /** \brief Constructor. */
101  GridProjection ();
102 
103  /** \brief Constructor.
104  * \param in_resolution set the resolution of the grid
105  */
106  GridProjection (double in_resolution);
107 
108  /** \brief Destructor. */
109  ~GridProjection ();
110 
111  /** \brief Set the size of the grid cell
112  * \param resolution the size of the grid cell
113  */
114  inline void
115  setResolution (double resolution)
116  {
117  leaf_size_ = resolution;
118  }
119 
120  inline double
121  getResolution () const
122  {
123  return (leaf_size_);
124  }
125 
126  /** \brief When averaging the vectors, we find the union of all the input data
127  * points within the padding area,and do a weighted average. Say if the padding
128  * size is 1, when we process cell (x,y,z), we will find union of input data points
129  * from (x-1) to (x+1), (y-1) to (y+1), (z-1) to (z+1)(in total, 27 cells). In this
130  * way, even the cells itself doesn't contain any data points, we will still process it
131  * because there are data points in the padding area. This can help us fix holes which
132  * is smaller than the padding size.
133  * \param padding_size The num of padding cells we want to create
134  */
135  inline void
136  setPaddingSize (int padding_size)
137  {
138  padding_size_ = padding_size;
139  }
140  inline int
141  getPaddingSize () const
142  {
143  return (padding_size_);
144  }
145 
146  /** \brief Set this only when using the k nearest neighbors search
147  * instead of finding the point union
148  * \param k The number of nearest neighbors we are looking for
149  */
150  inline void
152  {
153  k_ = k;
154  }
155  inline int
157  {
158  return (k_);
159  }
160 
161  /** \brief Binary search is used in projection. given a point x, we find another point
162  * which is 3*cell_size_ far away from x. Then we do a binary search between these
163  * two points to find where the projected point should be.
164  */
165  inline void
166  setMaxBinarySearchLevel (int max_binary_search_level)
167  {
168  max_binary_search_level_ = max_binary_search_level;
169  }
170  inline int
172  {
173  return (max_binary_search_level_);
174  }
175 
176  ///////////////////////////////////////////////////////////
177  inline const HashMap&
178  getCellHashMap () const
179  {
180  return (cell_hash_map_);
181  }
182 
183  inline const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> >&
185  {
186  return (vector_at_data_point_);
187  }
188 
189  inline const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> >&
190  getSurface () const
191  {
192  return (surface_);
193  }
194 
195  protected:
196  /** \brief Get the bounding box for the input data points, also calculating the
197  * cell size, and the gaussian scale factor
198  */
199  void
200  getBoundingBox ();
201 
202  /** \brief The actual surface reconstruction method.
203  * \param[out] polygons the resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.
204  */
205  bool
206  reconstructPolygons (std::vector<pcl::Vertices> &polygons);
207 
208  /** \brief Create the surface.
209  *
210  * The 1st step is filling the padding, so that all the cells in the padding
211  * area are in the hash map. The 2nd step is store the vector, and projected
212  * point. The 3rd step is finding all the edges intersects the surface, and
213  * creating surface.
214  *
215  * \param[out] output the resultant polygonal mesh
216  */
217  void
218  performReconstruction (pcl::PolygonMesh &output) override;
219 
220  /** \brief Create the surface.
221  *
222  * The 1st step is filling the padding, so that all the cells in the padding
223  * area are in the hash map. The 2nd step is store the vector, and projected
224  * point. The 3rd step is finding all the edges intersects the surface, and
225  * creating surface.
226  *
227  * \param[out] points the resultant points lying on the surface
228  * \param[out] polygons the resultant polygons, as a set of vertices. The Vertices structure contains an array of point indices.
229  */
230  void
232  std::vector<pcl::Vertices> &polygons) override;
233 
234  /** \brief When the input data points don't fill into the 1*1*1 box,
235  * scale them so that they can be filled in the unit box. Otherwise,
236  * it will be some drawing problem when doing visulization
237  * \param scale_factor scale all the input data point by scale_factor
238  */
239  void
240  scaleInputDataPoint (double scale_factor);
241 
242  /** \brief Get the 3d index (x,y,z) of the cell based on the location of
243  * the cell
244  * \param p the coordinate of the input point
245  * \param index the output 3d index
246  */
247  inline void
248  getCellIndex (const Eigen::Vector4f &p, Eigen::Vector3i& index) const
249  {
250  for (int i = 0; i < 3; ++i)
251  index[i] = static_cast<int> ((p[i] - min_p_(i)) / leaf_size_);
252  }
253 
254  /** \brief Given the 3d index (x, y, z) of the cell, get the
255  * coordinates of the cell center
256  * \param index the output 3d index
257  * \param center the resultant cell center
258  */
259  inline void
260  getCellCenterFromIndex (const Eigen::Vector3i &index, Eigen::Vector4f &center) const
261  {
262  for (int i = 0; i < 3; ++i)
263  center[i] =
264  min_p_[i] + static_cast<float> (index[i]) *
265  static_cast<float> (leaf_size_) +
266  static_cast<float> (leaf_size_) / 2.0f;
267  }
268 
269  /** \brief Given cell center, caluate the coordinates of the eight vertices of the cell
270  * \param cell_center the coordinates of the cell center
271  * \param pts the coordinates of the 8 vertices
272  */
273  void
274  getVertexFromCellCenter (const Eigen::Vector4f &cell_center,
275  std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> > &pts) const;
276 
277  /** \brief Given an index (x, y, z) in 3d, translate it into the index
278  * in 1d
279  * \param index the index of the cell in (x,y,z) 3d format
280  */
281  inline int
282  getIndexIn1D (const Eigen::Vector3i &index) const
283  {
284  //assert(data_size_ > 0);
285  return (index[0] * data_size_ * data_size_ +
286  index[1] * data_size_ + index[2]);
287  }
288 
289  /** \brief Given an index in 1d, translate it into the index (x, y, z)
290  * in 3d
291  * \param index_1d the input 1d index
292  * \param index_3d the output 3d index
293  */
294  inline void
295  getIndexIn3D (int index_1d, Eigen::Vector3i& index_3d) const
296  {
297  //assert(data_size_ > 0);
298  index_3d[0] = index_1d / (data_size_ * data_size_);
299  index_1d -= index_3d[0] * data_size_ * data_size_;
300  index_3d[1] = index_1d / data_size_;
301  index_1d -= index_3d[1] * data_size_;
302  index_3d[2] = index_1d;
303  }
304 
305  /** \brief For a given 3d index of a cell, test whether the cells within its
306  * padding area exist in the hash table, if no, create an entry for that cell.
307  * \param index the index of the cell in (x,y,z) format
308  */
309  void
310  fillPad (const Eigen::Vector3i &index);
311 
312  /** \brief Obtain the index of a cell and the pad size.
313  * \param index the input index
314  * \param pt_union_indices the union of input data points within the cell and padding cells
315  */
316  void
317  getDataPtsUnion (const Eigen::Vector3i &index, std::vector <int> &pt_union_indices);
318 
319  /** \brief Given the index of a cell, exam it's up, left, front edges, and add
320  * the vectices to m_surface list.the up, left, front edges only share 4
321  * points, we first get the vectors at these 4 points and exam whether those
322  * three edges are intersected by the surface \param index the input index
323  * \param pt_union_indices the union of input data points within the cell and padding cells
324  */
325  void
326  createSurfaceForCell (const Eigen::Vector3i &index, std::vector <int> &pt_union_indices);
327 
328 
329  /** \brief Given the coordinates of one point, project it onto the surface,
330  * return the projected point. Do a binary search between p and p+projection_distance
331  * to find the projected point
332  * \param p the coordinates of the input point
333  * \param pt_union_indices the union of input data points within the cell and padding cells
334  * \param projection the resultant point projected
335  */
336  void
337  getProjection (const Eigen::Vector4f &p, std::vector<int> &pt_union_indices, Eigen::Vector4f &projection);
338 
339  /** \brief Given the coordinates of one point, project it onto the surface,
340  * return the projected point. Find the plane which fits all the points in
341  * pt_union_indices, projected p to the plane to get the projected point.
342  * \param p the coordinates of the input point
343  * \param pt_union_indices the union of input data points within the cell and padding cells
344  * \param projection the resultant point projected
345  */
346  void
347  getProjectionWithPlaneFit (const Eigen::Vector4f &p,
348  std::vector<int> &pt_union_indices,
349  Eigen::Vector4f &projection);
350 
351 
352  /** \brief Given the location of a point, get it's vector
353  * \param p the coordinates of the input point
354  * \param pt_union_indices the union of input data points within the cell and padding cells
355  * \param vo the resultant vector
356  */
357  void
358  getVectorAtPoint (const Eigen::Vector4f &p,
359  std::vector <int> &pt_union_indices, Eigen::Vector3f &vo);
360 
361  /** \brief Given the location of a point, get it's vector
362  * \param p the coordinates of the input point
363  * \param k_indices the k nearest neighbors of the query point
364  * \param k_squared_distances the squared distances of the k nearest
365  * neighbors to the query point
366  * \param vo the resultant vector
367  */
368  void
369  getVectorAtPointKNN (const Eigen::Vector4f &p,
370  std::vector<int> &k_indices,
371  std::vector<float> &k_squared_distances,
372  Eigen::Vector3f &vo);
373 
374  /** \brief Get the magnitude of the vector by summing up the distance.
375  * \param p the coordinate of the input point
376  * \param pt_union_indices the union of input data points within the cell and padding cells
377  */
378  double
379  getMagAtPoint (const Eigen::Vector4f &p, const std::vector <int> &pt_union_indices);
380 
381  /** \brief Get the 1st derivative
382  * \param p the coordinate of the input point
383  * \param vec the vector at point p
384  * \param pt_union_indices the union of input data points within the cell and padding cells
385  */
386  double
387  getD1AtPoint (const Eigen::Vector4f &p, const Eigen::Vector3f &vec,
388  const std::vector <int> &pt_union_indices);
389 
390  /** \brief Get the 2nd derivative
391  * \param p the coordinate of the input point
392  * \param vec the vector at point p
393  * \param pt_union_indices the union of input data points within the cell and padding cells
394  */
395  double
396  getD2AtPoint (const Eigen::Vector4f &p, const Eigen::Vector3f &vec,
397  const std::vector <int> &pt_union_indices);
398 
399  /** \brief Test whether the edge is intersected by the surface by
400  * doing the dot product of the vector at two end points. Also test
401  * whether the edge is intersected by the maximum surface by examing
402  * the 2nd derivative of the intersection point
403  * \param end_pts the two points of the edge
404  * \param vect_at_end_pts
405  * \param pt_union_indices the union of input data points within the cell and padding cells
406  */
407  bool
408  isIntersected (const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> > &end_pts,
409  std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > &vect_at_end_pts,
410  std::vector <int> &pt_union_indices);
411 
412  /** \brief Find point where the edge intersects the surface.
413  * \param level binary search level
414  * \param end_pts the two end points on the edge
415  * \param vect_at_end_pts the vectors at the two end points
416  * \param start_pt the starting point we use for binary search
417  * \param pt_union_indices the union of input data points within the cell and padding cells
418  * \param intersection the resultant intersection point
419  */
420  void
421  findIntersection (int level,
422  const std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> > &end_pts,
423  const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > &vect_at_end_pts,
424  const Eigen::Vector4f &start_pt,
425  std::vector<int> &pt_union_indices,
426  Eigen::Vector4f &intersection);
427 
428  /** \brief Go through all the entries in the hash table and update the
429  * cellData.
430  *
431  * When creating the hash table, the pt_on_surface field store the center
432  * point of the cell.After calling this function, the projection operator will
433  * project the center point onto the surface, and the pt_on_surface field will
434  * be updated using the projected point.Also the vect_at_grid_pt field will be
435  * updated using the vector at the upper left front vertex of the cell.
436  *
437  * \param index_1d the index of the cell after flatting it's 3d index into a 1d array
438  * \param index_3d the index of the cell in (x,y,z) 3d format
439  * \param pt_union_indices the union of input data points within the cell and pads
440  * \param cell_data information stored in the cell
441  */
442  void
443  storeVectAndSurfacePoint (int index_1d, const Eigen::Vector3i &index_3d,
444  std::vector<int> &pt_union_indices, const Leaf &cell_data);
445 
446  /** \brief Go through all the entries in the hash table and update the cellData.
447  * When creating the hash table, the pt_on_surface field store the center point
448  * of the cell.After calling this function, the projection operator will project the
449  * center point onto the surface, and the pt_on_surface field will be updated
450  * using the projected point.Also the vect_at_grid_pt field will be updated using
451  * the vector at the upper left front vertex of the cell. When projecting the point
452  * and calculating the vector, using K nearest neighbors instead of using the
453  * union of input data point within the cell and pads.
454  *
455  * \param index_1d the index of the cell after flatting it's 3d index into a 1d array
456  * \param index_3d the index of the cell in (x,y,z) 3d format
457  * \param cell_data information stored in the cell
458  */
459  void
460  storeVectAndSurfacePointKNN (int index_1d, const Eigen::Vector3i &index_3d, const Leaf &cell_data);
461 
462  private:
463  /** \brief Map containing the set of leaves. */
464  HashMap cell_hash_map_;
465 
466  /** \brief Min and max data points. */
467  Eigen::Vector4f min_p_, max_p_;
468 
469  /** \brief The size of a leaf. */
470  double leaf_size_;
471 
472  /** \brief Gaussian scale. */
473  double gaussian_scale_;
474 
475  /** \brief Data size. */
476  int data_size_;
477 
478  /** \brief Max binary search level. */
479  int max_binary_search_level_;
480 
481  /** \brief Number of neighbors (k) to use. */
482  int k_;
483 
484  /** \brief Padding size. */
485  int padding_size_;
486 
487  /** \brief The point cloud input (XYZ+Normals). */
488  PointCloudPtr data_;
489 
490  /** \brief Store the surface normal(vector) at the each input data point. */
491  std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f> > vector_at_data_point_;
492 
493  /** \brief An array of points which lay on the output surface. */
494  std::vector<Eigen::Vector4f, Eigen::aligned_allocator<Eigen::Vector4f> > surface_;
495 
496  /** \brief Bit map which tells if there is any input data point in the cell. */
497  boost::dynamic_bitset<> occupied_cell_list_;
498 
499  /** \brief Class get name method. */
500  std::string getClassName () const override { return ("GridProjection"); }
501 
502  public:
504  };
505 }
~GridProjection()
Destructor.
void getCellIndex(const Eigen::Vector4f &p, Eigen::Vector3i &index) const
Get the 3d index (x,y,z) of the cell based on the location of the cell.
bool isIntersected(const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &end_pts, std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &vect_at_end_pts, std::vector< int > &pt_union_indices)
Test whether the edge is intersected by the surface by doing the dot product of the vector at two end...
void setMaxBinarySearchLevel(int max_binary_search_level)
Binary search is used in projection.
double getD1AtPoint(const Eigen::Vector4f &p, const Eigen::Vector3f &vec, const std::vector< int > &pt_union_indices)
Get the 1st derivative.
void getProjection(const Eigen::Vector4f &p, std::vector< int > &pt_union_indices, Eigen::Vector4f &projection)
Given the coordinates of one point, project it onto the surface, return the projected point...
typename KdTree::Ptr KdTreePtr
std::unordered_map< int, Leaf, std::hash< int >, std::equal_to<>, Eigen::aligned_allocator< std::pair< const int, Leaf > > > HashMap
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
SurfaceReconstruction represents a base surface reconstruction class.
void scaleInputDataPoint(double scale_factor)
When the input data points don&#39;t fill into the 1*1*1 box, scale them so that they can be filled in th...
const int I_SHIFT_PT[4]
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: pcl_macros.h:344
void getIndexIn3D(int index_1d, Eigen::Vector3i &index_3d) const
Given an index in 1d, translate it into the index (x, y, z) in 3d.
int getNearestNeighborNum() const
Eigen::Vector4f pt_on_surface
boost::shared_ptr< KdTree< PointT > > Ptr
Definition: kdtree.h:70
void storeVectAndSurfacePointKNN(int index_1d, const Eigen::Vector3i &index_3d, const Leaf &cell_data)
Go through all the entries in the hash table and update the cellData.
std::vector< int > data_indices
void getBoundingBox()
Get the bounding box for the input data points, also calculating the cell size, and the gaussian scal...
const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > & getSurface() const
boost::shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:429
void createSurfaceForCell(const Eigen::Vector3i &index, std::vector< int > &pt_union_indices)
Given the index of a cell, exam it&#39;s up, left, front edges, and add the vectices to m_surface list...
void setPaddingSize(int padding_size)
When averaging the vectors, we find the union of all the input data points within the padding area...
int getMaxBinarySearchLevel() const
boost::shared_ptr< GridProjection< PointNT > > Ptr
void fillPad(const Eigen::Vector3i &index)
For a given 3d index of a cell, test whether the cells within its padding area exist in the hash tabl...
boost::shared_ptr< const GridProjection< PointNT > > ConstPtr
void getCellCenterFromIndex(const Eigen::Vector3i &index, Eigen::Vector4f &center) const
Given the 3d index (x, y, z) of the cell, get the coordinates of the cell center. ...
const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > & getVectorAtDataPoint() const
Grid projection surface reconstruction method.
void setNearestNeighborNum(int k)
Set this only when using the k nearest neighbors search instead of finding the point union...
void getDataPtsUnion(const Eigen::Vector3i &index, std::vector< int > &pt_union_indices)
Obtain the index of a cell and the pad size.
double getMagAtPoint(const Eigen::Vector4f &p, const std::vector< int > &pt_union_indices)
Get the magnitude of the vector by summing up the distance.
Eigen::Vector3f vect_at_grid_pt
void storeVectAndSurfacePoint(int index_1d, const Eigen::Vector3i &index_3d, std::vector< int > &pt_union_indices, const Leaf &cell_data)
Go through all the entries in the hash table and update the cellData.
void performReconstruction(pcl::PolygonMesh &output) override
Create the surface.
typename pcl::PointCloud< PointNT >::Ptr PointCloudPtr
double getD2AtPoint(const Eigen::Vector4f &p, const Eigen::Vector3f &vec, const std::vector< int > &pt_union_indices)
Get the 2nd derivative.
const HashMap & getCellHashMap() const
const int I_SHIFT_EP[12][2]
The 12 edges of a cell.
void getVectorAtPointKNN(const Eigen::Vector4f &p, std::vector< int > &k_indices, std::vector< float > &k_squared_distances, Eigen::Vector3f &vo)
Given the location of a point, get it&#39;s vector.
void findIntersection(int level, const std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &end_pts, const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &vect_at_end_pts, const Eigen::Vector4f &start_pt, std::vector< int > &pt_union_indices, Eigen::Vector4f &intersection)
Find point where the edge intersects the surface.
int getPaddingSize() const
void getVertexFromCellCenter(const Eigen::Vector4f &cell_center, std::vector< Eigen::Vector4f, Eigen::aligned_allocator< Eigen::Vector4f > > &pts) const
Given cell center, caluate the coordinates of the eight vertices of the cell.
void setResolution(double resolution)
Set the size of the grid cell.
void getProjectionWithPlaneFit(const Eigen::Vector4f &p, std::vector< int > &pt_union_indices, Eigen::Vector4f &projection)
Given the coordinates of one point, project it onto the surface, return the projected point...
int getIndexIn1D(const Eigen::Vector3i &index) const
Given an index (x, y, z) in 3d, translate it into the index in 1d.
const int I_SHIFT_EDGE[3][2]
bool reconstructPolygons(std::vector< pcl::Vertices > &polygons)
The actual surface reconstruction method.
KdTree represents the base spatial locator class for kd-tree implementations.
Definition: kdtree.h:55
void getVectorAtPoint(const Eigen::Vector4f &p, std::vector< int > &pt_union_indices, Eigen::Vector3f &vo)
Given the location of a point, get it&#39;s vector.
GridProjection()
Constructor.
double getResolution() const