ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
flann::Index< Distance > Class Template Reference

#include <flann.hpp>

Public Types

typedef Distance::ElementType ElementType
 
typedef Distance::ResultType DistanceType
 
typedef NNIndex< DistanceIndexType
 

Public Member Functions

 Index (const IndexParams &params, Distance distance=Distance())
 
 Index (const Matrix< ElementType > &features, const IndexParams &params, Distance distance=Distance())
 
 Index (const Index &other)
 
Indexoperator= (Index other)
 
virtual ~Index ()
 
void buildIndex ()
 
void buildIndex (const Matrix< ElementType > &points)
 
void addPoints (const Matrix< ElementType > &points, float rebuild_threshold=2)
 
void removePoint (size_t point_id)
 
ElementTypegetPoint (size_t point_id)
 
void save (std::string filename)
 
size_t veclen () const
 
size_t size () const
 
flann_algorithm_t getType () const
 
int usedMemory () const
 
IndexParams getParameters () const
 
int knnSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, size_t knn, const SearchParams &params) const
 
int knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 Perform k-nearest neighbor search. More...
 
int knnSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, size_t knn, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< size_t > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 Perform radius search. More...
 
int radiusSearch (const Matrix< ElementType > &queries, Matrix< int > &indices, Matrix< DistanceType > &dists, float radius, const SearchParams &params) const
 
int radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< size_t > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams &params) const
 Perform radius search. More...
 
int radiusSearch (const Matrix< ElementType > &queries, std::vector< std::vector< int > > &indices, std::vector< std::vector< DistanceType > > &dists, float radius, const SearchParams &params) const
 

Detailed Description

template<typename Distance>
class flann::Index< Distance >

Definition at line 76 of file flann.hpp.

Member Typedef Documentation

◆ DistanceType

template<typename Distance >
typedef Distance::ResultType flann::Index< Distance >::DistanceType

Definition at line 80 of file flann.hpp.

◆ ElementType

template<typename Distance >
typedef Distance::ElementType flann::Index< Distance >::ElementType

Definition at line 79 of file flann.hpp.

◆ IndexType

template<typename Distance >
typedef NNIndex<Distance> flann::Index< Distance >::IndexType

Definition at line 81 of file flann.hpp.

Constructor & Destructor Documentation

◆ Index() [1/3]

template<typename Distance >
flann::Index< Distance >::Index ( const IndexParams params,
Distance  distance = Distance() 
)
inline

Definition at line 83 of file flann.hpp.

References FLANN_INDEX_SAVED, and params.

◆ Index() [2/3]

template<typename Distance >
flann::Index< Distance >::Index ( const Matrix< ElementType > &  features,
const IndexParams params,
Distance  distance = Distance() 
)
inline

Definition at line 101 of file flann.hpp.

References FLANN_INDEX_SAVED, and params.

◆ Index() [3/3]

template<typename Distance >
flann::Index< Distance >::Index ( const Index< Distance > &  other)
inline

Definition at line 118 of file flann.hpp.

References flann::NNIndex< Distance >::clone().

◆ ~Index()

template<typename Distance >
virtual flann::Index< Distance >::~Index ( )
inlinevirtual

Definition at line 129 of file flann.hpp.

Member Function Documentation

◆ addPoints()

template<typename Distance >
void flann::Index< Distance >::addPoints ( const Matrix< ElementType > &  points,
float  rebuild_threshold = 2 
)
inline

Definition at line 149 of file flann.hpp.

References flann::NNIndex< Distance >::addPoints(), and points.

Referenced by __flann_add_points().

◆ buildIndex() [1/2]

template<typename Distance >
void flann::Index< Distance >::buildIndex ( )
inline

◆ buildIndex() [2/2]

template<typename Distance >
void flann::Index< Distance >::buildIndex ( const Matrix< ElementType > &  points)
inline

Definition at line 144 of file flann.hpp.

References flann::NNIndex< Distance >::buildIndex(), and points.

◆ getParameters()

template<typename Distance >
IndexParams flann::Index< Distance >::getParameters ( ) const
inline
Returns
The index parameters

Definition at line 223 of file flann.hpp.

References flann::NNIndex< Distance >::getParameters().

Referenced by __flann_build_index(), and flann::mpi::Index< Distance >::getIndexParameters().

◆ getPoint()

template<typename Distance >
ElementType* flann::Index< Distance >::getPoint ( size_t  point_id)
inline

Returns pointer to a data point with the specified id.

Parameters
point_idthe id of point to retrieve
Returns

Definition at line 168 of file flann.hpp.

References flann::NNIndex< Distance >::getPoint().

Referenced by __flann_get_point().

◆ getType()

template<typename Distance >
flann_algorithm_t flann::Index< Distance >::getType ( ) const
inline
Returns
The index type (kdtree, kmeans,...)

Definition at line 206 of file flann.hpp.

References flann::IndexBase::getType().

Referenced by flann::save_header().

◆ knnSearch() [1/4]

template<typename Distance >
int flann::Index< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
size_t  knn,
const SearchParams params 
) const
inline
Parameters
queries
indices
dists
knn
params
Returns

Definition at line 254 of file flann.hpp.

References flann::NNIndex< Distance >::knnSearch(), and params.

◆ knnSearch() [2/4]

template<typename Distance >
int flann::Index< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
Matrix< size_t > &  indices,
Matrix< DistanceType > &  dists,
size_t  knn,
const SearchParams params 
) const
inline

Perform k-nearest neighbor search.

Parameters
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Definition at line 236 of file flann.hpp.

References flann::NNIndex< Distance >::knnSearch(), and params.

Referenced by __flann_find_nearest_neighbors(), __flann_find_nearest_neighbors_index(), flann::search_with_ground_truth(), and SearchKDTree().

◆ knnSearch() [3/4]

template<typename Distance >
int flann::Index< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
size_t  knn,
const SearchParams params 
) const
inline
Parameters
queries
indices
dists
knn
params
Returns

Definition at line 289 of file flann.hpp.

References flann::NNIndex< Distance >::knnSearch(), and params.

◆ knnSearch() [4/4]

template<typename Distance >
int flann::Index< Distance >::knnSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< size_t > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
size_t  knn,
const SearchParams params 
) const
inline

Perform k-nearest neighbor search.

Parameters
[in]queriesThe query points for which to find the nearest neighbors
[out]indicesThe indices of the nearest neighbors found
[out]distsDistances to the nearest neighbors found
[in]knnNumber of nearest neighbors to return
[in]paramsSearch parameters

Definition at line 271 of file flann.hpp.

References flann::NNIndex< Distance >::knnSearch(), and params.

◆ operator=()

template<typename Distance >
Index& flann::Index< Distance >::operator= ( Index< Distance other)
inline

Definition at line 123 of file flann.hpp.

◆ radiusSearch() [1/4]

template<typename Distance >
int flann::Index< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
Matrix< int > &  indices,
Matrix< DistanceType > &  dists,
float  radius,
const SearchParams params 
) const
inline
Parameters
queries
indices
dists
radius
params
Returns

Definition at line 325 of file flann.hpp.

References params, and flann::NNIndex< Distance >::radiusSearch().

◆ radiusSearch() [2/4]

template<typename Distance >
int flann::Index< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
Matrix< size_t > &  indices,
Matrix< DistanceType > &  dists,
float  radius,
const SearchParams params 
) const
inline

Perform radius search.

Parameters
[in]queriesThe query points
[out]indicesThe indices of the neighbors found within the given radius
[out]distsThe distances to the nearest neighbors found
[in]radiusThe radius used for search
[in]paramsSearch parameters
Returns
Number of neighbors found

Definition at line 307 of file flann.hpp.

References params, and flann::NNIndex< Distance >::radiusSearch().

Referenced by __flann_radius_search().

◆ radiusSearch() [3/4]

template<typename Distance >
int flann::Index< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< int > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
float  radius,
const SearchParams params 
) const
inline
Parameters
queries
indices
dists
radius
params
Returns

Definition at line 361 of file flann.hpp.

References params, and flann::NNIndex< Distance >::radiusSearch().

◆ radiusSearch() [4/4]

template<typename Distance >
int flann::Index< Distance >::radiusSearch ( const Matrix< ElementType > &  queries,
std::vector< std::vector< size_t > > &  indices,
std::vector< std::vector< DistanceType > > &  dists,
float  radius,
const SearchParams params 
) const
inline

Perform radius search.

Parameters
[in]queriesThe query points
[out]indicesThe indices of the neighbors found within the given radius
[out]distsThe distances to the nearest neighbors found
[in]radiusThe radius used for search
[in]paramsSearch parameters
Returns
Number of neighbors found

Definition at line 343 of file flann.hpp.

References params, and flann::NNIndex< Distance >::radiusSearch().

◆ removePoint()

template<typename Distance >
void flann::Index< Distance >::removePoint ( size_t  point_id)
inline

Remove point from the index

Parameters
indexIndex of point to be removed

Definition at line 158 of file flann.hpp.

References flann::NNIndex< Distance >::removePoint().

Referenced by __flann_remove_point().

◆ save()

template<typename Distance >
void flann::Index< Distance >::save ( std::string  filename)
inline

Save index to file

Parameters
filename

Definition at line 177 of file flann.hpp.

References filename, NULL, and flann::IndexBase::saveIndex().

Referenced by __flann_save_index().

◆ size()

template<typename Distance >
size_t flann::Index< Distance >::size ( ) const
inline
Returns
The dimensionality of the features in this index.

Definition at line 198 of file flann.hpp.

References flann::NNIndex< Distance >::size().

Referenced by __flann_size(), and flann::save_header().

◆ usedMemory()

template<typename Distance >
int flann::Index< Distance >::usedMemory ( ) const
inline
Returns
The amount of memory (in bytes) used by the index.

Definition at line 214 of file flann.hpp.

References flann::IndexBase::usedMemory().

Referenced by __flann_used_memory().

◆ veclen()

template<typename Distance >
size_t flann::Index< Distance >::veclen ( ) const
inline

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