nanoflann
C++ header-only ANN library
 All Classes Functions Variables Typedefs Groups Pages
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType > Class Template Reference

#include <nanoflann.hpp>

Public Types

typedef Distance::ElementType ElementType
 
typedef Distance::DistanceType DistanceType
 

Public Member Functions

 KDTreeSingleIndexDynamicAdaptor (const int dimensionality, DatasetAdaptor &inputData, const KDTreeSingleIndexAdaptorParams &params=KDTreeSingleIndexAdaptorParams(), const int maximumPointCount=1e9)
 
 ~KDTreeSingleIndexDynamicAdaptor ()
 
void addPoints (IndexType start, IndexType end)
 
void removePoint (int idx)
 
template<typename RESULTSET >
bool findNeighbors (RESULTSET &result, const ElementType *vec, const SearchParams &searchParams) const
 

Public Attributes

Distance distance
 

Protected Attributes

size_t m_leaf_max_size
 
int treeCount
 
int pointCount
 
DatasetAdaptor & dataset
 The source of our data. More...
 
std::vector< int > treeIndex
 treeIndex[idx] is the index of tree in which point at idx is stored. treeIndex[idx]=-1 means that point has been removed.
 
KDTreeSingleIndexAdaptorParams index_params
 
int dim
 Dimensionality of each data point.
 
std::vector
< KDTreeSingleIndexDynamicAdaptor_
< Distance, DatasetAdaptor,
DIM > > 
index
 

Detailed Description

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

kd-tree dynaimic index

class to create multiple static index and merge their results to behave as single dynamic index as proposed in Logarithmic Approach.

Example of usage: examples/dynamic_pointcloud_example.cpp

Template Parameters
DatasetAdaptorThe user-provided adaptor (see comments above).
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
DIMDimensionality of data points (e.g. 3 for 3D points)
IndexTypeWill be typically size_t or int

Constructor & Destructor Documentation

template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::KDTreeSingleIndexDynamicAdaptor ( const int  dimensionality,
DatasetAdaptor &  inputData,
const KDTreeSingleIndexAdaptorParams params = KDTreeSingleIndexAdaptorParams(),
const int  maximumPointCount = 1e9 
)
inline

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
inputDataDataset with the input features
paramsBasically, the maximum leaf node size
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::~KDTreeSingleIndexDynamicAdaptor ( )
inline

Standard destructor

Member Function Documentation

template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::addPoints ( IndexType  start,
IndexType  end 
)
inline

Add points to the set

template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
template<typename RESULTSET >
bool nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::findNeighbors ( RESULTSET &  result,
const ElementType *  vec,
const SearchParams searchParams 
) const
inline

Find set of nearest neighbors to vec[0:dim-1]. Their indices are stored inside the result object.

Params: result = the result object in which the indices of the nearest-neighbors are stored vec = the vector for which to search the nearest neighbors

Template Parameters
RESULTSETShould be any ResultSet<DistanceType>
Returns
True if the requested neighbors could be found.
See Also
knnSearch, radiusSearch
template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
void nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::removePoint ( int  idx)
inline

Remove a point from the set (Lazy Deletion)

Member Data Documentation

template<typename Distance , class DatasetAdaptor , int DIM = -1, typename IndexType = size_t>
DatasetAdaptor& nanoflann::KDTreeSingleIndexDynamicAdaptor< Distance, DatasetAdaptor, DIM, IndexType >::dataset
protected

The source of our data.

The dataset used by this index


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