eos 1.4.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
eos::fitting::KDTreeVectorOfVectorsAdaptor< VectorOfVectorsType, num_t, DIM, Distance, IndexType > Struct Template Reference

#include <closest_edge_fitting.hpp>

Public Types

typedef KDTreeVectorOfVectorsAdaptor< VectorOfVectorsType, num_t, DIM, Distance > self_t
 
typedef Distance::template traits< num_t, self_t >::distance_t metric_t
 
typedef nanoflann::KDTreeSingleIndexAdaptor< metric_t, self_t, DIM, IndexType > index_t
 

Public Member Functions

 KDTreeVectorOfVectorsAdaptor (const int dimensionality, const VectorOfVectorsType &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.
 
void query (const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq, const int nChecks_IGNORED=10) const
 
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 &) const
 

Public Attributes

index_t * index
 
const VectorOfVectorsType & m_data
 

Detailed Description

template<class VectorOfVectorsType, typename num_t = double, int DIM = -1, class Distance = nanoflann::metric_L2, typename IndexType = size_t>
struct eos::fitting::KDTreeVectorOfVectorsAdaptor< VectorOfVectorsType, num_t, DIM, Distance, IndexType >

A simple vector-of-vectors adaptor for nanoflann, without duplicating the storage. The i'th vector represents a point in the state space.

This adaptor is from the nanoflann examples and shows how to use it with these types of containers: typedef std::vector<std::vector<double> > my_vector_of_vectors_t; typedef std::vector<Eigen::VectorXd> my_vector_of_vectors_t;

It works with any type inside the vector that has operator[] defined to access its elements, as well as a ::size() operator to return its number of dimensions. Eigen::VectorX is one of them. cv::Point is not (no [] and no size()), glm is also not (no size()).

Template Parameters
DIMIf set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations.
num_tThe type of the point coordinates (typically, double or float).
DistanceThe distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc.
IndexTypeThe type for indices in the KD-tree index (typically, size_t of int)

Constructor & Destructor Documentation

◆ KDTreeVectorOfVectorsAdaptor()

template<class VectorOfVectorsType , typename num_t = double, int DIM = -1, class Distance = nanoflann::metric_L2, typename IndexType = size_t>
eos::fitting::KDTreeVectorOfVectorsAdaptor< VectorOfVectorsType, num_t, DIM, Distance, IndexType >::KDTreeVectorOfVectorsAdaptor ( const int  dimensionality,
const VectorOfVectorsType &  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 vector of vectors object with the data points

Member Function Documentation

◆ query()

template<class VectorOfVectorsType , typename num_t = double, int DIM = -1, class Distance = nanoflann::metric_L2, typename IndexType = size_t>
void eos::fitting::KDTreeVectorOfVectorsAdaptor< VectorOfVectorsType, num_t, DIM, Distance, IndexType >::query ( const num_t *  query_point,
const size_t  num_closest,
IndexType *  out_indices,
num_t *  out_distances_sq,
const int  nChecks_IGNORED = 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.

Note
nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface.

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