Loading [MathJax]/jax/output/HTML-CSS/config.js
Open3D (C++ API)  0.16.0
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NanoFlannIndex.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-2021 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 #include <vector>
30 
31 #include "open3d/core/Tensor.h"
34 #include "open3d/utility/Logging.h"
35 
36 namespace open3d {
37 namespace core {
38 namespace nns {
39 
43 class NanoFlannIndex : public NNSIndex {
44 public:
47 
52  NanoFlannIndex(const Tensor &dataset_points);
53  NanoFlannIndex(const Tensor &dataset_points, const Dtype &index_dtype);
55  NanoFlannIndex(const NanoFlannIndex &) = delete;
56  NanoFlannIndex &operator=(const NanoFlannIndex &) = delete;
57 
58 public:
59  bool SetTensorData(const Tensor &dataset_points,
60  const Dtype &index_dtype = core::Int64) override;
61 
62  bool SetTensorData(const Tensor &dataset_points,
63  double radius,
64  const Dtype &index_dtype = core::Int64) override {
66  "NanoFlannIndex::SetTensorData with radius not implemented.");
67  }
68 
77  std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
78  int knn) const override;
79 
90  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
91  const Tensor &query_points,
92  const Tensor &radii,
93  bool sort = true) const override;
94 
105  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
106  const Tensor &query_points,
107  double radius,
108  bool sort = true) const override;
109 
121  std::tuple<Tensor, Tensor, Tensor> SearchHybrid(const Tensor &query_points,
122  double radius,
123  int max_knn) const override;
124 
125 protected:
126  // Tensor dataset_points_;
127  std::unique_ptr<NanoFlannIndexHolderBase> holder_;
128 };
129 } // namespace nns
130 } // namespace core
131 } // namespace open3d
const Dtype Int64
Definition: Dtype.cpp:66
Definition: Dtype.h:39
std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const override
Definition: NanoFlannIndex.cpp:176
Definition: NNSIndex.h:40
Definition: NanoFlannIndex.h:43
std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const override
Definition: NanoFlannIndex.cpp:76
NanoFlannIndex & operator=(const NanoFlannIndex &)=delete
std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort=true) const override
Definition: NanoFlannIndex.cpp:117
bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.cpp:54
std::unique_ptr< NanoFlannIndexHolderBase > holder_
Definition: NanoFlannIndex.h:127
Definition: PinholeCameraIntrinsic.cpp:35
Definition: Tensor.h:51
NanoFlannIndex()
Default Constructor.
Definition: NanoFlannIndex.cpp:41
~NanoFlannIndex()
Definition: NanoFlannIndex.cpp:52
bool SetTensorData(const Tensor &dataset_points, double radius, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.h:62
#define LogError(...)
Definition: Logging.h:67