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))
109 tree_->deleteTree ();
110 tree_->setInputCloud (cloud);
111 tree_->addPointsFromInputCloud ();
122 tree_->deleteTree ();
123 tree_->setInputCloud (cloud, indices);
124 tree_->addPointsFromInputCloud ();
140 std::vector<float> &k_sqr_distances)
const override
142 return (tree_->nearestKSearch (cloud, index, k, k_indices, k_sqr_distances));
155 std::vector<float> &k_sqr_distances)
const override
157 return (tree_->nearestKSearch (point, k, k_indices, k_sqr_distances));
174 return (tree_->nearestKSearch (index, k, k_indices, k_sqr_distances));
191 std::vector<float> &k_sqr_distances,
192 unsigned int max_nn = 0)
const override
194 tree_->radiusSearch (cloud, index, radius, k_indices, k_sqr_distances, max_nn);
197 return (static_cast<int> (k_indices.size ()));
212 std::vector<float> &k_sqr_distances,
213 unsigned int max_nn = 0)
const override
215 tree_->radiusSearch (p_q, radius, k_indices, k_sqr_distances, max_nn);
218 return (static_cast<int> (k_indices.size ()));
232 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const override
234 tree_->radiusSearch (index, radius, k_indices, k_sqr_distances, max_nn);
237 return (static_cast<int> (k_indices.size ()));
252 return (tree_->approxNearestSearch (cloud->points[query_index], result_index, sqr_distance));
263 return (tree_->approxNearestSearch (p_q, result_index, sqr_distance));
276 return (tree_->approxNearestSearch (query_index, result_index, sqr_distance));
283 #ifdef PCL_NO_PRECOMPILE
284 #include <pcl/octree/impl/octree_search.hpp>
286 #define PCL_INSTANTIATE_Octree(T) template class PCL_EXPORTS pcl::search::Octree<T>;
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).
shared_ptr< PointCloud< PointT > > Ptr
typename PointCloud::ConstPtr PointCloudConstPtr
void sortResults(Indices &indices, std::vector< float > &distances) const
std::vector< index_t > Indices
Type used for indices in PCL.
Octree(const double resolution)
Octree constructor.
pcl::IndicesConstPtr IndicesConstPtr
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
PointCloudConstPtr input_
OctreePointCloudSearchPtr tree_
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.
shared_ptr< const pcl::search::Octree< PointInT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::OctreeBase< pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty > > > ConstPtr
typename pcl::octree::OctreePointCloudSearch< PointInT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty >::ConstPtr OctreePointCloudSearchConstPtr
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.
void approxNearestSearch(index_t query_index, index_t &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.
Octree container class that does store a vector of point indices.
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices) override
Provide a pointer to the input dataset.
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.
shared_ptr< pcl::search::Octree< PointInT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, pcl::octree::OctreeBase< pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty > > > Ptr
typename PointCloud::Ptr PointCloudPtr
void setInputCloud(const PointCloudConstPtr &cloud)
Provide a pointer to the input dataset.
search::Octree is a wrapper class which implements nearest neighbor search operations based on the pc...
~Octree()
Empty Destructor.
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.
shared_ptr< OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT >> Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
shared_ptr< const OctreePointCloudSearch< PointT, LeafContainerT, BranchContainerT >> ConstPtr
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< PointInT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty >::Ptr OctreePointCloudSearchPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
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.
Octree container class that does not store any information.
void approxNearestSearch(const PointT &p_q, index_t &result_index, float &sqr_distance)
Search for approximate nearest neighbor at the query point.