eLynx SDK v3.0.1
C++ image processing API reference

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

#include <KDTree.h>

List of all members.


Public Member Functions

 KDTree (const Point2< T > *iPoints, uint32 iSize, T iWidth, T iHeight)
void GetNeighbors (const Point2< T > &iPoint, uint32 iNumber, std::vector< Point2< T > > &oPoints) const
bool GetNeighbor (const Point2< T > &iPoint, Point2< T > &oNeighbor, T &oDistance) const
 ~KDTree ()

Protected Member Functions

 KDTree ()

Detailed Description

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

2D binary tree. See KD Binary Tree.

Definition at line 38 of file KDTree.h.


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:
iPoints array of 2D points to insert into the tree.
iSize number of points.
iWidth width of the image which contains all points
iHeight height of the image which contains all points

template<typename T >
eLynx::Math::KDTree< T >::KDTree (  )  [inline, protected]

Definition at line 75 of file KDTree.h.

template<typename T >
eLynx::Math::KDTree< T >::~KDTree (  )  [inline]

Definition at line 76 of file KDTree.h.


Member Function Documentation

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:
iPoint target point.
iNumber max number of returned points.
oPoints closest iNumber points.

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:
iPoint target point.
oNeighbor nearest point to the target point.
oDistance distance to nearest point from the target point.
Returns:
true if KDTree is not empty


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

Generated on 14 Apr 2009 by doxygen 1.5.8