22#ifndef _LIBS_PCL_UTILS_COMPARISONS_H_
23#define _LIBS_PCL_UTILS_COMPARISONS_H_
25#include "compatibility.h"
27#include <pcl/ModelCoefficients.h>
28#include <pcl/filters/conditional_removal.h>
29#include <pcl/point_cloud.h>
30#include <pcl/segmentation/extract_polygonal_prism_data.h>
43template <
typename Po
intT>
46 using pcl::ComparisonBase<PointT>::capable_;
50 typedef pcl::shared_ptr<PolygonComparison<PointT>>
Ptr;
52 typedef pcl::shared_ptr<const PolygonComparison<PointT>>
ConstPtr;
61 capable_ = (polygon.size() >= 3);
77 return pcl::isPointIn2DPolygon(point,
polygon_);
79 return !pcl::isPointIn2DPolygon(point,
polygon_);
99template <
typename Po
intT>
102 using pcl::ComparisonBase<PointT>::capable_;
106 typedef pcl::shared_ptr<PlaneDistanceComparison<PointT>>
Ptr;
108 typedef pcl::shared_ptr<const PlaneDistanceComparison<PointT>>
ConstPtr;
116 pcl::ComparisonOps::CompareOp op = pcl::ComparisonOps::GT,
117 float compare_val = 0.)
120 capable_ = (
coeff_->values.size() == 4);
135 (
coeff_->values[0] * point.x +
coeff_->values[1] * point.y +
coeff_->values[2] * point.z
142 if (
op_ == pcl::ComparisonOps::GT) {
144 }
else if (
op_ == pcl::ComparisonOps::GE) {
146 }
else if (
op_ == pcl::ComparisonOps::LT) {
148 }
else if (
op_ == pcl::ComparisonOps::LE) {
159 pcl::ComparisonOps::CompareOp
op_;
Compare points' distance to a plane.
float compare_val_
Value to compare against.
pcl::ComparisonOps::CompareOp op_
Comparison operation.
pcl::shared_ptr< const PlaneDistanceComparison< PointT > > ConstPtr
Constant shared pointer.
pcl::shared_ptr< PlaneDistanceComparison< PointT > > Ptr
Shared pointer.
virtual ~PlaneDistanceComparison()
Virtual empty destructor.
virtual bool evaluate(const PointT &point) const
Evaluate for given pixel.
PlaneDistanceComparison(pcl::ModelCoefficients::ConstPtr coeff, pcl::ComparisonOps::CompareOp op=pcl::ComparisonOps::GT, float compare_val=0.)
Constructor.
pcl::ModelCoefficients::ConstPtr coeff_
Planar model coefficients.
Check if point is inside or outside a given polygon.
const pcl::PointCloud< PointT > & polygon_
The polygon to check against.
virtual bool evaluate(const PointT &point) const
Evaluate for given pixel.
pcl::shared_ptr< PolygonComparison< PointT > > Ptr
Shared pointer.
bool inside_
Flag to determine whether to do inside or outside check.
PolygonComparison(const pcl::PointCloud< PointT > &polygon, bool inside=true)
Constructor.
virtual ~PolygonComparison()
Virtual empty destructor.
pcl::shared_ptr< const PolygonComparison< PointT > > ConstPtr
Constant shared pointer.
Fawkes library namespace.