|
| KDTreeSingleIndexAdaptor (const int dimensionality, const DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams ¶ms=KDTreeSingleIndexAdaptorParams()) |
|
| ~KDTreeSingleIndexAdaptor () |
|
void | freeIndex () |
|
void | buildIndex () |
|
size_t | size () const |
|
size_t | veclen () const |
|
size_t | usedMemory () 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 |
|
|
| KDTreeSingleIndexAdaptor (const KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType > &) |
|
void | init_vind () |
|
ElementType | dataset_get (size_t idx, int component) const |
| Helper accessor to the dataset points: More...
|
|
void | save_tree (FILE *stream, NodePtr tree) |
|
void | load_tree (FILE *stream, NodePtr &tree) |
|
void | computeBoundingBox (BoundingBox &bbox) |
|
NodePtr | divideTree (const IndexType left, const IndexType right, BoundingBox &bbox) |
|
void | computeMinMax (IndexType *ind, IndexType count, int element, ElementType &min_elem, ElementType &max_elem) |
|
void | middleSplit_ (IndexType *ind, IndexType count, IndexType &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox) |
|
void | planeSplit (IndexType *ind, const IndexType count, int cutfeat, DistanceType &cutval, IndexType &lim1, IndexType &lim2) |
|
DistanceType | computeInitialDistances (const ElementType *vec, distance_vector_t &dists) const |
|
template<class RESULTSET > |
bool | searchLevel (RESULTSET &result_set, const ElementType *vec, const NodePtr node, DistanceType mindistsq, distance_vector_t &dists, const float epsError) const |
|
template<typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
class nanoflann::KDTreeSingleIndexAdaptor< Distance, DatasetAdaptor, DIM, IndexType >
kd-tree 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 DistanceType kdtree_distance(
const T *p1,
const size_t idx_p2,
size_t size)
const { ... }
inline T kdtree_get_pt(
const size_t idx,
int dim)
const { ... }
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
-
Definition at line 745 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
KDTree constructor
Refer to docs in README.md or online in https://github.com/jlblancoc/nanoflann
The KD-Tree point dimension (the length of each point in the datase, e.g. 3 for 3D points) is determined by means of:
- The DIM template parameter if >0 (highest priority)
- Otherwise, the dimensionality parameter of this constructor.
- Parameters
-
inputData | Dataset with the input features |
params | Basically, the maximum leaf node size |
Definition at line 836 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
template<typename RESULTSET >
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
Loads a previous index from a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so the index object must be constructed associated to the same source of data points used while building the index. See the example: examples/saveload_example.cpp
- See also
- loadIndex
Definition at line 1291 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
Subdivide the list of points by a plane perpendicular on axe corresponding to the 'cutfeat' dimension at 'cutval' position.
On return: dataset[ind[0..lim1-1]][cutfeat]<cutval dataset[ind[lim1..lim2-1]][cutfeat]==cutval dataset[ind[lim2..count]][cutfeat]>cutval
Definition at line 1159 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
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() )
Definition at line 950 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
template<class SEARCH_CALLBACK >
Just like radiusSearch() but with a custom callback class for each point found in the radius of the query. See the source of RadiusResultSet<> as a start point for your own classes.
- See also
- radiusSearch
Definition at line 965 of file nanoflann.hpp.
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
Stores the index in a binary file. IMPORTANT NOTE: The set of data points is NOT stored in the file, so when loading the index object it must be constructed associated to the same source of data points used while building it. See the example: examples/saveload_example.cpp
- See also
- loadIndex
Definition at line 1277 of file nanoflann.hpp.