Point Cloud Library (PCL)
1.3.1
|
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 * All rights reserved. 00007 * 00008 * Redistribution and use in source and binary forms, with or without 00009 * modification, are permitted provided that the following conditions 00010 * are met: 00011 * 00012 * * Redistributions of source code must retain the above copyright 00013 * notice, this list of conditions and the following disclaimer. 00014 * * Redistributions in binary form must reproduce the above 00015 * copyright notice, this list of conditions and the following 00016 * disclaimer in the documentation and/or other materials provided 00017 * with the distribution. 00018 * * Neither the name of Willow Garage, Inc. nor the names of its 00019 * contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00025 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00026 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00027 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00028 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00029 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00030 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00031 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00032 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00033 * POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 * $Id: vtk_smoother.h 2642 2011-10-06 15:48:29Z jspricke $ 00036 * 00037 */ 00038 00039 #ifndef VTK_SMOOTHER_H_ 00040 #define VTK_SMOOTHER_H_ 00041 00042 #include <pcl/pcl_base.h> 00043 #include <pcl/PolygonMesh.h> 00044 #include <vtkPolyData.h> 00045 #include <vtkSmartPointer.h> 00046 00047 namespace pcl 00048 { 00049 namespace surface 00050 { 00059 class PCL_EXPORTS VTKSmoother 00060 { 00061 public: 00063 VTKSmoother () : 00064 vtk_polygons_ (vtkPolyData::New ()), subdivision_filter_ (2), num_iter_ (20), feature_angle_ (120.0), 00065 pass_band_ (0.01) 00066 { 00067 }; 00068 00070 VTKSmoother (int subdivision_filter, int num_iter, float feature_angle, float pass_band) : 00071 vtk_polygons_ (vtkPolyData::New ()), subdivision_filter_ (subdivision_filter), num_iter_ (num_iter), 00072 feature_angle_ (feature_angle), pass_band_ (pass_band) 00073 { 00074 }; 00075 00079 int 00080 convertToVTK (const pcl::PolygonMesh &triangles); 00081 00083 void 00084 subdivideMesh (); 00085 00087 void 00088 smoothMeshWindowedSinc (); 00089 00091 void 00092 smoothMeshLaplacian (); 00093 00097 void 00098 convertToPCL (pcl::PolygonMesh &triangles); 00099 00103 inline void 00104 setSubdivisionFilter (int subdivision_filter) 00105 { 00106 subdivision_filter_ = subdivision_filter; 00107 }; 00108 00112 inline void 00113 setNumIter (int num_iter) 00114 { 00115 num_iter_ = num_iter; 00116 }; 00117 00121 inline void 00122 setFeatureAngle (float feature_angle) 00123 { 00124 feature_angle_ = feature_angle; 00125 }; 00126 00130 inline void 00131 setPassBand (float pass_band) 00132 { 00133 pass_band_ = pass_band; 00134 }; 00135 00137 inline int 00138 getSubdivisionFilter () 00139 { 00140 return subdivision_filter_; 00141 }; 00142 00144 inline int 00145 getNumIter () 00146 { 00147 return num_iter_; 00148 }; 00149 00151 inline float 00152 getFeatureAngle () 00153 { 00154 return feature_angle_; 00155 }; 00156 00158 inline float 00159 getPassBand () 00160 { 00161 return pass_band_; 00162 }; 00163 00164 private: 00165 00171 int 00172 vtk2mesh (const vtkSmartPointer<vtkPolyData>& poly_data, pcl::PolygonMesh& mesh); 00173 00179 int 00180 mesh2vtk (const pcl::PolygonMesh& mesh, vtkSmartPointer<vtkPolyData> &poly_data); 00181 00182 vtkSmartPointer<vtkPolyData> vtk_polygons_; 00183 00187 int subdivision_filter_; 00188 00192 int num_iter_; 00193 00195 float feature_angle_; 00196 00200 float pass_band_; 00201 }; 00202 } 00203 } 00204 00205 #endif /* VTK_SMOOTHER_H_ */ 00206