38#ifndef PCL_SEARCH_KDTREE_IMPL_HPP_
39#define PCL_SEARCH_KDTREE_IMPL_HPP_
41#include <pcl/search/kdtree.h>
44template <
typename Po
intT,
class Tree>
47 ,
tree_ (new Tree (sorted))
51template <
typename Po
intT,
class Tree>
58template <
typename Po
intT,
class Tree>
void
63 tree_->setPointRepresentation (point_representation);
65 PCL_ERROR(
"Calling setPointRepresentation on KdTreeNanoflann that has been cast to KdTree is not possible in this PCL version. Call setPointRepresentation directly on the KdTreeNanoflann object.\n");
69template <
typename Po
intT,
class Tree>
void
73 tree_->setSortedResults (sorted_results);
77template <
typename Po
intT,
class Tree>
void
81 tree_->setEpsilon (eps);
83 PCL_ERROR(
"Calling setEpsilon on KdTreeNanoflann that has been cast to KdTree is not possible in this PCL version. Call setEpsilon directly on the KdTreeNanoflann object.\n");
87template <
typename Po
intT,
class Tree>
bool
92 tree_->setInputCloud (cloud, indices);
99template <
typename Po
intT,
class Tree>
int
101 const PointT &point,
int k,
Indices &k_indices,
102 std::vector<float> &k_sqr_distances)
const
104 return (
tree_->nearestKSearch (point, k, k_indices, k_sqr_distances));
108template <
typename Po
intT,
class Tree>
int
110 const PointT& point,
double radius,
111 Indices &k_indices, std::vector<float> &k_sqr_distances,
112 unsigned int max_nn)
const
114 return (
tree_->radiusSearch (point, radius, k_indices, k_sqr_distances, max_nn));
117#define PCL_INSTANTIATE_KdTree(T) template class PCL_EXPORTS pcl::search::KdTree<T>;
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 setEpsilon(float eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
void setSortedResults(bool sorted_results) override
Sets whether the results have to be sorted or not.
typename Search< SceneT >::PointCloudConstPtr PointCloudConstPtr
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a pointer to the point representation to use to convert points into k-D vectors.
bool setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
KdTree(bool sorted=true)
Constructor for KdTree.
int radiusSearch(const PointT &point, double radius, Indices &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0) const override
Search for all the nearest neighbors of the query point in a given radius.
KdTreePtr tree_
A pointer to the internal KdTree object.
PointCloudConstPtr input_
Search(const std::string &name="", bool sorted=false)
Constructor.
pcl::IndicesConstPtr IndicesConstPtr
IndicesAllocator<> Indices
Type used for indices in PCL.