Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
extract_polygonal_prism_data.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id: extract_polygonal_prism_data.h 4869 2012-03-01 03:00:16Z rusu $
35  *
36  */
37 
38 #ifndef PCL_EXTRACT_POLYGONAL_PRISM_DATA_H_
39 #define PCL_EXTRACT_POLYGONAL_PRISM_DATA_H_
40 
41 #include <pcl/pcl_base.h>
43 
44 namespace pcl
45 {
54  template <typename PointT> bool
55  isPointIn2DPolygon (const PointT &point, const pcl::PointCloud<PointT> &polygon);
56 
67  template <typename PointT> bool
68  isXYPointIn2DXYPolygon (const PointT &point, const pcl::PointCloud<PointT> &polygon);
69 
71 
82  template <typename PointT>
83  class ExtractPolygonalPrismData : public PCLBase<PointT>
84  {
89 
90  public:
92  typedef typename PointCloud::Ptr PointCloudPtr;
94 
97 
99  ExtractPolygonalPrismData () : planar_hull_ (), min_pts_hull_ (3),
100  height_limit_min_ (0), height_limit_max_ (FLT_MAX),
101  vpx_ (0), vpy_ (0), vpz_ (0)
102  {};
103 
107  inline void
108  setInputPlanarHull (const PointCloudConstPtr &hull) { planar_hull_ = hull; }
109 
111  inline PointCloudConstPtr
112  getInputPlanarHull () const { return (planar_hull_); }
113 
120  inline void
121  setHeightLimits (double height_min, double height_max)
122  {
123  height_limit_min_ = height_min;
124  height_limit_max_ = height_max;
125  }
126 
132  inline void
133  getHeightLimits (double &height_min, double &height_max) const
134  {
135  height_min = height_limit_min_;
136  height_max = height_limit_max_;
137  }
138 
144  inline void
145  setViewPoint (float vpx, float vpy, float vpz)
146  {
147  vpx_ = vpx;
148  vpy_ = vpy;
149  vpz_ = vpz;
150  }
151 
153  inline void
154  getViewPoint (float &vpx, float &vpy, float &vpz) const
155  {
156  vpx = vpx_;
157  vpy = vpy_;
158  vpz = vpz_;
159  }
160 
164  void
165  segment (PointIndices &output);
166 
167  protected:
169  PointCloudConstPtr planar_hull_;
170 
172  int min_pts_hull_;
173 
177  double height_limit_min_;
178 
182  double height_limit_max_;
183 
185  float vpx_, vpy_, vpz_;
186 
188  virtual std::string
189  getClassName () const { return ("ExtractPolygonalPrismData"); }
190  };
191 }
192 
193 #endif //#ifndef PCL_EXTRACT_POLYGONAL_PRISM_DATA_H_