Point Cloud Library (PCL)
1.12.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
search
impl
kdtree.hpp
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2012-, Open Perception, Inc.
6
*
7
* All rights reserved.
8
*
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
11
* are met:
12
*
13
* * Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
15
* * Redistributions in binary form must reproduce the above
16
* copyright notice, this list of conditions and the following
17
* disclaimer in the documentation and/or other materials provided
18
* with the distribution.
19
* * Neither the name of the copyright holder(s) nor the names of its
20
* contributors may be used to endorse or promote products derived
21
* from this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34
* POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
#ifndef PCL_SEARCH_KDTREE_IMPL_HPP_
39
#define PCL_SEARCH_KDTREE_IMPL_HPP_
40
41
#include <pcl/search/kdtree.h>
42
43
///////////////////////////////////////////////////////////////////////////////////////////
44
template
<
typename
Po
int
T,
class
Tree>
45
pcl::search::KdTree<PointT,Tree>::KdTree
(
bool
sorted)
46
:
pcl
::
search
::
Search
<PointT> (
"KdTree"
, sorted)
47
,
tree_
(new Tree (sorted))
48
{
49
}
50
51
///////////////////////////////////////////////////////////////////////////////////////////
52
template
<
typename
Po
int
T,
class
Tree>
void
53
pcl::search::KdTree<PointT,Tree>::setPointRepresentation
(
54
const
PointRepresentationConstPtr
&point_representation)
55
{
56
tree_
->setPointRepresentation (point_representation);
57
}
58
59
///////////////////////////////////////////////////////////////////////////////////////////
60
template
<
typename
Po
int
T,
class
Tree>
void
61
pcl::search::KdTree<PointT,Tree>::setSortedResults
(
bool
sorted_results)
62
{
63
sorted_results_
= sorted_results;
64
tree_
->setSortedResults (sorted_results);
65
}
66
67
///////////////////////////////////////////////////////////////////////////////////////////
68
template
<
typename
Po
int
T,
class
Tree>
void
69
pcl::search::KdTree<PointT,Tree>::setEpsilon
(
float
eps)
70
{
71
tree_
->setEpsilon (eps);
72
}
73
74
///////////////////////////////////////////////////////////////////////////////////////////
75
template
<
typename
Po
int
T,
class
Tree>
void
76
pcl::search::KdTree<PointT,Tree>::setInputCloud
(
77
const
PointCloudConstPtr
& cloud,
78
const
IndicesConstPtr
& indices)
79
{
80
tree_
->setInputCloud (cloud, indices);
81
input_
= cloud;
82
indices_
= indices;
83
}
84
85
///////////////////////////////////////////////////////////////////////////////////////////
86
template
<
typename
Po
int
T,
class
Tree>
int
87
pcl::search::KdTree<PointT,Tree>::nearestKSearch
(
88
const
PointT &point,
int
k,
Indices
&k_indices,
89
std::vector<float> &k_sqr_distances)
const
90
{
91
return
(
tree_
->nearestKSearch (point, k, k_indices, k_sqr_distances));
92
}
93
94
///////////////////////////////////////////////////////////////////////////////////////////
95
template
<
typename
Po
int
T,
class
Tree>
int
96
pcl::search::KdTree<PointT,Tree>::radiusSearch
(
97
const
PointT& point,
double
radius,
98
Indices
&k_indices, std::vector<float> &k_sqr_distances,
99
unsigned
int
max_nn)
const
100
{
101
return
(
tree_
->radiusSearch (point, radius, k_indices, k_sqr_distances, max_nn));
102
}
103
104
#define PCL_INSTANTIATE_KdTree(T) template class PCL_EXPORTS pcl::search::KdTree<T>;
105
106
#endif
//#ifndef _PCL_SEARCH_KDTREE_IMPL_HPP_
107
108
pcl::search::KdTree::nearestKSearch
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.
Definition
kdtree.hpp:87
pcl::search::KdTree::setEpsilon
void setEpsilon(float eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
Definition
kdtree.hpp:69
pcl::search::KdTree::setInputCloud
void setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
Definition
kdtree.hpp:76
pcl::search::KdTree::setSortedResults
void setSortedResults(bool sorted_results) override
Sets whether the results have to be sorted or not.
Definition
kdtree.hpp:61
pcl::search::KdTree::PointCloudConstPtr
typename Search< PointT >::PointCloudConstPtr PointCloudConstPtr
Definition
kdtree.h:65
pcl::search::KdTree::PointRepresentationConstPtr
typename PointRepresentation< PointT >::ConstPtr PointRepresentationConstPtr
Definition
kdtree.h:80
pcl::search::KdTree::setPointRepresentation
void setPointRepresentation(const PointRepresentationConstPtr &point_representation)
Provide a pointer to the point representation to use to convert points into k-D vectors.
Definition
kdtree.hpp:53
pcl::search::KdTree::KdTree
KdTree(bool sorted=true)
Constructor for KdTree.
Definition
kdtree.hpp:45
pcl::search::KdTree::radiusSearch
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.
Definition
kdtree.hpp:96
pcl::search::KdTree::tree_
KdTreePtr tree_
A pointer to the internal KdTree object.
Definition
kdtree.h:167
pcl::search::Search::input_
PointCloudConstPtr input_
Definition
search.h:403
pcl::search::Search::indices_
IndicesConstPtr indices_
Definition
search.h:404
pcl::search::Search::Search
Search(const std::string &name="", bool sorted=false)
Constructor.
Definition
search.hpp:45
pcl::search::Search::IndicesConstPtr
pcl::IndicesConstPtr IndicesConstPtr
Definition
search.h:85
pcl::search::Search::sorted_results_
bool sorted_results_
Definition
search.h:405
pcl::search
Definition
brute_force.h:45
pcl
Definition
convolution.h:46
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition
types.h:133