41#include <pcl/sample_consensus/sac_model.h>
42#include <pcl/sample_consensus/model_types.h>
65 template <
typename Po
intT,
typename Po
intNT>
82 using Ptr = shared_ptr<SampleConsensusModelCone<PointT, PointNT> >;
83 using ConstPtr = shared_ptr<const SampleConsensusModelCone<PointT, PointNT>>;
92 , axis_ (
Eigen::Vector3f::Zero ())
94 , min_angle_ (-std::numeric_limits<double>::max ())
95 , max_angle_ (std::numeric_limits<double>::max ())
112 , axis_ (
Eigen::Vector3f::Zero ())
114 , min_angle_ (-std::numeric_limits<double>::max ())
115 , max_angle_ (std::numeric_limits<double>::max ())
128 eps_angle_ (), min_angle_ (), max_angle_ ()
145 axis_ = source.axis_;
146 eps_angle_ = source.eps_angle_;
147 min_angle_ = source.min_angle_;
148 max_angle_ = source.max_angle_;
166 setAxis (
const Eigen::Vector3f &ax) { axis_ = ax; }
169 inline Eigen::Vector3f
180 min_angle_ = min_angle;
181 max_angle_ = max_angle;
191 min_angle = min_angle_;
192 max_angle = max_angle_;
203 Eigen::VectorXf &model_coefficients)
const override;
211 std::vector<double> &distances)
const override;
220 const double threshold,
231 const double threshold)
const override;
242 const Eigen::VectorXf &model_coefficients,
243 Eigen::VectorXf &optimized_coefficients)
const override;
254 const Eigen::VectorXf &model_coefficients,
256 bool copy_data_fields =
true)
const override;
265 const Eigen::VectorXf &model_coefficients,
266 const double threshold)
const override;
281 pointToAxisDistance (
const Eigen::Vector4f &pt,
const Eigen::VectorXf &model_coefficients)
const;
287 isModelValid (
const Eigen::VectorXf &model_coefficients)
const override;
298 Eigen::Vector3f axis_;
309#ifdef PCL_NO_PRECOMPILE
310#include <pcl/sample_consensus/impl/sac_model_cone.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
SampleConsensusModelCone defines a model for 3D cone segmentation.
void optimizeModelCoefficients(const Indices &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the cone coefficients using the given inlier set and return them to the user.
void setAxis(const Eigen::Vector3f &ax)
Set the axis along which we need to search for a cone direction.
SampleConsensusModelCone(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelCone.
SampleConsensusModelCone(const SampleConsensusModelCone &source)
Copy constructor.
typename SampleConsensusModel< PointT >::PointCloudConstPtr PointCloudConstPtr
~SampleConsensusModelCone() override=default
Empty destructor.
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 cone model.
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_CONE).
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given cone 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.
bool isSampleGood(const Indices &samples) const override
Check if a sample of indices results in a good sample of points indices.
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid cone model, compute the model coefficients fro...
bool isModelValid(const Eigen::VectorXf &model_coefficients) const override
Check whether a model is valid given the user constraints.
SampleConsensusModelCone & operator=(const SampleConsensusModelCone &source)
Copy constructor.
Eigen::Vector3f getAxis() const
Get the axis along which we need to search for a cone direction.
double pointToAxisDistance(const Eigen::Vector4f &pt, const Eigen::VectorXf &model_coefficients) const
Get the distance from a point to a line (represented by a point and a direction)
shared_ptr< const SampleConsensusModelCone< PointT, PointNT > > ConstPtr
void setEpsAngle(double ea)
Set the angle epsilon (delta) threshold.
void getMinMaxOpeningAngle(double &min_angle, double &max_angle) const
Get the opening angle which we need minimum to validate a cone model.
double getEpsAngle() const
Get the angle epsilon (delta) threshold.
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 cone model coefficients.
typename SampleConsensusModel< PointT >::PointCloud PointCloud
shared_ptr< SampleConsensusModelCone< PointT, PointNT > > Ptr
void setMinMaxOpeningAngle(const double &min_angle, const double &max_angle)
Set the minimum and maximum allowable opening angle for a cone model given from a user.
SampleConsensusModelCone(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelCone.
typename SampleConsensusModel< PointT >::PointCloudPtr PointCloudPtr
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.
SampleConsensusModelFromNormals represents the base model class for models that require the use of su...
PointCloudNConstPtr normals_
A pointer to the input dataset that contains the point normals of the XYZ dataset.
double normal_distance_weight_
The relative weight (between 0 and 1) to give to the angular distance (0 to pi/2) between point norma...
SampleConsensusModel represents the base model class.
double radius_min_
The minimum and maximum radius limits for the model.
unsigned int sample_size_
The size of a sample from which the model is computed.
typename PointCloud::ConstPtr PointCloudConstPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
PointCloudConstPtr input_
A boost shared pointer to the point cloud data array.
std::string model_name_
The model name.
unsigned int model_size_
The number of coefficients in the model.
typename PointCloud::Ptr PointCloudPtr
std::vector< double > error_sqr_dists_
A vector holding the distances to the computed model.
Define standard C methods to do distance calculations.
int optimizeModelCoefficientsCone(Eigen::VectorXf &coeff, const Eigen::ArrayXf &pts_x, const Eigen::ArrayXf &pts_y, const Eigen::ArrayXf &pts_z)
IndicesAllocator<> Indices
Type used for indices in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.