Classes | Public Types | Public Member Functions | Public Attributes | List of all members
nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType > Class Template Reference

#include <nanoflann.hpp>

Classes

struct  Interval
 
struct  Node
 

Public Types

typedef array_or_vector_selector< DIM, Interval >::container_t BoundingBox
 
typedef array_or_vector_selector< DIM, DistanceType >::container_t distance_vector_t
 
typedef Distance::DistanceType DistanceType
 
typedef Distance::ElementType ElementType
 
typedef NodeNodePtr
 

Public Member Functions

DistanceType computeInitialDistances (const Derived &obj, const ElementType *vec, distance_vector_t &dists) const
 
void computeMinMax (const Derived &obj, IndexType *ind, IndexType count, int element, ElementType &min_elem, ElementType &max_elem)
 
ElementType dataset_get (const Derived &obj, size_t idx, int component) const
 Helper accessor to the dataset points: More...
 
NodePtr divideTree (Derived &obj, const IndexType left, const IndexType right, BoundingBox &bbox)
 
void freeIndex (Derived &obj)
 
void load_tree (Derived &obj, FILE *stream, NodePtr &tree)
 
void loadIndex_ (Derived &obj, FILE *stream)
 
void middleSplit_ (Derived &obj, IndexType *ind, IndexType count, IndexType &index, int &cutfeat, DistanceType &cutval, const BoundingBox &bbox)
 
void planeSplit (Derived &obj, IndexType *ind, const IndexType count, int cutfeat, DistanceType &cutval, IndexType &lim1, IndexType &lim2)
 
void save_tree (Derived &obj, FILE *stream, NodePtr tree)
 
void saveIndex_ (Derived &obj, FILE *stream)
 
size_t size (const Derived &obj) const
 
size_t usedMemory (Derived &obj)
 
size_t veclen (const Derived &obj)
 

Public Attributes

int dim
 Dimensionality of each data point. More...
 
size_t m_leaf_max_size
 
size_t m_size
 Number of current points in the dataset. More...
 
size_t m_size_at_index_build
 
PooledAllocator pool
 
BoundingBox root_bbox
 
NodePtr root_node
 
std::vector< IndexType > vind
 

Detailed Description

template<class Derived, typename Distance, class DatasetAdaptor, int DIM = -1, typename IndexType = size_t>
class nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >

kd-tree base-class

Contains the member functions common to the classes KDTreeSingleIndexAdaptor and KDTreeSingleIndexDynamicAdaptor_.

Template Parameters
DerivedThe name of the class which inherits this class.
DatasetAdaptorThe user-provided adaptor (see comments above).
DistanceThe distance metric to use, these are all classes derived from nanoflann::Metric
DIMDimensionality of data points (e.g. 3 for 3D points)
IndexTypeWill be typically size_t or int

Definition at line 739 of file nanoflann.hpp.

Member Typedef Documentation

◆ BoundingBox

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, Interval>::container_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::BoundingBox

Define "BoundingBox" as a fixed-size or variable-size container depending on "DIM"

Definition at line 792 of file nanoflann.hpp.

◆ distance_vector_t

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
typedef array_or_vector_selector<DIM, DistanceType>::container_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::distance_vector_t

Define "distance_vector_t" as a fixed-size or variable-size container depending on "DIM"

Definition at line 797 of file nanoflann.hpp.

◆ DistanceType

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
typedef Distance::DistanceType nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::DistanceType

Definition at line 751 of file nanoflann.hpp.

◆ ElementType

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
typedef Distance::ElementType nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::ElementType

Definition at line 750 of file nanoflann.hpp.

◆ NodePtr

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
typedef Node* nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::NodePtr

Definition at line 769 of file nanoflann.hpp.

Member Function Documentation

◆ computeInitialDistances()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
DistanceType nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::computeInitialDistances ( const Derived &  obj,
const ElementType vec,
distance_vector_t dists 
) const
inline

Definition at line 1005 of file nanoflann.hpp.

◆ computeMinMax()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::computeMinMax ( const Derived &  obj,
IndexType *  ind,
IndexType  count,
int  element,
ElementType min_elem,
ElementType max_elem 
)
inline

Definition at line 836 of file nanoflann.hpp.

◆ dataset_get()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
ElementType nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::dataset_get ( const Derived &  obj,
size_t  idx,
int  component 
) const
inline

Helper accessor to the dataset points:

Definition at line 821 of file nanoflann.hpp.

◆ divideTree()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
NodePtr nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::divideTree ( Derived &  obj,
const IndexType  left,
const IndexType  right,
BoundingBox bbox 
)
inline

Create a tree node that subdivides the list of vecs from vind[first] to vind[last]. The routine is called recursively on each sublist.

Parameters
leftindex of the first vector
rightindex of the last vector

Definition at line 857 of file nanoflann.hpp.

◆ freeIndex()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::freeIndex ( Derived &  obj)
inline

Frees the previously-built index. Automatically called within buildIndex().

Definition at line 744 of file nanoflann.hpp.

◆ load_tree()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::load_tree ( Derived &  obj,
FILE *  stream,
NodePtr tree 
)
inline

Definition at line 1034 of file nanoflann.hpp.

◆ loadIndex_()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::loadIndex_ ( Derived &  obj,
FILE *  stream 
)
inline

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 1064 of file nanoflann.hpp.

◆ middleSplit_()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::middleSplit_ ( Derived &  obj,
IndexType *  ind,
IndexType  count,
IndexType &  index,
int &  cutfeat,
DistanceType cutval,
const BoundingBox bbox 
)
inline

Definition at line 909 of file nanoflann.hpp.

◆ planeSplit()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::planeSplit ( Derived &  obj,
IndexType *  ind,
const IndexType  count,
int  cutfeat,
DistanceType cutval,
IndexType &  lim1,
IndexType &  lim2 
)
inline

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 967 of file nanoflann.hpp.

◆ save_tree()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::save_tree ( Derived &  obj,
FILE *  stream,
NodePtr  tree 
)
inline

Definition at line 1024 of file nanoflann.hpp.

◆ saveIndex_()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::saveIndex_ ( Derived &  obj,
FILE *  stream 
)
inline

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 1050 of file nanoflann.hpp.

◆ size()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::size ( const Derived &  obj) const
inline

Returns number of points in dataset

Definition at line 813 of file nanoflann.hpp.

◆ usedMemory()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::usedMemory ( Derived &  obj)
inline

Computes the inde memory usage Returns: memory used by the index

Definition at line 830 of file nanoflann.hpp.

◆ veclen()

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::veclen ( const Derived &  obj)
inline

Returns the length of each point in the dataset

Definition at line 816 of file nanoflann.hpp.

Member Data Documentation

◆ dim

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
int nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::dim

Dimensionality of each data point.

Definition at line 787 of file nanoflann.hpp.

◆ m_leaf_max_size

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::m_leaf_max_size

Definition at line 782 of file nanoflann.hpp.

◆ m_size

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::m_size

Number of current points in the dataset.

Definition at line 784 of file nanoflann.hpp.

◆ m_size_at_index_build

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
size_t nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::m_size_at_index_build

Number of points in the dataset when the index was built

Definition at line 785 of file nanoflann.hpp.

◆ pool

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
PooledAllocator nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::pool

Pooled memory allocator.

Using a pooled memory allocator is more efficient than allocating memory directly when there is a large number small of memory allocations.

Definition at line 810 of file nanoflann.hpp.

◆ root_bbox

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
BoundingBox nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::root_bbox

The KD-tree used to find neighbours

Definition at line 801 of file nanoflann.hpp.

◆ root_node

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
NodePtr nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::root_node

Definition at line 780 of file nanoflann.hpp.

◆ vind

template<class Derived , typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
std::vector<IndexType> nanoflann::KDTreeBaseClass< Derived, Distance, DatasetAdaptor, DIM, IndexType >::vind

Array of indices to vectors in the dataset.

Definition at line 778 of file nanoflann.hpp.


The documentation for this class was generated from the following file:


slam_toolbox
Author(s): Steve Macenski
autogenerated on Thu Jan 11 2024 03:37:56