ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
NNSIndex.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 <vector>
11 
13 
14 namespace cloudViewer {
15 namespace core {
16 namespace nns {
17 
21 class NNSIndex {
22 public:
24  NNSIndex() {}
25  virtual ~NNSIndex() {}
26  NNSIndex(const NNSIndex &) = delete;
27  NNSIndex &operator=(const NNSIndex &) = delete;
28 
29 public:
35  virtual bool SetTensorData(const Tensor &dataset_points,
36  const Dtype &index_dtype) = 0;
37 
43  virtual bool SetTensorData(const Tensor &dataset_points,
44  double radius,
45  const Dtype &index_dtype) = 0;
46 
55  virtual std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
56  int knn) const = 0;
57 
68  virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
69  const Tensor &query_points,
70  const Tensor &radii,
71  bool sort) const = 0;
72 
83  virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
84  const Tensor &query_points, double radius, bool sort) const = 0;
85 
96  virtual std::tuple<Tensor, Tensor, Tensor> SearchHybrid(
97  const Tensor &query_points, double radius, int max_knn) const = 0;
98 
101  int GetDimension() const;
102 
105  size_t GetDatasetSize() const;
106 
109  Dtype GetDtype() const;
110 
113  Device GetDevice() const;
114 
117  Dtype GetIndexDtype() const;
118 
119 protected:
122 };
123 } // namespace nns
124 } // namespace core
125 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::core::nns::NNSIndex::GetDevice
Device GetDevice() const
Definition: NNSIndex.cpp:26
cloudViewer::core::nns::NNSIndex::GetDatasetSize
size_t GetDatasetSize() const
Definition: NNSIndex.cpp:19
cloudViewer::core::nns::NNSIndex::GetDtype
Dtype GetDtype() const
Definition: NNSIndex.cpp:24
cloudViewer::core::Tensor
Definition: Tensor.h:32
cloudViewer::core::Dtype
Definition: Dtype.h:21
NNSIndex.h
cloudViewer::core::nns::NNSIndex::GetDimension
int GetDimension() const
Definition: NNSIndex.cpp:14
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::core::nns::NNSIndex
Definition: NNSIndex.h:21
core
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::nns::NNSIndex::SetTensorData
virtual bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype)=0
cloudViewer::core::nns::NNSIndex::SearchRadius
virtual std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort) const =0
cloudViewer::core::nns::NNSIndex::SearchHybrid
virtual std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const =0
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
cloudViewer::core::nns::NNSIndex::NNSIndex
NNSIndex()
Default Constructor.
Definition: NNSIndex.h:24
cloudViewer::core::nns::NNSIndex::~NNSIndex
virtual ~NNSIndex()
Definition: NNSIndex.h:25
cloudViewer::core::nns::NNSIndex::GetIndexDtype
Dtype GetIndexDtype() const
Definition: NNSIndex.cpp:28
Tensor.h
cloudViewer::core::nns::NNSIndex::index_dtype_
Dtype index_dtype_
Definition: NNSIndex.h:121
radii
std::vector< PointCoordinateType > radii
Definition: qM3C2Tools.cpp:42
cloudViewer::core::nns::NNSIndex::operator=
NNSIndex & operator=(const NNSIndex &)=delete
cloudViewer::core::nns::NNSIndex::SearchKnn
virtual std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const =0
cloudViewer::core::nns::NNSIndex::dataset_points_
Tensor dataset_points_
Definition: NNSIndex.h:120