43 #include <pcl/sample_consensus/sac_model.h> 44 #include <pcl/sample_consensus/model_types.h> 54 template <
typename Po
int>
inline void 55 projectPoint (
const Point &p,
const Eigen::Vector4f &model_coefficients, Point &q)
58 Eigen::Vector4f pp (p.x, p.y, p.z, 1);
60 float distance_to_plane = pp.dot(model_coefficients);
67 Eigen::Vector4f q_e = pp - distance_to_plane * model_coefficients;
81 template <
typename Po
int>
inline double 84 return (a * p.x + b * p.y + c * p.z + d);
92 template <
typename Po
int>
inline double 95 return ( plane_coefficients[0] * p.x + plane_coefficients[1] * p.y + plane_coefficients[2] * p.z + plane_coefficients[3] );
106 template <
typename Po
int>
inline double 117 template <
typename Po
int>
inline double 134 template <
typename Po
intT>
148 using Ptr = shared_ptr<SampleConsensusModelPlane<PointT> >;
149 using ConstPtr = shared_ptr<const SampleConsensusModelPlane<PointT>>;
189 Eigen::VectorXf &model_coefficients)
const override;
197 std::vector<double> &distances)
const override;
206 const double threshold,
217 const double threshold)
const override;
227 const Eigen::VectorXf &model_coefficients,
228 Eigen::VectorXf &optimized_coefficients)
const override;
238 const Eigen::VectorXf &model_coefficients,
240 bool copy_data_fields =
true)
const override;
249 const Eigen::VectorXf &model_coefficients,
250 const double threshold)
const override;
266 isSampleGood (
const Indices &samples)
const override;
270 #ifdef PCL_NO_PRECOMPILE 271 #include <pcl/sample_consensus/impl/sac_model_plane.hpp> double pointToPlaneDistanceSigned(const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0.
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelPlane.
~SampleConsensusModelPlane()
Empty destructor.
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid plane model, compute the model coefficients fr...
bool doSamplesVerifyModel(const std::set< index_t > &indices, const Eigen::VectorXf &model_coefficients, const double threshold) const override
Verify whether a subset of indices verifies the given plane model coefficients.
unsigned int model_size_
The number of coefficients in the model.
typename PointCloud::Ptr PointCloudPtr
void optimizeModelCoefficients(const Indices &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the plane coefficients using the given inlier set and return them to the user...
double pointToPlaneDistance(const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0.
std::size_t countWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold) const override
Count all the points which respect the given model coefficients as inliers.
SampleConsensusModel represents the base model class.
std::string model_name_
The model name.
typename PointCloud::ConstPtr PointCloudConstPtr
SampleConsensusModelPlane(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelPlane.
IndicesAllocator<> Indices
Type used for indices in PCL.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
shared_ptr< const SampleConsensusModel< PointT > > ConstPtr
void projectPoints(const Indices &inliers, const Eigen::VectorXf &model_coefficients, PointCloud &projected_points, bool copy_data_fields=true) const override
Create a new point cloud with inliers projected onto the plane model.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, Indices &inliers) override
Select all the points which respect the given model coefficients as inliers.
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_PLANE).
void projectPoint(const Point &p, const Eigen::Vector4f &model_coefficients, Point &q)
Project a point on a planar model given by a set of normalized coefficients.
A point structure representing Euclidean xyz coordinates, and the RGB color.
shared_ptr< SampleConsensusModel< PointT > > Ptr
SampleConsensusModelPlane defines a model for 3D plane segmentation.
unsigned int sample_size_
The size of a sample from which the model is computed.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given plane model.