eLynx SDK v3.3.0
C++ image processing API reference
Public Member Functions

eLynx::Math::KDTree< T > Class Template Reference

2D binary tree. More...

#include <KDTree.h>

List of all members.

Public Member Functions

 KDTree (const Point2< T > *iPoints, uint32 iSize, T iWidth, T iHeight)
 Class constructor The canonical method of kd-tree construction has the following constraints: As one moves down the tree, one cycles through the axes used to select the splitting planes.
void GetNeighbors (const Point2< T > &iPoint, uint32 iNumber, std::vector< Point2< T > > &oPoints) const
 Finds up to specified number of NN to specified location not in the tree.
bool GetNeighbor (const Point2< T > &iPoint, Point2< T > &oNeighbor, T &oDistance) const
 Finds a NN to specified location not in the tree.

Detailed Description

template<typename T>
class eLynx::Math::KDTree< T >

2D binary tree.

See KD Binary Tree.


Constructor & Destructor Documentation

template<typename T >
eLynx::Math::KDTree< T >::KDTree ( const Point2< T > *  iPoints,
uint32  iSize,
iWidth,
iHeight 
)

Class constructor The canonical method of kd-tree construction has the following constraints: As one moves down the tree, one cycles through the axes used to select the splitting planes.

(For example, the root would have an x-aligned plane, the root's children would both have y-aligned planes, the root's grandchildren would all have z-aligned planes, and so on.) At each step, the point selected to create the splitting plane is the median of the points being put into the kd-tree, with respect to their coordinates in the axis being used. This method leads to a balanced kd-tree, in which each leaf node is about the same distance from the root. (Note the assumption that we feed the entire set of points into the algorithm up-front.)

Parameters:
iPointsarray of 2D points to insert into the tree.
iSizenumber of points.
iWidthwidth of the image which contains all points
iHeightheight of the image which contains all points

Member Function Documentation

template<typename T >
bool eLynx::Math::KDTree< T >::GetNeighbor ( const Point2< T > &  iPoint,
Point2< T > &  oNeighbor,
T &  oDistance 
) const

Finds a NN to specified location not in the tree.

Parameters:
iPointtarget point.
oNeighbornearest point to the target point.
oDistancedistance to nearest point from the target point.
Returns:
true if KDTree is not empty
template<typename T >
void eLynx::Math::KDTree< T >::GetNeighbors ( const Point2< T > &  iPoint,
uint32  iNumber,
std::vector< Point2< T > > &  oPoints 
) const

Finds up to specified number of NN to specified location not in the tree.

Parameters:
iPointtarget point.
iNumbermax number of returned points.
oPointsclosest iNumber points.

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

Generated on Thu Dec 9 2010 by doxygen 1.7.2