38 template <
class T,
class DataSource,
typename _DistanceType>
41 template <
class T,
class DataSource,
typename _DistanceType>
44 template <
typename Distance,
class DatasetAdaptor,
int DIM,
typename IndexType>
63 template <
int METRIC,
class T>
67 DataAdaptor(
size_t dataset_size,
int dimension,
const T *
const data_ptr)
68 : dataset_size_(dataset_size),
69 dimension_(dimension),
70 data_ptr_(data_ptr) {}
75 return data_ptr_[idx * dimension_ + dim];
83 size_t dataset_size_ = 0;
89 template <
int M,
typename fake =
void>
92 template <
typename fake>
97 template <
typename fake>
113 adaptor_.reset(
new DataAdaptor(dataset_size, dimension, data_ptr));
114 index_.reset(
new KDTree_t(dimension, *adaptor_.get()));
115 index_->buildIndex();
140 bool SetTensorData(
const Tensor &dataset_points)
override;
144 "NanoFlannIndex::SetTensorData with radius not implemented.");
147 std::pair<Tensor, Tensor> SearchKnn(
const Tensor &query_points,
148 int knn)
const override;
150 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
151 const Tensor &query_points,
const Tensor &radii)
const override;
153 std::tuple<Tensor, Tensor, Tensor> SearchRadius(
154 const Tensor &query_points,
double radius)
const override;
156 std::pair<Tensor, Tensor> SearchHybrid(
const Tensor &query_points,
158 int max_knn)
const override;
162 std::unique_ptr<NanoFlannIndexHolderBase>
holder_;
const T *const data_ptr_
Definition: NanoFlannIndex.h:85
NanoFlannIndexHolder(size_t dataset_size, int dimension, const T *data_ptr)
Definition: NanoFlannIndex.h:110
Definition: NanoFlannIndex.h:42
size_t kdtree_get_point_count() const
Definition: NanoFlannIndex.h:72
virtual ~NanoFlannIndexHolderBase()
Definition: NanoFlannIndex.h:59
nanoflann::L1_Adaptor< T, DataAdaptor, T > adaptor_t
Definition: NanoFlannIndex.h:99
Base struct for Index holder.
Definition: NanoFlannIndex.h:58
bool SetTensorData(const Tensor &dataset_points, double radius) override
Definition: NanoFlannIndex.h:142
Definition: NNSIndex.h:40
void LogError(const char *format, const Args &... args)
Definition: Console.h:176
Metric
Distance metric enum.
Definition: NanoFlannIndex.h:55
Definition: NanoFlannIndex.h:125
Definition: NanoFlannIndex.h:55
Definition: NanoFlannIndex.h:55
NanoFlann Index Holder.
Definition: NanoFlannIndex.h:64
T kdtree_get_pt(const size_t idx, const size_t dim) const
Definition: NanoFlannIndex.h:74
Adaptor Selector.
Definition: NanoFlannIndex.h:90
This class is the Adaptor for connecting Open3D Tensor and NanoFlann.
Definition: NanoFlannIndex.h:66
bool kdtree_get_bbox(BBOX &) const
Definition: NanoFlannIndex.h:79
std::unique_ptr< DataAdaptor > adaptor_
Definition: NanoFlannIndex.h:119
std::unique_ptr< NanoFlannIndexHolderBase > holder_
Definition: NanoFlannIndex.h:162
Definition: NanoFlannIndex.h:55
Definition: NanoFlannIndex.h:45
nanoflann::KDTreeSingleIndexAdaptor< typename SelectNanoflannAdaptor< METRIC >::adaptor_t, DataAdaptor, -1, int64_t > KDTree_t
typedef for KDtree.
Definition: NanoFlannIndex.h:108
Definition: PinholeCameraIntrinsic.cpp:35
Definition: NanoFlannIndex.h:39
DataAdaptor(size_t dataset_size, int dimension, const T *const data_ptr)
Definition: NanoFlannIndex.h:67
std::unique_ptr< KDTree_t > index_
Definition: NanoFlannIndex.h:118
nanoflann::L2_Adaptor< T, DataAdaptor, T > adaptor_t
Definition: NanoFlannIndex.h:94
Definition: NanoFlannIndex.h:36