Point Cloud Library (PCL)  1.15.1-dev
auto.h
1 /*
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2025-, Open Perception Inc.
6 *
7 * All rights reserved
8 */
9 
10 #pragma once
11 
12 #include <pcl/point_cloud.h>
13 #include <pcl/search/search.h>
14 
15 namespace pcl {
16  namespace search {
17  enum class Purpose : std::uint32_t {
18  undefined = 0, ///< Default value, for general-purpose search method
19  radius_search = 1, ///< The search method will mainly be used for radiusSearch
20  one_knn_search = 2, ///< The search method will mainly be used for nearestKSearch where k is 1
21  many_knn_search = 4 ///< The search method will mainly be used for nearestKSearch where k is larger than 1
22  };
23 
24  /**
25  * Automatically select the fastest search method for the given point cloud. Make sure to delete the returned object after use!
26  * \param[in] cloud Point cloud, this function will pass it to the search method via setInputCloud
27  * \param[in] sorted_results Whether the search method should always return results sorted by distance (may be slower than unsorted)
28  * \param[in] purpose Optional, can be used to give more information about what this search method will be used for, to achieve optimal performance
29  */
30  template<typename PointT>
32  {
33  return autoSelectMethod<PointT>(cloud, pcl::IndicesConstPtr(), sorted_results, purpose);
34  }
35 
36  /**
37  * Automatically select the fastest search method for the given point cloud. Make sure to delete the returned object after use!
38  * \param[in] cloud Point cloud, this function will pass it to the search method via setInputCloud
39  * \param[in] indices Will be passed to the search method via setInputCloud, together with the point cloud
40  * \param[in] sorted_results Whether the search method should always return results sorted by distance (may be slower than unsorted)
41  * \param[in] purpose Optional, can be used to give more information about what this search method will be used for, to achieve optimal performance
42  */
43  template<typename PointT>
44  pcl::search::Search<PointT> * autoSelectMethod(const typename pcl::PointCloud<PointT>::ConstPtr& cloud, const pcl::IndicesConstPtr& indices, bool sorted_results, Purpose purpose = Purpose::undefined);
45  } // namespace search
46 } // namespace pcl
47 
48 #ifdef PCL_NO_PRECOMPILE
49 #include <pcl/search/impl/auto.hpp>
50 #endif
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition: point_cloud.h:415
Generic search class.
Definition: search.h:75
@ undefined
Default value, for general-purpose search method.
@ one_knn_search
The search method will mainly be used for nearestKSearch where k is 1.
@ radius_search
The search method will mainly be used for radiusSearch.
@ many_knn_search
The search method will mainly be used for nearestKSearch where k is larger than 1.
pcl::search::Search< PointT > * autoSelectMethod(const typename pcl::PointCloud< PointT >::ConstPtr &cloud, bool sorted_results, Purpose purpose=Purpose::undefined)
Automatically select the fastest search method for the given point cloud.
Definition: auto.h:31
shared_ptr< const Indices > IndicesConstPtr
Definition: pcl_base.h:59