|
eLynx SDK
v3.3.0 C++ image processing API reference |
2D binary tree. More...
#include <KDTree.h>
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. | |
2D binary tree.
See KD Binary Tree.
| eLynx::Math::KDTree< T >::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.
(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.)
| 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 |
| 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.
| iPoint | target point. |
| oNeighbor | nearest point to the target point. |
| oDistance | distance to nearest point from the target point. |
| 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.
| iPoint | target point. |
| iNumber | max number of returned points. |
| oPoints | closest iNumber points. |