|
| KDTreeSingleIndexAdaptor (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &)=delete |
|
| KDTreeSingleIndexAdaptor (const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams ¶ms=KDTreeSingleIndexAdaptorParams()) |
|
void | buildIndex () |
|
void | init_vind () |
|
void | computeBoundingBox (BoundingBox &bbox) |
|
template<class RESULTSET > |
bool | searchLevel (RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const |
|
void | saveIndex (FILE *stream) |
|
void | loadIndex (FILE *stream) |
|
|
template<typename RESULTSET > |
bool | findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const |
|
size_t | knnSearch (const ElementType *query_point, const size_t num_closest, IndexType *out_indices, DistanceType *out_distances_sq, const int=10) const |
|
size_t | radiusSearch (const ElementType *query_point, const DistanceType &radius, std::vector< std::pair< IndexType, DistanceType >> &IndicesDists, const SearchParams &searchParams) const |
|
template<class SEARCH_CALLBACK > |
size_t | radiusSearchCustomCallback (const ElementType *query_point, SEARCH_CALLBACK &resultSet, const SearchParams &searchParams=SearchParams()) const |
|
void | freeIndex (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj) |
|
size_t | size (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj) const |
|
size_t | veclen (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj) |
|
ElementType | dataset_get (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, size_t idx, int component) const |
| Helper accessor to the dataset points:
|
|
size_t | usedMemory (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj) |
|
void | computeMinMax (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, size_t *ind, size_t count, int element, ElementType &min_elem, ElementType &max_elem) |
|
NodePtr | divideTree (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, const size_t left, const size_t right, BoundingBox &bbox) |
|
void | middleSplit_ (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, size_t *ind, size_t count, size_t &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox) |
|
void | planeSplit (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, size_t *ind, const size_t count, int cutfeat, DistanceType &cutval, size_t &lim1, size_t &lim2) |
|
DistanceType | computeInitialDistances (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, const ElementType *vec, distance_vector_t &dists) const |
|
void | save_tree (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, FILE *stream, NodePtr tree) |
|
void | load_tree (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, FILE *stream, NodePtr &tree) |
|
void | saveIndex_ (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, FILE *stream) |
|
void | loadIndex_ (KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, -1, size_t > &obj, FILE *stream) |
|
template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
class nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >
kd-tree static index
Contains the k-d trees and other information for indexing a set of points for nearest-neighbor matching.
The class "DatasetAdaptor" must provide the following interface (can be non-virtual, inlined methods):
inline size_t kdtree_get_point_count() const { ... }
inline T kdtree_get_pt(
const size_t idx,
const size_t dim)
const { ... }
bbox computation loop.
in "bb" so it can be avoided to redo it again.
for point clouds) template <class BBOX> bool kdtree_get_bbox(BBOX &bb) const
{
bb[0].low = ...; bb[0].high = ...;
bb[1].low = ...; bb[1].high = ...;
...
return true;
}
- Template Parameters
-
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::radiusSearch |
( |
const ElementType * |
query_point, |
|
|
const DistanceType & |
radius, |
|
|
std::vector< std::pair< IndexType, DistanceType >> & |
IndicesDists, |
|
|
const SearchParams & |
searchParams |
|
) |
| const |
|
inline |
Find all the neighbors to query_point[0:dim-1] within a maximum radius. The output is given as a vector of pairs, of which the first element is a point index and the second the corresponding distance. Previous contents of IndicesDists are cleared.
If searchParams.sorted==true, the output list is sorted by ascending distances.
For a better performance, it is advisable to do a .reserve() on the vector if you have any wild guess about the number of expected matches.
- See also
- knnSearch, findNeighbors, radiusSearchCustomCallback
- Returns
- The number of points within the given radius (i.e. indices.size() or dists.size() )