11#ifndef NSEARCH_NFLANNSETUP_H
12#define NSEARCH_NFLANNSETUP_H
15#include "nanoflann/include/nanoflann.hpp"
85template <
typename _DistanceType,
typename _IndexType =
size_t>
113 std::vector<IndexType> &indices,
114 std::vector<DistanceType> &dists)
143 inline bool full()
const {
return true; }
176 throw std::runtime_error(
"Cannot invoke RadiusResultSet::worst_item() on "
177 "an empty list of results.");
178 return std::make_pair(0, 0.);
191template <
typename _DistanceType,
typename _IndexType =
size_t>
227 std::vector<IndexType> &indices,
228 std::vector<DistanceType> &dists,
230 const std::vector<IndexType> &dataTags)
232 d_tag(searchPointTag),
263 inline bool full()
const {
return true; }
298 throw std::runtime_error(
"Cannot invoke RadiusResultSet::worst_item() on "
299 "an empty list of results.");
300 return std::make_pair(0, 0.);
313template <
typename _DistanceType,
typename _IndexType =
size_t>
349 std::vector<IndexType> &indices,
350 std::vector<DistanceType> &dists,
352 const std::vector<IndexType> &dataTags)
354 d_tag(searchPointTag),
385 inline bool full()
const {
return true; }
420 throw std::runtime_error(
"Cannot invoke RadiusResultSet::worst_item() on "
421 "an empty list of results.");
422 return std::make_pair(0, 0.);
434typedef nanoflann::KDTreeSingleIndexAdaptor<
441typedef nanoflann::KDTreeSingleIndexAdaptor<
448typedef nanoflann::KDTreeSingleIndexAdaptor<
To collect results of nanoflann tree search. In this class, we check the tag of a potential point and...
_IndexType IndexType
Index type (int, size_t, etc)
void init()
Initialize the data (clear)
const std::vector< IndexType > & d_dataTags
Tag of point data that we want to check with given point to be added to the search result.
_DistanceType DistanceType
Distance type (double, float, etc)
bool full() const
Check (not implemented)
void clear()
Clear the data.
std::vector< DistanceType > & d_dists
Distance of points found within the search radius.
TreeSearchCheckIDExcludeResult(DistanceType radius_, std::vector< IndexType > &indices, std::vector< DistanceType > &dists, const IndexType &searchPointTag, const std::vector< IndexType > &dataTags)
Constructor.
const DistanceType d_r
Define search radius. Note this should be square of radius, where radius is a distance within which w...
bool addPoint(DistanceType dist, IndexType index)
Called during search to add an element matching the criteria.
std::vector< IndexType > & d_indices
Indices within the search radius.
std::pair< IndexType, DistanceType > worst_item() const
Find the worst result (furtherest neighbor) without copying or sorting Pre-conditions: size() > 0.
DistanceType worstDist() const
Return maximum distance for search.
const IndexType & d_tag
Tag of the point we are searching for neighboring points.
size_t size() const
Get the size of currently stored (found so far) indices.
To collect results of nanoflann tree search. In this class, we check the tag of a potential point and...
const IndexType & d_tag
Tag of the point we are searching for neighboring points.
const DistanceType d_r
Define search radius. Note this should be square of radius, where radius is a distance within which w...
_IndexType IndexType
Index type (int, size_t, etc)
std::pair< IndexType, DistanceType > worst_item() const
Find the worst result (furtherest neighbor) without copying or sorting Pre-conditions: size() > 0.
size_t size() const
Get the size of currently stored (found so far) indices.
bool full() const
Check (not implemented)
const std::vector< IndexType > & d_dataTags
Tag of point data that we want to check with given point to be added to the search result.
bool addPoint(DistanceType dist, IndexType index)
Called during search to add an element matching the criteria.
std::vector< IndexType > & d_indices
Indices within the search radius.
std::vector< DistanceType > & d_dists
Distance of points found within the search radius.
_DistanceType DistanceType
Distance type (double, float, etc)
DistanceType worstDist() const
Return maximum distance for search.
void init()
Initialize the data (clear)
TreeSearchCheckIDIncludeResult(DistanceType radius_, std::vector< IndexType > &indices, std::vector< DistanceType > &dists, const IndexType &searchPointTag, const std::vector< IndexType > &dataTags)
Constructor.
void clear()
Clear the data.
To collect results of nanoflann tree search. Default result output of nanoflann search uses std::vect...
_DistanceType DistanceType
Distance type (double, float, etc)
void clear()
Clear the data.
const DistanceType d_r
Define search radius. Note this should be square of radius, where radius is a distance within which w...
DistanceType worstDist() const
Return maximum distance for search.
TreeSearchResult(DistanceType radius_, std::vector< IndexType > &indices, std::vector< DistanceType > &dists)
Constructor.
std::vector< IndexType > & d_indices
Indices within the search radius.
size_t size() const
Get the size of currently stored (found so far) indices.
_IndexType IndexType
Index type (int, size_t, etc)
void init()
Initialize the data (clear)
std::pair< IndexType, DistanceType > worst_item() const
Find the worst result (furtherest neighbor) without copying or sorting Pre-conditions: size() > 0.
bool full() const
Check (not implemented)
bool addPoint(DistanceType dist, IndexType index)
Called during search to add an element matching the criteria.
std::vector< DistanceType > & d_dists
Distance of points found within the search radius.
Methods for performing efficient search of neighboring points.
TreeSearchResult< double, size_t > TreeSearchRes
Define result attributes.
TreeSearchCheckIDIncludeResult< double, size_t > TreeSearchCheckIDIncludeRes
std::vector< util::Point > PointCloud
Define list of points for tree search using nanoflann lib.
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudAdaptor >, PointCloudAdaptor, 3 > NFlannKdTree
Define tree data type for nanoflann.
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudAdaptor >, PointCloudAdaptor, 3 > NFlannKdTree3D
Define tree data type for nanoflann (3D)
nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< double, PointCloudAdaptor >, PointCloudAdaptor, 2 > NFlannKdTree2D
Define tree data type for nanoflann (2D)
TreeSearchCheckIDExcludeResult< double, size_t > TreeSearchCheckIDExcludeRes
Allows custom point cloud data structure to interface with nanoflann. See https://github....
bool kdtree_get_bbox(BBOX &) const
Optional bounding-box computation: return false to default to a standard bbox computation loop....
coord_t kdtree_get_pt(const size_t idx, const size_t dim) const
Get specific coordinate of a point.
const PointCloud & d_obj
Const reference to list of points.
const PointCloud & pointCloud() const
Get vector of points.
double coord_t
Define coordinate type.
size_t kdtree_get_point_count() const
Get number of points in point cloud.
PointCloudAdaptor(const PointCloud &obj)
Constructor.