ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NanoFlannIndex.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Logging.h>
11 
12 #include <vector>
13 
17 
18 namespace cloudViewer {
19 namespace core {
20 namespace nns {
21 
25 class NanoFlannIndex : public NNSIndex {
26 public:
29 
34  NanoFlannIndex(const Tensor &dataset_points);
35  NanoFlannIndex(const Tensor &dataset_points, const Dtype &index_dtype);
37  NanoFlannIndex(const NanoFlannIndex &) = delete;
39 
40 public:
41  bool SetTensorData(const Tensor &dataset_points,
42  const Dtype &index_dtype = core::Int64) override;
43 
44  bool SetTensorData(const Tensor &dataset_points,
45  double radius,
46  const Dtype &index_dtype = core::Int64) override {
48  "NanoFlannIndex::SetTensorData with radius not implemented.");
49  }
50 
59  std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
60  int knn) const override;
61 
72  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
73  const Tensor &query_points,
74  const Tensor &radii,
75  bool sort = true) const override;
76 
87  std::tuple<Tensor, Tensor, Tensor> SearchRadius(
88  const Tensor &query_points,
89  double radius,
90  bool sort = true) const override;
91 
103  std::tuple<Tensor, Tensor, Tensor> SearchHybrid(const Tensor &query_points,
104  double radius,
105  int max_knn) const override;
106 
107 protected:
108  // Tensor dataset_points_;
109  std::unique_ptr<NanoFlannIndexHolderBase> holder_;
110 };
111 } // namespace nns
112 } // namespace core
113 } // namespace cloudViewer
std::unique_ptr< NanoFlannIndexHolderBase > holder_
std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const override
std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort=true) const override
bool SetTensorData(const Tensor &dataset_points, double radius, const Dtype &index_dtype=core::Int64) override
bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype=core::Int64) override
std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const override
NanoFlannIndex(const NanoFlannIndex &)=delete
NanoFlannIndex & operator=(const NanoFlannIndex &)=delete
#define LogError(...)
Definition: Logging.h:60
const Dtype Int64
Definition: Dtype.cpp:47
Generic file read and write utility for python interface.
std::vector< PointCoordinateType > radii
Definition: qM3C2Tools.cpp:42