Open3D (C++ API)  0.16.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-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"
32
33namespace open3d {
34namespace core {
35namespace nns {
36
40class NNSIndex {
41public:
44 virtual ~NNSIndex() {}
45 NNSIndex(const NNSIndex &) = delete;
46 NNSIndex &operator=(const NNSIndex &) = delete;
47
48public:
54 virtual bool SetTensorData(const Tensor &dataset_points,
55 const Dtype &index_dtype) = 0;
56
62 virtual bool SetTensorData(const Tensor &dataset_points,
63 double radius,
64 const Dtype &index_dtype) = 0;
65
74 virtual std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
75 int knn) const = 0;
76
87 virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
88 const Tensor &query_points,
89 const Tensor &radii,
90 bool sort) const = 0;
91
102 virtual std::tuple<Tensor, Tensor, Tensor> SearchRadius(
103 const Tensor &query_points, double radius, bool sort) const = 0;
104
115 virtual std::tuple<Tensor, Tensor, Tensor> SearchHybrid(
116 const Tensor &query_points, double radius, int max_knn) const = 0;
117
120 int GetDimension() const;
121
124 size_t GetDatasetSize() const;
125
128 Dtype GetDtype() const;
129
132 Device GetDevice() const;
133
136 Dtype GetIndexDtype() const;
137
138protected:
141};
142} // namespace nns
143} // namespace core
144} // namespace open3d
Definition: Device.h:37
Definition: Dtype.h:39
Definition: Tensor.h:51
Definition: NNSIndex.h:40
Dtype index_dtype_
Definition: NNSIndex.h:140
Dtype GetDtype() const
Definition: NNSIndex.cpp:43
virtual std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort) const =0
virtual ~NNSIndex()
Definition: NNSIndex.h:44
NNSIndex(const NNSIndex &)=delete
size_t GetDatasetSize() const
Definition: NNSIndex.cpp:38
virtual std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const =0
Device GetDevice() const
Definition: NNSIndex.cpp:45
virtual bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype)=0
virtual std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, double radius, bool sort) const =0
virtual std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const =0
Tensor dataset_points_
Definition: NNSIndex.h:139
NNSIndex()
Default Constructor.
Definition: NNSIndex.h:43
NNSIndex & operator=(const NNSIndex &)=delete
Dtype GetIndexDtype() const
Definition: NNSIndex.cpp:47
int GetDimension() const
Definition: NNSIndex.cpp:33
virtual bool SetTensorData(const Tensor &dataset_points, double radius, const Dtype &index_dtype)=0
Definition: PinholeCameraIntrinsic.cpp:35