Open3D (C++ API)
KDTreeSearchParam.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 namespace open3d {
30 namespace geometry {
31 
36 public:
40  enum class SearchType {
41  Knn = 0,
42  Radius = 1,
43  Hybrid = 2,
44  };
45 
46 public:
47  virtual ~KDTreeSearchParam() {}
48 
49 protected:
50  KDTreeSearchParam(SearchType type) : search_type_(type) {}
51 
52 public:
54  SearchType GetSearchType() const { return search_type_; }
55 
56 private:
57  SearchType search_type_;
58 };
59 
64 public:
69  KDTreeSearchParamKNN(int knn = 30)
70  : KDTreeSearchParam(SearchType::Knn), knn_(knn) {}
71 
72 public:
74  int knn_;
75 };
76 
81 public:
85  KDTreeSearchParamRadius(double radius)
86  : KDTreeSearchParam(SearchType::Radius), radius_(radius) {}
87 
88 public:
90  double radius_;
91 };
92 
97 public:
102  KDTreeSearchParamHybrid(double radius, int max_nn)
104  radius_(radius),
105  max_nn_(max_nn) {}
106 
107 public:
109  double radius_;
111  int max_nn_;
112 };
113 
114 } // namespace geometry
115 } // namespace open3d
int max_nn_
At maximum, max_nn neighbors will be searched.
Definition: KDTreeSearchParam.h:111
double radius_
Search radius.
Definition: KDTreeSearchParam.h:90
KDTreeSearchParamKNN(int knn=30)
Default Cosntructor.
Definition: KDTreeSearchParam.h:69
KDTreeSearchParamHybrid(double radius, int max_nn)
Default Cosntructor.
Definition: KDTreeSearchParam.h:102
double radius_
Search radius.
Definition: KDTreeSearchParam.h:109
KDTree search parameters for hybrid KNN and radius search.
Definition: KDTreeSearchParam.h:96
virtual ~KDTreeSearchParam()
Definition: KDTreeSearchParam.h:47
SearchType
Specifies the search type for the search.
Definition: KDTreeSearchParam.h:40
Base class for KDTree search parameters.
Definition: KDTreeSearchParam.h:35
SearchType GetSearchType() const
Get the search type (KNN, Radius, Hybrid) for the search parameter.
Definition: KDTreeSearchParam.h:54
char type
Definition: FilePCD.cpp:58
int knn_
Number of the neighbors that will be searched.
Definition: KDTreeSearchParam.h:74
KDTree search parameters for pure radius search.
Definition: KDTreeSearchParam.h:80
Definition: Open3DViewer.h:29
KDTreeSearchParam(SearchType type)
Definition: KDTreeSearchParam.h:50
KDTree search parameters for pure KNN search.
Definition: KDTreeSearchParam.h:63
KDTreeSearchParamRadius(double radius)
Default Cosntructor.
Definition: KDTreeSearchParam.h:85