22 #ifndef __LIBS_PCL_UTILS_COMPARISONS__H_
23 #define __LIBS_PCL_UTILS_COMPARISONS_H_
25 #include <pcl/point_cloud.h>
26 #include <pcl/ModelCoefficients.h>
27 #include <pcl/filters/conditional_removal.h>
28 #include <pcl/segmentation/extract_polygonal_prism_data.h>
46 template <
typename Po
intT>
49 using pcl::ComparisonBase<PointT>::capable_;
52 typedef boost::shared_ptr<PolygonComparison<PointT> >
Ptr;
54 typedef boost::shared_ptr<const PolygonComparison<PointT> >
ConstPtr;
61 : inside_(inside), polygon_(polygon)
63 capable_ = (polygon.size() >= 3);
73 virtual bool evaluate(
const PointT &point)
const
76 return pcl::isPointIn2DPolygon(point, polygon_);
78 return ! pcl::isPointIn2DPolygon(point, polygon_);
97 template <
typename Po
intT>
100 using pcl::ComparisonBase<PointT>::capable_;
103 typedef boost::shared_ptr<PlaneDistanceComparison<PointT> >
Ptr;
105 typedef boost::shared_ptr<const PlaneDistanceComparison<PointT> >
ConstPtr;
113 pcl::ComparisonOps::CompareOp op = pcl::ComparisonOps::GT,
114 float compare_val = 0.)
115 : coeff_(coeff), op_(op), compare_val_(compare_val)
117 capable_ = (coeff_->values.size() == 4);
126 virtual bool evaluate(
const PointT &point)
const
128 float val = (coeff_->values[0] * point.x + coeff_->values[1] * point.y +
129 coeff_->values[2] * point.z + coeff_->values[3]) /
130 sqrtf(coeff_->values[0] * coeff_->values[0] +
131 coeff_->values[1] * coeff_->values[1] +
132 coeff_->values[2] * coeff_->values[2]);
136 if (op_ == pcl::ComparisonOps::GT) {
137 return val > compare_val_;
138 }
else if (op_ == pcl::ComparisonOps::GE) {
139 return val >= compare_val_;
140 }
else if (op_ == pcl::ComparisonOps::LT) {
141 return val < compare_val_;
142 }
else if (op_ == pcl::ComparisonOps::LE) {
143 return val <= compare_val_;
145 return val == compare_val_;
153 pcl::ComparisonOps::CompareOp
op_;