Open3D (C++ API)  0.16.0
NanoFlannIndex.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"
35
36namespace open3d {
37namespace core {
38namespace nns {
39
43class NanoFlannIndex : public NNSIndex {
44public:
47
52 NanoFlannIndex(const Tensor &dataset_points);
53 NanoFlannIndex(const Tensor &dataset_points, const Dtype &index_dtype);
55 NanoFlannIndex(const NanoFlannIndex &) = delete;
57
58public:
59 bool SetTensorData(const Tensor &dataset_points,
60 const Dtype &index_dtype = core::Int64) override;
61
62 bool SetTensorData(const Tensor &dataset_points,
63 double radius,
64 const Dtype &index_dtype = core::Int64) override {
66 "NanoFlannIndex::SetTensorData with radius not implemented.");
67 }
68
77 std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
78 int knn) const override;
79
90 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
91 const Tensor &query_points,
92 const Tensor &radii,
93 bool sort = true) const override;
94
105 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
106 const Tensor &query_points,
107 double radius,
108 bool sort = true) const override;
109
121 std::tuple<Tensor, Tensor, Tensor> SearchHybrid(const Tensor &query_points,
122 double radius,
123 int max_knn) const override;
124
125protected:
126 // Tensor dataset_points_;
127 std::unique_ptr<NanoFlannIndexHolderBase> holder_;
128};
129} // namespace nns
130} // namespace core
131} // namespace open3d
#define LogError(...)
Definition: Logging.h:67
Definition: Dtype.h:39
Definition: Tensor.h:51
Definition: NNSIndex.h:40
Definition: NanoFlannIndex.h:43
NanoFlannIndex(const NanoFlannIndex &)=delete
std::pair< Tensor, Tensor > SearchKnn(const Tensor &query_points, int knn) const override
Definition: NanoFlannIndex.cpp:76
NanoFlannIndex & operator=(const NanoFlannIndex &)=delete
bool SetTensorData(const Tensor &dataset_points, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.cpp:54
std::unique_ptr< NanoFlannIndexHolderBase > holder_
Definition: NanoFlannIndex.h:127
std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const override
Definition: NanoFlannIndex.cpp:176
bool SetTensorData(const Tensor &dataset_points, double radius, const Dtype &index_dtype=core::Int64) override
Definition: NanoFlannIndex.h:62
~NanoFlannIndex()
Definition: NanoFlannIndex.cpp:52
NanoFlannIndex()
Default Constructor.
Definition: NanoFlannIndex.cpp:41
std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort=true) const override
Definition: NanoFlannIndex.cpp:117
const Dtype Int64
Definition: Dtype.cpp:66
Definition: PinholeCameraIntrinsic.cpp:35