Open3D (C++ API)  0.15.1
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);
54 NanoFlannIndex(const NanoFlannIndex &) = delete;
56
57public:
58 bool SetTensorData(const Tensor &dataset_points) override;
59
60 bool SetTensorData(const Tensor &dataset_points, double radius) override {
62 "NanoFlannIndex::SetTensorData with radius not implemented.");
63 }
64
73 std::pair<Tensor, Tensor> SearchKnn(const Tensor &query_points,
74 int knn) const override;
75
86 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
87 const Tensor &query_points,
88 const Tensor &radii,
89 bool sort = true) const override;
90
101 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
102 const Tensor &query_points,
103 double radius,
104 bool sort = true) const override;
105
117 std::tuple<Tensor, Tensor, Tensor> SearchHybrid(const Tensor &query_points,
118 double radius,
119 int max_knn) const override;
120
121protected:
122 // Tensor dataset_points_;
123 std::unique_ptr<NanoFlannIndexHolderBase> holder_;
124};
125} // namespace nns
126} // namespace core
127} // namespace open3d
#define LogError(...)
Definition: Logging.h:67
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:70
NanoFlannIndex & operator=(const NanoFlannIndex &)=delete
bool SetTensorData(const Tensor &dataset_points, double radius) override
Definition: NanoFlannIndex.h:60
std::unique_ptr< NanoFlannIndexHolderBase > holder_
Definition: NanoFlannIndex.h:123
std::tuple< Tensor, Tensor, Tensor > SearchHybrid(const Tensor &query_points, double radius, int max_knn) const override
Definition: NanoFlannIndex.cpp:166
~NanoFlannIndex()
Definition: NanoFlannIndex.cpp:49
NanoFlannIndex()
Default Constructor.
Definition: NanoFlannIndex.cpp:43
std::tuple< Tensor, Tensor, Tensor > SearchRadius(const Tensor &query_points, const Tensor &radii, bool sort=true) const override
Definition: NanoFlannIndex.cpp:110
bool SetTensorData(const Tensor &dataset_points) override
Definition: NanoFlannIndex.cpp:51
Definition: PinholeCameraIntrinsic.cpp:35