41 #include <pcl/search/search.h>
42 #include <pcl/octree/octree_search.h>
72 using Ptr = shared_ptr<pcl::search::Octree<PointT,LeafTWrap,BranchTWrap,OctreeT> >;
73 using ConstPtr = shared_ptr<const pcl::search::Octree<PointT,LeafTWrap,BranchTWrap,OctreeT> >;
93 ,
tree_ (new
pcl::octree::OctreePointCloudSearch<
PointT, LeafTWrap, BranchTWrap> (resolution))
107 tree_->deleteTree ();
108 tree_->setInputCloud (cloud);
109 tree_->addPointsFromInputCloud ();
120 tree_->deleteTree ();
121 tree_->setInputCloud (cloud, indices);
122 tree_->addPointsFromInputCloud ();
139 std::vector<float> &k_sqr_distances)
const override
141 return (
tree_->nearestKSearch (cloud, index, k, k_indices, k_sqr_distances));
154 std::vector<float> &k_sqr_distances)
const override
156 return (
tree_->nearestKSearch (point, k, k_indices, k_sqr_distances));
173 return (
tree_->nearestKSearch (index, k, k_indices, k_sqr_distances));
190 std::vector<float> &k_sqr_distances,
191 unsigned int max_nn = 0)
const override
193 tree_->radiusSearch (cloud, index, radius, k_indices, k_sqr_distances, max_nn);
196 return (
static_cast<int> (k_indices.size ()));
211 std::vector<float> &k_sqr_distances,
212 unsigned int max_nn = 0)
const override
214 tree_->radiusSearch (p_q, radius, k_indices, k_sqr_distances, max_nn);
217 return (
static_cast<int> (k_indices.size ()));
231 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const override
233 tree_->radiusSearch (index, radius, k_indices, k_sqr_distances, max_nn);
236 return (
static_cast<int> (k_indices.size ()));
251 return (
tree_->approxNearestSearch ((*cloud)[query_index], result_index, sqr_distance));
262 return (
tree_->approxNearestSearch (p_q, result_index, sqr_distance));
275 return (
tree_->approxNearestSearch (query_index, result_index, sqr_distance));
284 boxSearch(
const Eigen::Vector3f &min_pt,
const Eigen::Vector3f &max_pt,
Indices &k_indices)
const
286 return (
tree_->boxSearch(min_pt, max_pt, k_indices));
292 #ifdef PCL_NO_PRECOMPILE
293 #include <pcl/octree/impl/octree_search.hpp>
295 #define PCL_INSTANTIATE_Octree(T) template class PCL_EXPORTS pcl::search::Octree<T>;
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Octree container class that does not store any information.
Octree container class that does store a vector of point indices.
shared_ptr< const OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > ConstPtr
shared_ptr< OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT > > Ptr
search::Octree is a wrapper class which implements nearest neighbor search operations based on the pc...
shared_ptr< const pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT > > ConstPtr
uindex_t boxSearch(const Eigen::Vector3f &min_pt, const Eigen::Vector3f &max_pt, Indices &k_indices) const
Search for points within rectangular search area.
typename PointCloud::Ptr PointCloudPtr
int nearestKSearch(index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for the k-nearest neighbors for the given query point (zero-copy).
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
int radiusSearch(const PointT &p_q, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
search for all neighbors of query point that are within a given radius.
OctreePointCloudSearchPtr tree_
void approxNearestSearch(const PointCloudConstPtr &cloud, index_t query_index, index_t &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
typename PointCloud::ConstPtr PointCloudConstPtr
int radiusSearch(index_t index, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
search for all neighbors of query point that are within a given radius.
typename pcl::octree::OctreePointCloudSearch< PointT, LeafTWrap, BranchTWrap >::ConstPtr OctreePointCloudSearchConstPtr
void approxNearestSearch(index_t query_index, index_t &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
Octree(const double resolution)
Octree constructor.
int radiusSearch(const PointCloud &cloud, index_t index, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
search for all neighbors of query point that are within a given radius.
typename pcl::octree::OctreePointCloudSearch< PointT, LeafTWrap, BranchTWrap >::Ptr OctreePointCloudSearchPtr
shared_ptr< pcl::search::Octree< PointT, LeafTWrap, BranchTWrap, OctreeT > > Ptr
void approxNearestSearch(const PointT &p_q, index_t &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
int nearestKSearch(const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for the k-nearest neighbors for the given query point.
bool setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices) override
Provide a pointer to the input dataset.
~Octree() override=default
Empty Destructor.
int nearestKSearch(const PointCloud &cloud, index_t index, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for the k-nearest neighbors for the given query point.
PointCloudConstPtr input_
void sortResults(Indices &indices, std::vector< float > &distances) const
pcl::IndicesConstPtr IndicesConstPtr
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
IndicesAllocator<> Indices
Type used for indices in PCL.
A point structure representing Euclidean xyz coordinates, and the RGB color.