44 #include <xmmintrin.h>
47 #include <immintrin.h>
50 #include <pcl/sample_consensus/sac_model.h>
51 #include <pcl/sample_consensus/model_types.h>
65 template <
typename Po
intT>
80 using Ptr = shared_ptr<SampleConsensusModelCircle2D<PointT> >;
81 using ConstPtr = shared_ptr<const SampleConsensusModelCircle2D<PointT>>;
140 Eigen::VectorXf &model_coefficients)
const override;
148 std::vector<double> &distances)
const override;
157 const double threshold,
168 const double threshold)
const override;
178 const Eigen::VectorXf &model_coefficients,
179 Eigen::VectorXf &optimized_coefficients)
const override;
189 const Eigen::VectorXf &model_coefficients,
191 bool copy_data_fields =
true)
const override;
200 const Eigen::VectorXf &model_coefficients,
201 const double threshold)
const override;
215 isModelValid (
const Eigen::VectorXf &model_coefficients)
const override;
228 const double threshold,
229 std::size_t i = 0)
const;
231 #if defined (__SSE__) && defined (__SSE2__) && defined (__SSE4_1__)
236 countWithinDistanceSSE (
const Eigen::VectorXf &model_coefficients,
237 const double threshold,
238 std::size_t i = 0)
const;
241 #if defined (__AVX__) && defined (__AVX2__)
246 countWithinDistanceAVX (
const Eigen::VectorXf &model_coefficients,
247 const double threshold,
248 std::size_t i = 0)
const;
268 operator() (
const Eigen::VectorXf &x, Eigen::VectorXf &fvec)
const
270 for (
int i = 0; i < values (); ++i)
273 float xt = (*model_->input_)[
indices_[i]].x - x[0];
274 float yt = (*model_->input_)[
indices_[i]].y - x[1];
277 fvec[i] = std::sqrt (xt * xt + yt * yt) - x[2];
287 inline __m256 sqr_dist8 (
const std::size_t i,
const __m256 a_vec,
const __m256 b_vec)
const;
291 inline __m128 sqr_dist4 (
const std::size_t i,
const __m128 a_vec,
const __m128 b_vec)
const;
296 #ifdef PCL_NO_PRECOMPILE
297 #include <pcl/sample_consensus/impl/sac_model_circle.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
SampleConsensusModelCircle2D defines a model for 2D circle segmentation on the X-Y plane.
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.
bool computeModelCoefficients(const Indices &samples, Eigen::VectorXf &model_coefficients) const override
Check whether the given index samples can form a valid 2D circle model, compute the model coefficient...
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 2d circle model.
bool isModelValid(const Eigen::VectorXf &model_coefficients) const override
Check whether a model is valid given the user constraints.
void selectWithinDistance(const Eigen::VectorXf &model_coefficients, const double threshold, Indices &inliers) override
Compute all distances from the cloud data to a given 2D circle model.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given 2D circle model.
void optimizeModelCoefficients(const Indices &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
Recompute the 2d circle coefficients using the given inlier set and return them to the user.
pcl::SacModel getModelType() const override
Return a unique id for this model (SACMODEL_CIRCLE2D).
SampleConsensusModelCircle2D(const SampleConsensusModelCircle2D &source)
Copy constructor.
std::size_t countWithinDistanceStandard(const Eigen::VectorXf &model_coefficients, const double threshold, std::size_t i=0) const
This implementation uses no SIMD instructions.
~SampleConsensusModelCircle2D() override=default
Empty destructor.
bool isSampleGood(const Indices &samples) const override
Check if a sample of indices results in a good sample of points indices.
SampleConsensusModelCircle2D(const PointCloudConstPtr &cloud, bool random=false)
Constructor for base SampleConsensusModelCircle2D.
SampleConsensusModelCircle2D & operator=(const SampleConsensusModelCircle2D &source)
Copy constructor.
SampleConsensusModelCircle2D(const PointCloudConstPtr &cloud, const Indices &indices, bool random=false)
Constructor for base SampleConsensusModelCircle2D.
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 2d circle model coefficients.
SampleConsensusModel represents the base model class.
shared_ptr< SampleConsensusModel< PointT > > Ptr
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.
std::string model_name_
The model name.
unsigned int model_size_
The number of coefficients in the model.
typename PointCloud::Ptr PointCloudPtr
shared_ptr< const SampleConsensusModel< PointT > > ConstPtr
IndicesAllocator<> Indices
Type used for indices in PCL.
Base functor all the models that need non linear optimization must define their own one and implement...
A point structure representing Euclidean xyz coordinates, and the RGB color.