Point Cloud Library (PCL)  1.11.0
marching_cubes_rbf.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 radial
46  * basis functions. Partially based on:
47  * Carr J.C., Beatson R.K., Cherrie J.B., Mitchell T.J., Fright W.R., McCallum B.C. and Evans T.R.,
48  * "Reconstruction and representation of 3D objects with radial basis functions"
49  * SIGGRAPH '01
50  *
51  * \author Alexandru E. Ichim
52  * \ingroup surface
53  */
54  template <typename PointNT>
55  class MarchingCubesRBF : public MarchingCubes<PointNT>
56  {
57  public:
58  using Ptr = shared_ptr<MarchingCubesRBF<PointNT> >;
59  using ConstPtr = shared_ptr<const MarchingCubesRBF<PointNT> >;
60 
70 
72 
74  using KdTreePtr = typename KdTree::Ptr;
75 
76 
77  /** \brief Constructor. */
78  MarchingCubesRBF (const float off_surface_epsilon = 0.1f,
79  const float percentage_extend_grid = 0.0f,
80  const float iso_level = 0.0f) :
81  MarchingCubes<PointNT> (percentage_extend_grid, iso_level),
82  off_surface_epsilon_ (off_surface_epsilon)
83  {
84  }
85 
86  /** \brief Destructor. */
88 
89  /** \brief Convert the point cloud into voxel data.
90  */
91  void
92  voxelizeData () override;
93 
94 
95  /** \brief Set the off-surface points displacement value.
96  * \param[in] epsilon the value
97  */
98  inline void
99  setOffSurfaceDisplacement (float epsilon)
100  { off_surface_epsilon_ = epsilon; }
101 
102  /** \brief Get the off-surface points displacement value. */
103  inline float
105  { return off_surface_epsilon_; }
106 
107 
108  protected:
109  /** \brief the Radial Basis Function kernel. */
110  double
111  kernel (Eigen::Vector3d c, Eigen::Vector3d x);
112 
113  /** \brief The off-surface displacement value. */
115 
116  public:
118  };
119 }
120 
121 #ifdef PCL_NO_PRECOMPILE
122 #include <pcl/surface/impl/marching_cubes_rbf.hpp>
123 #endif
KdTree represents the base spatial locator class for kd-tree implementations.
Definition: kdtree.h:57
shared_ptr< KdTree< PointT > > Ptr
Definition: kdtree.h:70
The marching cubes surface reconstruction algorithm.
typename KdTree::Ptr KdTreePtr
typename pcl::PointCloud< PointNT >::Ptr PointCloudPtr
shared_ptr< MarchingCubes< PointNT > > Ptr
shared_ptr< const MarchingCubes< PointNT > > ConstPtr
The marching cubes surface reconstruction algorithm, using a signed distance function based on radial...
float getOffSurfaceDisplacement()
Get the off-surface points displacement value.
void setOffSurfaceDisplacement(float epsilon)
Set the off-surface points displacement value.
float off_surface_epsilon_
The off-surface displacement value.
void voxelizeData() override
Convert the point cloud into voxel data.
MarchingCubesRBF(const float off_surface_epsilon=0.1f, const float percentage_extend_grid=0.0f, const float iso_level=0.0f)
Constructor.
double kernel(Eigen::Vector3d c, Eigen::Vector3d x)
the Radial Basis Function kernel.
shared_ptr< PointCloud< PointT > > Ptr
Definition: point_cloud.h:428
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
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.