Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes
mrpt::math::KDTreeCapable< Derived, num_t, metric_t > Class Template Reference

Detailed Description

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
class mrpt::math::KDTreeCapable< Derived, num_t, metric_t >

A generic adaptor class for providing Nearest Neighbor (NN) lookup via the nanoflann library.

This makes use of the CRTP design pattern.

Derived classes must be aware of the need to call "kdtree_mark_as_outdated()" when the data points change to mark the cached KD-tree (an "index") as invalid, and also implement the following interface (note that these are not virtual functions due to the usage of CRTP):

// Must return the number of data points
inline size_t kdtree_get_point_count() const { ... }
// Returns the distance between the vector "p1[0:size-1]" and the data
point with index "idx_p2" stored in the class:
inline float kdtree_distance(const float *p1, const size_t idx_p2,size_t
size) const { ... }
// Returns the dim'th component of the idx'th point in the class:
inline num_t kdtree_get_pt(const size_t idx, int dim) const { ... }
// Optional bounding-box computation: return false to default to a standard
bbox computation loop.
// Return true if the BBOX was already computed by the class and returned
in "bb" so it can be avoided to redo it again.
// Look at bb.size() to find out the expected dimensionality (e.g. 2 or 3
for point clouds)
template <class BBOX>
bool kdtree_get_bbox(BBOX &bb) const
{
bb[0].low = ...; bb[0].high = ...; // "x" limits
return true;
}

The KD-tree index will be built on demand only upon call of any of the query methods provided by this class.

Notice that there is only ONE internal cached KD-tree, so if a method to query a 2D point is called, then another method for 3D points, then again the 2D method, three KD-trees will be built. So, try to group all the calls for a given dimensionality together or build different class instances for queries of each dimensionality, etc.

See Also
See some of the derived classes for example implementations. See also the documentation of nanoflann

Definition at line 81 of file KDTreeCapable.h.

#include <mrpt/math/KDTreeCapable.h>

Inheritance diagram for mrpt::math::KDTreeCapable< Derived, num_t, metric_t >:
Inheritance graph

Classes

struct  TKDTreeDataHolder
 Internal structure with the KD-tree representation (mainly used to avoid copying pointers with the = operator) More...
 
struct  TKDTreeSearchParams
 

Public Types

typedef KDTreeCapable< Derived,
num_t, metric_t > 
self_t
 

Public Member Functions

 KDTreeCapable ()
 Constructor. More...
 
const Derived & derived () const
 CRTP helper method. More...
 
Derived & derived ()
 CRTP helper method. More...
 
Public utility methods to query the KD-tree
size_t kdTreeClosestPoint2D (float x0, float y0, float &out_x, float &out_y, float &out_dist_sqr) const
 KD Tree-based search for the closest point (only ONE) to some given 2D coordinates. More...
 
size_t kdTreeClosestPoint2D (float x0, float y0, float &out_dist_sqr) const
 
size_t kdTreeClosestPoint2D (const TPoint2D &p0, TPoint2D &pOut, float &outDistSqr) const
 
float kdTreeClosestPoint2DsqrError (float x0, float y0) const
 Like kdTreeClosestPoint2D, but just return the square error from some point to its closest neighbor. More...
 
float kdTreeClosestPoint2DsqrError (const TPoint2D &p0) const
 
void kdTreeTwoClosestPoint2D (float x0, float y0, float &out_x1, float &out_y1, float &out_x2, float &out_y2, float &out_dist_sqr1, float &out_dist_sqr2) const
 KD Tree-based search for the TWO closest point to some given 2D coordinates. More...
 
void kdTreeTwoClosestPoint2D (const TPoint2D &p0, TPoint2D &pOut1, TPoint2D &pOut2, float &outDistSqr1, float &outDistSqr2) const
 
std::vector< size_t > kdTreeNClosestPoint2D (float x0, float y0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 2D coordinates. More...
 
std::vector< size_t > kdTreeNClosestPoint2D (const TPoint2D &p0, size_t N, std::vector< TPoint2D > &pOut, std::vector< float > &outDistSqr) const
 
void kdTreeNClosestPoint2DIdx (float x0, float y0, size_t knn, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 2D coordinates and returns their indexes. More...
 
void kdTreeNClosestPoint2DIdx (const TPoint2D &p0, size_t N, std::vector< size_t > &outIdx, std::vector< float > &outDistSqr) const
 
size_t kdTreeClosestPoint3D (float x0, float y0, float z0, float &out_x, float &out_y, float &out_z, float &out_dist_sqr) const
 KD Tree-based search for the closest point (only ONE) to some given 3D coordinates. More...
 
size_t kdTreeClosestPoint3D (float x0, float y0, float z0, float &out_dist_sqr) const
 
size_t kdTreeClosestPoint3D (const TPoint3D &p0, TPoint3D &pOut, float &outDistSqr) const
 
void kdTreeNClosestPoint3D (float x0, float y0, float z0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_z, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest points to some given 3D coordinates. More...
 
void kdTreeNClosestPoint3DWithIdx (float x0, float y0, float z0, size_t knn, std::vector< float > &out_x, std::vector< float > &out_y, std::vector< float > &out_z, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest points to some given 3D coordinates. More...
 
void kdTreeNClosestPoint3D (const TPoint3D &p0, size_t N, std::vector< TPoint3D > &pOut, std::vector< float > &outDistSqr) const
 
size_t kdTreeRadiusSearch3D (const num_t x0, const num_t y0, const num_t z0, const num_t maxRadiusSqr, std::vector< std::pair< size_t, num_t >> &out_indices_dist) const
 KD Tree-based search for all the points within a given radius of some 3D point. More...
 
size_t kdTreeRadiusSearch2D (const num_t x0, const num_t y0, const num_t maxRadiusSqr, std::vector< std::pair< size_t, num_t >> &out_indices_dist) const
 KD Tree-based search for all the points within a given radius of some 2D point. More...
 
void kdTreeNClosestPoint3DIdx (float x0, float y0, float z0, size_t knn, std::vector< size_t > &out_idx, std::vector< float > &out_dist_sqr) const
 KD Tree-based search for the N closest point to some given 3D coordinates and returns their indexes. More...
 
void kdTreeNClosestPoint3DIdx (const TPoint3D &p0, size_t N, std::vector< size_t > &outIdx, std::vector< float > &outDistSqr) const
 

Public Attributes

TKDTreeSearchParams kdtree_search_params
 Parameters to tune the ANN searches. More...
 

Protected Member Functions

void kdtree_mark_as_outdated () const
 To be called by child classes when KD tree data changes. More...
 

Private Member Functions

void rebuild_kdTree_2D () const
 Rebuild, if needed the KD-tree for 2D (nDims=2), 3D (nDims=3), ... More...
 
void rebuild_kdTree_3D () const
 Rebuild, if needed the KD-tree for 2D (nDims=2), 3D (nDims=3), ... More...
 

Private Attributes

TKDTreeDataHolder< 2 > m_kdtree2d_data
 
TKDTreeDataHolder< 3 > m_kdtree3d_data
 
TKDTreeDataHolder m_kdtreeNd_data
 
bool m_kdtree_is_uptodate
 whether the KD tree needs to be rebuilt or not. More...
 

Member Typedef Documentation

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
typedef KDTreeCapable<Derived, num_t, metric_t> mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::self_t

Definition at line 85 of file KDTreeCapable.h.

Constructor & Destructor Documentation

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::KDTreeCapable ( )
inline

Constructor.

Definition at line 89 of file KDTreeCapable.h.

Member Function Documentation

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
const Derived& mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived ( ) const
inline
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
Derived& mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::derived ( )
inline

CRTP helper method.

Definition at line 96 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdtree_mark_as_outdated ( ) const
inlineprotected

To be called by child classes when KD tree data changes.

Definition at line 734 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_x,
float &  out_y,
float &  out_dist_sqr 
) const
inline

KD Tree-based search for the closest point (only ONE) to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
out_xThe X coordinate of the found closest correspondence.
out_yThe Y coordinate of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
Returns
The index of the closest point in the map array.
See Also
kdTreeClosestPoint3D, kdTreeTwoClosestPoint2D

Definition at line 127 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeClosestPoint2D(), and mrpt::math::KDTreeCapable< CFeatureList >::kdTreeClosestPoint2DsqrError().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2D ( float  x0,
float  y0,
float &  out_dist_sqr 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 156 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut,
float &  outDistSqr 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 180 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
float mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2DsqrError ( float  x0,
float  y0 
) const
inline

Like kdTreeClosestPoint2D, but just return the square error from some point to its closest neighbor.

Definition at line 195 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeClosestPoint2DsqrError().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
float mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint2DsqrError ( const TPoint2D p0) const
inline

Definition at line 202 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_x,
float &  out_y,
float &  out_z,
float &  out_dist_sqr 
) const
inline

KD Tree-based search for the closest point (only ONE) to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
out_xThe X coordinate of the found closest correspondence.
out_yThe Y coordinate of the found closest correspondence.
out_zThe Z coordinate of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
Returns
The index of the closest point in the map array.
See Also
kdTreeClosestPoint2D

Definition at line 410 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeClosestPoint3D().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint3D ( float  x0,
float  y0,
float  z0,
float &  out_dist_sqr 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 441 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeClosestPoint3D ( const TPoint3D p0,
TPoint3D pOut,
float &  outDistSqr 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 466 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
std::vector<size_t> mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint2D ( float  x0,
float  y0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_dist_sqr 
) const
inline

KD Tree-based search for the N closest point to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
Returns
The list of indices
See Also
kdTreeClosestPoint2D
kdTreeTwoClosestPoint2D

Definition at line 295 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeNClosestPoint2D().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
std::vector<size_t> mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint2D ( const TPoint2D p0,
size_t  N,
std::vector< TPoint2D > &  pOut,
std::vector< float > &  outDistSqr 
) const
inline

Definition at line 327 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint2DIdx ( float  x0,
float  y0,
size_t  knn,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inline

KD Tree-based search for the N closest point to some given 2D coordinates and returns their indexes.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
NThe number of closest points to search.
out_idxThe indexes of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
See Also
kdTreeClosestPoint2D

Definition at line 360 of file KDTreeCapable.h.

Referenced by mrpt::slam::CGridMapAligner::AlignPDF_robustMatch(), mrpt::math::KDTreeCapable< CFeatureList >::kdTreeNClosestPoint2DIdx(), and mrpt::vision::matchMultiResolutionFeatures().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint2DIdx ( const TPoint2D p0,
size_t  N,
std::vector< size_t > &  outIdx,
std::vector< float > &  outDistSqr 
) const
inline

Definition at line 382 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint3D ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_z,
std::vector< float > &  out_dist_sqr 
) const
inline

KD Tree-based search for the N closest points to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_zThe vector containing the Z coordinates of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
See Also
kdTreeNClosestPoint2D

Definition at line 501 of file KDTreeCapable.h.

Referenced by mrpt::maps::CPointCloudFilterByDistance::filter(), and mrpt::math::KDTreeCapable< CFeatureList >::kdTreeNClosestPoint3D().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint3D ( const TPoint3D p0,
size_t  N,
std::vector< TPoint3D > &  pOut,
std::vector< float > &  outDistSqr 
) const
inline

Definition at line 594 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint3DIdx ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inline

KD Tree-based search for the N closest point to some given 3D coordinates and returns their indexes.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_idxThe indexes of the found closest correspondence.
out_dist_sqrThe square distance between the query and the returned point.
See Also
kdTreeClosestPoint2D, kdTreeRadiusSearch3D

Definition at line 698 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeNClosestPoint3DIdx().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint3DIdx ( const TPoint3D p0,
size_t  N,
std::vector< size_t > &  outIdx,
std::vector< float > &  outDistSqr 
) const
inline

Definition at line 721 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeNClosestPoint3DWithIdx ( float  x0,
float  y0,
float  z0,
size_t  knn,
std::vector< float > &  out_x,
std::vector< float > &  out_y,
std::vector< float > &  out_z,
std::vector< size_t > &  out_idx,
std::vector< float > &  out_dist_sqr 
) const
inline

KD Tree-based search for the N closest points to some given 3D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
NThe number of closest points to search.
out_xThe vector containing the X coordinates of the correspondences.
out_yThe vector containing the Y coordinates of the correspondences.
out_zThe vector containing the Z coordinates of the correspondences.
out_idxThe vector containing the indexes of the correspondences.
out_dist_sqrThe vector containing the square distance between the query and the returned points.
See Also
kdTreeNClosestPoint2D

Definition at line 559 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeRadiusSearch2D ( const num_t  x0,
const num_t  y0,
const num_t  maxRadiusSqr,
std::vector< std::pair< size_t, num_t >> &  out_indices_dist 
) const
inline

KD Tree-based search for all the points within a given radius of some 2D point.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
maxRadiusSqrThe square of the desired search radius.
out_indices_distThe output list, with pairs of indeces/squared distances for the found correspondences.
Returns
Number of found points.
See Also
kdTreeRadiusSearch3D, kdTreeNClosestPoint2DIdx

Definition at line 663 of file KDTreeCapable.h.

Referenced by ransac_data_assoc_run().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
size_t mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeRadiusSearch3D ( const num_t  x0,
const num_t  y0,
const num_t  z0,
const num_t  maxRadiusSqr,
std::vector< std::pair< size_t, num_t >> &  out_indices_dist 
) const
inline

KD Tree-based search for all the points within a given radius of some 3D point.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 2D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
z0The Z coordinate of the query.
maxRadiusSqrThe square of the desired search radius.
out_indices_distThe output list, with pairs of indeces/squared distances for the found correspondences.
Returns
Number of found points.
See Also
kdTreeRadiusSearch2D, kdTreeNClosestPoint3DIdx

Definition at line 628 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeTwoClosestPoint2D ( float  x0,
float  y0,
float &  out_x1,
float &  out_y1,
float &  out_x2,
float &  out_y2,
float &  out_dist_sqr1,
float &  out_dist_sqr2 
) const
inline

KD Tree-based search for the TWO closest point to some given 2D coordinates.

This method automatically build the "m_kdtree_data" structure when:

  • It is called for the first time
  • The map has changed
  • The KD-tree was build for 3D.
Parameters
x0The X coordinate of the query.
y0The Y coordinate of the query.
out_x1The X coordinate of the first correspondence.
out_y1The Y coordinate of the first correspondence.
out_x2The X coordinate of the second correspondence.
out_y2The Y coordinate of the second correspondence.
out_dist_sqr1The square distance between the query and the first returned point.
out_dist_sqr2The square distance between the query and the second returned point.
See Also
kdTreeClosestPoint2D

Definition at line 228 of file KDTreeCapable.h.

Referenced by mrpt::math::KDTreeCapable< CFeatureList >::kdTreeTwoClosestPoint2D().

Here is the caller graph for this function:

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdTreeTwoClosestPoint2D ( const TPoint2D p0,
TPoint2D pOut1,
TPoint2D pOut2,
float &  outDistSqr1,
float &  outDistSqr2 
) const
inline

Definition at line 261 of file KDTreeCapable.h.

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_2D ( ) const
inlineprivate
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
void mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::rebuild_kdTree_3D ( ) const
inlineprivate

Member Data Documentation

template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
TKDTreeSearchParams mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::kdtree_search_params
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
TKDTreeDataHolder<2> mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree2d_data
mutableprivate
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
TKDTreeDataHolder<3> mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree3d_data
mutableprivate
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
bool mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtree_is_uptodate
mutableprivate
template<class Derived, typename num_t = float, typename metric_t = nanoflann::L2_Simple_Adaptor<num_t, Derived>>
TKDTreeDataHolder mrpt::math::KDTreeCapable< Derived, num_t, metric_t >::m_kdtreeNd_data
mutableprivate



Page generated by Doxygen 1.8.6 for MRPT 1.9.9 Git: 6d99412 Sat Nov 18 10:43:44 2017 +0100 at sáb nov 18 10:50:13 CET 2017