Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
reconstruction.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id: reconstruction.h 6112 2012-07-03 17:57:04Z aichim $
37  *
38  */
39 
40 #ifndef PCL_SURFACE_RECONSTRUCTION_H_
41 #define PCL_SURFACE_RECONSTRUCTION_H_
42 
43 #include <pcl/pcl_base.h>
44 #include <pcl/PolygonMesh.h>
45 #include <pcl/search/pcl_search.h>
46 #include <pcl/ros/conversions.h>
47 #include <boost/bind.hpp>
48 #include <boost/function.hpp>
49 
50 namespace pcl
51 {
61  template <typename PointInT>
62  class PCLSurfaceBase: public PCLBase<PointInT>
63  {
64  public:
67 
69  PCLSurfaceBase () : tree_ () {}
70 
74  inline void
75  setSearchMethod (const KdTreePtr &tree)
76  {
77  tree_ = tree;
78  }
79 
81  inline KdTreePtr
82  getSearchMethod () { return (tree_); }
83 
88  virtual void
89  reconstruct (pcl::PolygonMesh &output) = 0;
90 
91  protected:
93  KdTreePtr tree_;
94 
96  virtual std::string
97  getClassName () const { return (""); }
98  };
99 
113  template <typename PointInT>
114  class SurfaceReconstruction: public PCLSurfaceBase<PointInT>
115  {
116  public:
123 
125  SurfaceReconstruction () : check_tree_ (true) {}
126 
129 
134  virtual void
135  reconstruct (pcl::PolygonMesh &output);
136 
143  virtual void
145  std::vector<pcl::Vertices> &polygons);
146 
147  protected:
150  bool check_tree_;
151 
155  virtual void
156  performReconstruction (pcl::PolygonMesh &output) = 0;
157 
162  virtual void
163  performReconstruction (pcl::PointCloud<PointInT> &points,
164  std::vector<pcl::Vertices> &polygons) = 0;
165  };
166 
179  template <typename PointInT>
180  class MeshConstruction: public PCLSurfaceBase<PointInT>
181  {
182  public:
189 
191  MeshConstruction () : check_tree_ (true) {}
192 
194  virtual ~MeshConstruction () {}
195 
205  virtual void
206  reconstruct (pcl::PolygonMesh &output);
207 
213  virtual void
214  reconstruct (std::vector<pcl::Vertices> &polygons);
215 
216  protected:
219  bool check_tree_;
220 
224  virtual void
225  performReconstruction (pcl::PolygonMesh &output) = 0;
226 
230  virtual void
231  performReconstruction (std::vector<pcl::Vertices> &polygons) = 0;
232  };
233 }
234 
236 
237 #endif // PCL_SURFACE_RECONSTRUCTION_H_
238