Open3D (C++ API)  0.12.0
NNSIndex.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 #include <vector>
30 
31 #include "open3d/core/Tensor.h"
32 
33 namespace open3d {
34 namespace core {
35 namespace nns {
36 
40 class NNSIndex {
41 public:
43  NNSIndex() {}
44  virtual ~NNSIndex() {}
45  NNSIndex(const NNSIndex &) = delete;
46  NNSIndex &operator=(const NNSIndex &) = delete;
47 
48 public:
54  virtual bool SetTensorData(const Tensor &dataset_points) = 0;
55 
61  virtual bool SetTensorData(const Tensor &dataset_points, double radius) = 0;
62 
71  virtual std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
72  int knn) const = 0;
73 
84  virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
85  const Tensor &query_points, const Tensor &radii) const = 0;
86 
97  virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
98  const Tensor &query_points, double radius) const = 0;
99 
109  virtual std::pair<Tensor, Tensor> SearchHybrid(const Tensor &query_points,
110  float radius,
111  int max_knn) const = 0;
112 
115  int GetDimension() const;
116 
119  size_t GetDatasetSize() const;
120 
123  Dtype GetDtype() const;
124 
127  Device GetDevice() const;
128 
129 protected:
131 };
132 } // namespace nns
133 } // namespace core
134 } // namespace open3d
virtual bool SetTensorData(const Tensor &dataset_points)=0
Definition: Dtype.h:39
size_t GetDatasetSize() const
Definition: NNSIndex.cpp:41
Dtype GetDtype() const
Definition: NNSIndex.cpp:46
Definition: NNSIndex.h:40
virtual ~NNSIndex()
Definition: NNSIndex.h:44
int GetDimension() const
Definition: NNSIndex.cpp:36
NNSIndex()
Default Constructor.
Definition: NNSIndex.h:43
virtual std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii) const =0
Definition: Device.h:39
virtual std::pair< Tensor, Tensor > SearchHybrid(const Tensor &query_points, float radius, int max_knn) const =0
Definition: PinholeCameraIntrinsic.cpp:35
virtual std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const =0
Tensor dataset_points_
Definition: NNSIndex.h:130
Definition: Tensor.h:48
Device GetDevice() const
Definition: NNSIndex.cpp:48
NNSIndex & operator=(const NNSIndex &)=delete