Open3D (C++ API)  0.18.0+5c982c7
NanoFlannIndex.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2023 www.open3d.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <vector>
11 
12 #include "open3d/core/Tensor.h"
15 #include "open3d/utility/Logging.h"
16 
17 namespace open3d {
18 namespace core {
19 namespace nns {
20 
24 class NanoFlannIndex : public NNSIndex {
25 public:
28 
33  NanoFlannIndex(const Tensor &dataset_points);
34  NanoFlannIndex(const Tensor &dataset_points, const Dtype &index_dtype);
36  NanoFlannIndex(const NanoFlannIndex &) = delete;
38 
39 public:
40  bool SetTensorData(const Tensor &dataset_points,
41  const Dtype &index_dtype = core::Int64) override;
42 
43  bool SetTensorData(const Tensor &dataset_points,
44  double radius,
45  const Dtype &index_dtype = core::Int64) override {
47  "NanoFlannIndex::SetTensorData with radius not implemented.");
48  }
49 
58  std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
59  int knn) const override;
60 
71  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
72  const Tensor &query_points,
73  const Tensor &radii,
74  bool sort = true) const override;
75 
86  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
87  const Tensor &query_points,
88  double radius,
89  bool sort = true) const override;
90 
102  std::tuple<Tensor, Tensor, Tensor> SearchHybrid(const Tensor &query_points,
103  double radius,
104  int max_knn) const override;
105 
106 protected:
107  // Tensor dataset_points_;
108  std::unique_ptr<NanoFlannIndexHolderBase> holder_;
109 };
110 } // namespace nns
111 } // namespace core
112 } // namespace open3d
#define LogError(...)
Definition: Logging.h:48
Definition: Dtype.h:20
Definition: Tensor.h:32
Definition: NNSIndex.h:21
Definition: NanoFlannIndex.h:24
NanoFlannIndex(const NanoFlannIndex &)=delete
std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const override
Definition: NanoFlannIndex.cpp:57
bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.cpp:35
std::unique_ptr< NanoFlannIndexHolderBase > holder_
Definition: NanoFlannIndex.h:108
std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const override
Definition: NanoFlannIndex.cpp:157
bool SetTensorData(const Tensor &dataset_points, double radius, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.h:43
NanoFlannIndex & operator=(const NanoFlannIndex &)=delete
~NanoFlannIndex()
Definition: NanoFlannIndex.cpp:33
NanoFlannIndex()
Default Constructor.
Definition: NanoFlannIndex.cpp:22
std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort=true) const override
Definition: NanoFlannIndex.cpp:98
const Dtype Int64
Definition: Dtype.cpp:47
Definition: PinholeCameraIntrinsic.cpp:16