Point Cloud Library (PCL)  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
reconstruction.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2010-2011, 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 3753 2011-12-31 23:30:57Z rusu $
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 {
00065   template <typename PointInT>
00066   class SurfaceReconstruction: public PCLBase<PointInT>
00067   {
00068     public:
00069       using PCLBase<PointInT>::input_;
00070       using PCLBase<PointInT>::indices_;
00071       using PCLBase<PointInT>::initCompute;
00072       using PCLBase<PointInT>::deinitCompute;
00073 
00074       typedef typename pcl::search::Search<PointInT> KdTree;
00075       typedef typename pcl::search::Search<PointInT>::Ptr KdTreePtr;
00076 
00078       SurfaceReconstruction () : tree_ (), check_tree_ (true) {}
00079 
00081       virtual ~SurfaceReconstruction () {}
00082 
00087       void 
00088       reconstruct (pcl::PolygonMesh &output);
00089 
00096       void 
00097       reconstruct (pcl::PointCloud<PointInT> &points,
00098                    std::vector<pcl::Vertices> &polygons);
00099 
00103       inline void
00104       setSearchMethod (const KdTreePtr &tree)
00105       {
00106         tree_ = tree;
00107       }
00108 
00110       inline KdTreePtr 
00111       getSearchMethod () { return (tree_); }
00112 
00113     protected:
00115       KdTreePtr tree_;
00116 
00119       bool check_tree_;
00120 
00124       virtual void 
00125       performReconstruction (pcl::PolygonMesh &output) = 0;
00126 
00131       virtual void 
00132       performReconstruction (pcl::PointCloud<PointInT> &points, 
00133                              std::vector<pcl::Vertices> &polygons) = 0;
00134 
00136       virtual std::string 
00137       getClassName () const { return (""); }
00138   };
00139 
00152   template <typename PointInT>
00153   class MeshConstruction: public PCLBase<PointInT>
00154   {
00155     protected:
00156       using PCLBase<PointInT>::input_;
00157       using PCLBase<PointInT>::indices_;
00158       using PCLBase<PointInT>::initCompute;
00159       using PCLBase<PointInT>::deinitCompute;
00160 
00161     public:
00162       typedef typename pcl::search::Search<PointInT> KdTree;
00163       typedef typename pcl::search::Search<PointInT>::Ptr KdTreePtr;
00164 
00166       MeshConstruction () : tree_ (), check_tree_ (true) {}
00167 
00169       virtual ~MeshConstruction () {}
00170 
00180       void 
00181       reconstruct (pcl::PolygonMesh &output);
00182 
00188       void 
00189       reconstruct (std::vector<pcl::Vertices> &polygons);
00190 
00194       inline void
00195       setSearchMethod (const KdTreePtr &tree)
00196       {
00197         tree_ = tree;
00198       }
00199 
00201       inline KdTreePtr 
00202       getSearchMethod () { return (tree_); }
00203 
00204     protected:
00206       KdTreePtr tree_;
00207 
00210       bool check_tree_;
00211 
00215       virtual void 
00216       performReconstruction (pcl::PolygonMesh &output) = 0;
00217 
00221       virtual void 
00222       performReconstruction (std::vector<pcl::Vertices> &polygons) = 0;
00223 
00225       virtual std::string 
00226       getClassName () const { return (""); }
00227   };
00228 }
00229 
00230 #include "pcl/surface/impl/reconstruction.hpp"
00231 
00232 #endif  // PCL_SURFACE_RECONSTRUCTION_H_
00233 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines