Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Public Attributes
nanoflann::KDTreeEigenMatrixAdaptor Struct Reference

Detailed Description

A simple KD-tree adaptor for working with data directly stored in an Eigen Matrix, without duplicating the data storage.

Each row in the matrix represents a point in the state space.

Example of usage:

        Eigen::Matrix<num_t,Dynamic,Dynamic>  mat;
        // Fill out "mat"...

        typedef KDTreeEigenMatrixAdaptor< Eigen::Matrix<num_t,Dynamic,Dynamic> >  my_kd_tree_t;
        const int max_leaf = 10;
        my_kd_tree_t   mat_index(dimdim, mat, max_leaf );
        mat_index.index->buildIndex();
        mat_index.index->...
Template Parameters:
DIMIf set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations.
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.

#include <mrpt/otherlibs/nanoflann/nanoflann.hpp>

List of all members.

Public Types

typedef
KDTreeEigenMatrixAdaptor
< MatrixType, DIM, Distance > 
self_t
typedef MatrixType::Scalar num_t
typedef Distance::template
traits< num_t, self_t >
::distance_t 
metric_t
typedef
KDTreeSingleIndexAdaptor
< metric_t, self_t, DIM > 
index_t

Public Member Functions

 KDTreeEigenMatrixAdaptor (const int dimensionality, const MatrixType &mat, const int leaf_max_size=10)
 The kd-tree index for the user to call its methods as usual with any other FLANN index.
 ~KDTreeEigenMatrixAdaptor ()
void query (const num_t *query_point, int num_closest, int *out_indices, num_t *out_distances_sq, const int nChecks=10) const
 Query for the num_closest closest points to a given point (entered as query_point[0:dim-1]).
Interface expected by KDTreeSingleIndexAdaptor
const self_tderived () const
self_tderived ()
size_t kdtree_get_point_count () const
num_t kdtree_distance (const num_t *p1, const size_t idx_p2, size_t size) const
num_t kdtree_get_pt (const size_t idx, int dim) const
template<class BBOX >
bool kdtree_get_bbox (BBOX &bb) const

Public Attributes

index_tindex
const MatrixType & m_data_matrix

Member Typedef Documentation

Definition at line 1184 of file nanoflann.hpp.

typedef Distance::template traits<num_t,self_t>::distance_t nanoflann::KDTreeEigenMatrixAdaptor::metric_t

Definition at line 1183 of file nanoflann.hpp.

typedef MatrixType::Scalar nanoflann::KDTreeEigenMatrixAdaptor::num_t

Definition at line 1182 of file nanoflann.hpp.

Definition at line 1181 of file nanoflann.hpp.


Constructor & Destructor Documentation

nanoflann::KDTreeEigenMatrixAdaptor::KDTreeEigenMatrixAdaptor ( const int  dimensionality,
const MatrixType &  mat,
const int  leaf_max_size = 10 
) [inline]

The kd-tree index for the user to call its methods as usual with any other FLANN index.

Constructor: takes a const ref to the matrix object with the data points

Definition at line 1189 of file nanoflann.hpp.

nanoflann::KDTreeEigenMatrixAdaptor::~KDTreeEigenMatrixAdaptor ( ) [inline]

Definition at line 1198 of file nanoflann.hpp.


Member Function Documentation

const self_t& nanoflann::KDTreeEigenMatrixAdaptor::derived ( ) const [inline]

Definition at line 1218 of file nanoflann.hpp.

self_t& nanoflann::KDTreeEigenMatrixAdaptor::derived ( ) [inline]

Definition at line 1221 of file nanoflann.hpp.

num_t nanoflann::KDTreeEigenMatrixAdaptor::kdtree_distance ( const num_t p1,
const size_t  idx_p2,
size_t  size 
) const [inline]

Definition at line 1231 of file nanoflann.hpp.

References nanoflann::KNNResultSet::size().

template<class BBOX >
bool nanoflann::KDTreeEigenMatrixAdaptor::kdtree_get_bbox ( BBOX &  bb) const [inline]

Definition at line 1250 of file nanoflann.hpp.

size_t nanoflann::KDTreeEigenMatrixAdaptor::kdtree_get_point_count ( ) const [inline]

Definition at line 1226 of file nanoflann.hpp.

num_t nanoflann::KDTreeEigenMatrixAdaptor::kdtree_get_pt ( const size_t  idx,
int  dim 
) const [inline]

Definition at line 1242 of file nanoflann.hpp.

void nanoflann::KDTreeEigenMatrixAdaptor::query ( const num_t query_point,
int  num_closest,
int *  out_indices,
num_t out_distances_sq,
const int  nChecks = 10 
) const [inline]

Query for the num_closest closest points to a given point (entered as query_point[0:dim-1]).

Note that this is a short-cut method for index->findNeighbors(). The user can also call index->... methods as desired.

Definition at line 1208 of file nanoflann.hpp.

References nanoflann::KNNResultSet::init().


Member Data Documentation

Definition at line 1186 of file nanoflann.hpp.

Definition at line 1202 of file nanoflann.hpp.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011