00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Point Cloud Library (PCL) - www.pointclouds.org 00005 * Copyright (c) 2010-2012, Willow Garage, Inc. 00006 * 00007 * All rights reserved. 00008 * 00009 * Redistribution and use in source and binary forms, with or without 00010 * modification, are permitted provided that the following conditions 00011 * are met: 00012 * 00013 * * Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * * Redistributions in binary form must reproduce the above 00016 * copyright notice, this list of conditions and the following 00017 * disclaimer in the documentation and/or other materials provided 00018 * with the distribution. 00019 * * Neither the name of Willow Garage, Inc. nor the names of its 00020 * contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00026 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00027 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00028 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00029 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00030 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00032 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00033 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00034 * POSSIBILITY OF SUCH DAMAGE. 00035 * 00036 * $Id: reconstruction.h 6112 2012-07-03 17:57:04Z aichim $ 00037 * 00038 */ 00039 00040 #ifndef PCL_SURFACE_RECONSTRUCTION_H_ 00041 #define PCL_SURFACE_RECONSTRUCTION_H_ 00042 00043 #include <pcl/pcl_base.h> 00044 #include <pcl/PolygonMesh.h> 00045 #include <pcl/search/pcl_search.h> 00046 #include <pcl/ros/conversions.h> 00047 #include <boost/bind.hpp> 00048 #include <boost/function.hpp> 00049 00050 namespace pcl 00051 { 00061 template <typename PointInT> 00062 class PCLSurfaceBase: public PCLBase<PointInT> 00063 { 00064 public: 00065 typedef typename pcl::search::Search<PointInT> KdTree; 00066 typedef typename pcl::search::Search<PointInT>::Ptr KdTreePtr; 00067 00069 PCLSurfaceBase () : tree_ () {} 00070 00074 inline void 00075 setSearchMethod (const KdTreePtr &tree) 00076 { 00077 tree_ = tree; 00078 } 00079 00081 inline KdTreePtr 00082 getSearchMethod () { return (tree_); } 00083 00088 virtual void 00089 reconstruct (pcl::PolygonMesh &output) = 0; 00090 00091 protected: 00093 KdTreePtr tree_; 00094 00096 virtual std::string 00097 getClassName () const { return (""); } 00098 }; 00099 00113 template <typename PointInT> 00114 class SurfaceReconstruction: public PCLSurfaceBase<PointInT> 00115 { 00116 public: 00117 using PCLSurfaceBase<PointInT>::input_; 00118 using PCLSurfaceBase<PointInT>::indices_; 00119 using PCLSurfaceBase<PointInT>::initCompute; 00120 using PCLSurfaceBase<PointInT>::deinitCompute; 00121 using PCLSurfaceBase<PointInT>::tree_; 00122 using PCLSurfaceBase<PointInT>::getClassName; 00123 00125 SurfaceReconstruction () : check_tree_ (true) {} 00126 00128 virtual ~SurfaceReconstruction () {} 00129 00134 virtual void 00135 reconstruct (pcl::PolygonMesh &output); 00136 00143 virtual void 00144 reconstruct (pcl::PointCloud<PointInT> &points, 00145 std::vector<pcl::Vertices> &polygons); 00146 00147 protected: 00150 bool check_tree_; 00151 00155 virtual void 00156 performReconstruction (pcl::PolygonMesh &output) = 0; 00157 00162 virtual void 00163 performReconstruction (pcl::PointCloud<PointInT> &points, 00164 std::vector<pcl::Vertices> &polygons) = 0; 00165 }; 00166 00179 template <typename PointInT> 00180 class MeshConstruction: public PCLSurfaceBase<PointInT> 00181 { 00182 public: 00183 using PCLSurfaceBase<PointInT>::input_; 00184 using PCLSurfaceBase<PointInT>::indices_; 00185 using PCLSurfaceBase<PointInT>::initCompute; 00186 using PCLSurfaceBase<PointInT>::deinitCompute; 00187 using PCLSurfaceBase<PointInT>::tree_; 00188 using PCLSurfaceBase<PointInT>::getClassName; 00189 00191 MeshConstruction () : check_tree_ (true) {} 00192 00194 virtual ~MeshConstruction () {} 00195 00205 virtual void 00206 reconstruct (pcl::PolygonMesh &output); 00207 00213 virtual void 00214 reconstruct (std::vector<pcl::Vertices> &polygons); 00215 00216 protected: 00219 bool check_tree_; 00220 00224 virtual void 00225 performReconstruction (pcl::PolygonMesh &output) = 0; 00226 00230 virtual void 00231 performReconstruction (std::vector<pcl::Vertices> &polygons) = 0; 00232 }; 00233 } 00234 00235 #include <pcl/surface/impl/reconstruction.hpp> 00236 00237 #endif // PCL_SURFACE_RECONSTRUCTION_H_ 00238