Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef PCL_FILTERS_CROP_HULL_H_
00039 #define PCL_FILTERS_CROP_HULL_H_
00040
00041 #include <pcl/point_types.h>
00042 #include <pcl/Vertices.h>
00043 #include <pcl/filters/filter_indices.h>
00044
00045 namespace pcl
00046 {
00052 template<typename PointT>
00053 class CropHull: public FilterIndices<PointT>
00054 {
00055 using Filter<PointT>::filter_name_;
00056 using Filter<PointT>::indices_;
00057 using Filter<PointT>::input_;
00058
00059 typedef typename Filter<PointT>::PointCloud PointCloud;
00060 typedef typename PointCloud::Ptr PointCloudPtr;
00061 typedef typename PointCloud::ConstPtr PointCloudConstPtr;
00062
00063 public:
00065 CropHull () :
00066 hull_polygons_(),
00067 hull_cloud_(),
00068 dim_(3),
00069 crop_outside_(true)
00070 {
00071 filter_name_ = "CropHull";
00072 }
00073
00078 inline void
00079 setHullIndices (const std::vector<Vertices>& polygons)
00080 {
00081 hull_polygons_ = polygons;
00082 }
00083
00086 std::vector<Vertices>
00087 getHullIndices () const
00088 {
00089 return (hull_polygons_);
00090 }
00091
00095 inline void
00096 setHullCloud (PointCloudPtr points)
00097 {
00098 hull_cloud_ = points;
00099 }
00100
00102 PointCloudPtr
00103 getHullCloud () const
00104 {
00105 return (hull_cloud_);
00106 }
00107
00114 inline void
00115 setDim (int dim)
00116 {
00117 dim_ = dim;
00118 }
00119
00124 inline void
00125 setCropOutside(bool crop_outside)
00126 {
00127 crop_outside_ = crop_outside;
00128 }
00129
00130 protected:
00134 void
00135 applyFilter (PointCloud &output);
00136
00140 void
00141 applyFilter (std::vector<int> &indices);
00142
00143 private:
00148 Eigen::Vector3f
00149 getHullCloudRange ();
00150
00157 template<unsigned PlaneDim1, unsigned PlaneDim2> void
00158 applyFilter2D (PointCloud &output);
00159
00167 template<unsigned PlaneDim1, unsigned PlaneDim2> void
00168 applyFilter2D (std::vector<int> &indices);
00169
00178 void
00179 applyFilter3D (PointCloud &output);
00180
00189 void
00190 applyFilter3D (std::vector<int> &indices);
00191
00198 template<unsigned PlaneDim1, unsigned PlaneDim2> inline static bool
00199 isPointIn2DPolyWithVertIndices (const PointT& point,
00200 const Vertices& verts,
00201 const PointCloud& cloud);
00202
00211 inline static bool
00212 rayTriangleIntersect (const PointT& point,
00213 const Eigen::Vector3f& ray,
00214 const Vertices& verts,
00215 const PointCloud& cloud);
00216
00217
00219 std::vector<pcl::Vertices> hull_polygons_;
00220
00222 PointCloudPtr hull_cloud_;
00223
00225 int dim_;
00226
00230 bool crop_outside_;
00231 };
00232
00233 }
00234
00235 #endif // ndef PCL_FILTERS_CROP_HULL_H_