Point Cloud Library (PCL)  1.11.1
marching_cubes_hoppe.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  */
35 
36 #pragma once
37 
38 #include <pcl/memory.h>
39 #include <pcl/pcl_macros.h>
40 #include <pcl/surface/boost.h>
41 #include <pcl/surface/marching_cubes.h>
42 
43 namespace pcl
44 {
45  /** \brief The marching cubes surface reconstruction algorithm, using a signed distance function based on the distance
46  * from tangent planes, proposed by Hoppe et. al. in:
47  * Hoppe H., DeRose T., Duchamp T., MC-Donald J., Stuetzle W., "Surface reconstruction from unorganized points",
48  * SIGGRAPH '92
49  * \author Alexandru E. Ichim
50  * \ingroup surface
51  */
52  template <typename PointNT>
53  class MarchingCubesHoppe : public MarchingCubes<PointNT>
54  {
55  public:
56  using Ptr = shared_ptr<MarchingCubesHoppe<PointNT> >;
57  using ConstPtr = shared_ptr<const MarchingCubesHoppe<PointNT> >;
58 
68 
70 
72  using KdTreePtr = typename KdTree::Ptr;
73 
74 
75  /** \brief Constructor. */
76  MarchingCubesHoppe (const float dist_ignore = -1.0f,
77  const float percentage_extend_grid = 0.0f,
78  const float iso_level = 0.0f) :
79  MarchingCubes<PointNT> (percentage_extend_grid, iso_level),
80  dist_ignore_ (dist_ignore)
81  {
82  }
83 
84  /** \brief Destructor. */
86 
87  /** \brief Convert the point cloud into voxel data.
88  */
89  void
90  voxelizeData () override;
91 
92  /** \brief Method that sets the distance for ignoring voxels which are far from point cloud.
93  * If the distance is negative, then the distance functions would be calculated in all voxels;
94  * otherwise, only voxels with distance lower than dist_ignore would be involved in marching cube.
95  * \param[in] dist_ignore threshold of distance. Default value is -1.0. Set to negative if all voxels are
96  * to be involved.
97  */
98  inline void
99  setDistanceIgnore (const float dist_ignore)
100  { dist_ignore_ = dist_ignore; }
101 
102  /** \brief get the distance for ignoring voxels which are far from point cloud.
103  * */
104  inline float
106  { return dist_ignore_; }
107 
108  protected:
109  /** \brief ignore the distance function
110  * if it is negative
111  * or distance between voxel centroid and point are larger that it. */
113 
114  public:
116  };
117 }
118 
119 #ifdef PCL_NO_PRECOMPILE
120 #include <pcl/surface/impl/marching_cubes_hoppe.hpp>
121 #endif
void setDistanceIgnore(const float dist_ignore)
Method that sets the distance for ignoring voxels which are far from point cloud. ...
float getDistanceIgnore() const
get the distance for ignoring voxels which are far from point cloud.
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:429
Defines functions, macros and traits for allocating and using memory.
shared_ptr< const MarchingCubes< PointNT > > ConstPtr
typename KdTree::Ptr KdTreePtr
The marching cubes surface reconstruction algorithm.
MarchingCubesHoppe(const float dist_ignore=-1.0f, const float percentage_extend_grid=0.0f, const float iso_level=0.0f)
Constructor.
void voxelizeData() override
Convert the point cloud into voxel data.
SurfaceReconstruction represents a base surface reconstruction class.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
shared_ptr< KdTree< PointT > > Ptr
Definition: kdtree.h:70
The marching cubes surface reconstruction algorithm, using a signed distance function based on the di...
typename pcl::PointCloud< PointNT >::Ptr PointCloudPtr
shared_ptr< MarchingCubes< PointNT > > Ptr
float dist_ignore_
ignore the distance function if it is negative or distance between voxel centroid and point are large...
KdTree represents the base spatial locator class for kd-tree implementations.
Definition: kdtree.h:56
Defines all the PCL and non-PCL macros used.