41#ifndef PCL_SAMPLE_CONSENSUS_IMPL_SAC_MODEL_NORMAL_SPHERE_H_
42#define PCL_SAMPLE_CONSENSUS_IMPL_SAC_MODEL_NORMAL_SPHERE_H_
44#include <pcl/sample_consensus/sac_model_normal_sphere.h>
48template <
typename Po
intT,
typename Po
intNT>
void
54 PCL_ERROR (
"[pcl::SampleConsensusModelNormalSphere::selectWithinDistance] No input dataset containing normals was given!\n");
71 error_sqr_dists_.clear ();
72 inliers.reserve (indices_->size ());
73 error_sqr_dists_.reserve (indices_->size ());
76 for (std::size_t i = 0; i < indices_->size (); ++i)
80 Eigen::Vector4f p ((*input_)[(*indices_)[i]].x,
81 (*input_)[(*indices_)[i]].y,
82 (*input_)[(*indices_)[i]].z,
91 Eigen::Vector4f n ((*normals_)[(*indices_)[i]].normal[0],
92 (*normals_)[(*indices_)[i]].normal[1],
93 (*normals_)[(*indices_)[i]].normal[2],
99 if (distance < threshold)
102 inliers.push_back ((*indices_)[i]);
103 error_sqr_dists_.push_back (
static_cast<double> (distance));
109template <
typename Po
intT,
typename Po
intNT> std::size_t
115 PCL_ERROR (
"[pcl::SampleConsensusModelNormalSphere::getDistancesToModel] No input dataset containing normals was given!\n");
128 std::size_t
nr_p = 0;
131 for (std::size_t i = 0; i < indices_->size (); ++i)
135 Eigen::Vector4f p ((*input_)[(*indices_)[i]].x,
136 (*input_)[(*indices_)[i]].y,
137 (*input_)[(*indices_)[i]].z,
146 Eigen::Vector4f n ((*normals_)[(*indices_)[i]].normal[0],
147 (*normals_)[(*indices_)[i]].normal[1],
148 (*normals_)[(*indices_)[i]].normal[2],
160template <
typename Po
intT,
typename Po
intNT>
void
166 PCL_ERROR (
"[pcl::SampleConsensusModelNormalSphere::getDistancesToModel] No input dataset containing normals was given!\n");
181 distances.resize (indices_->size ());
184 for (std::size_t i = 0; i < indices_->size (); ++i)
188 Eigen::Vector4f p ((*input_)[(*indices_)[i]].x,
189 (*input_)[(*indices_)[i]].y,
190 (*input_)[(*indices_)[i]].z,
197 Eigen::Vector4f n ((*normals_)[(*indices_)[i]].normal[0],
198 (*normals_)[(*indices_)[i]].normal[1],
199 (*normals_)[(*indices_)[i]].normal[2],
208#define PCL_INSTANTIATE_SampleConsensusModelNormalSphere(PointT, PointNT) template class PCL_EXPORTS pcl::SampleConsensusModelNormalSphere<PointT, PointNT>;
Iterator class for point clouds with or without given indices.
ConstCloudIterator(const PointCloud< PointT > &cloud)
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.
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.
void getDistancesToModel(const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const override
Compute all distances from the cloud data to a given sphere model.
Define standard C methods and C++ classes that are common to all methods.
double getAngle3D(const Eigen::Vector4f &v1, const Eigen::Vector4f &v2, const bool in_degree=false)
Compute the smallest angle between two 3D vectors in radians (default) or degree.
IndicesAllocator<> Indices
Type used for indices in PCL.