Image Component Library (ICL)
|
Simple KD-Tree implementation. More...
#include <KDTree.h>
Classes | |
struct | Node |
Keeps data of node. More... | |
Public Member Functions | |
KDTree (std::vector< math::DynMatrix< icl64f > > &list) | |
Constructor. More... | |
KDTree (std::vector< math::DynMatrix< icl64f > * > &list) | |
Constructor. More... | |
KDTree () | |
Constructor. More... | |
~KDTree () | |
Destructor. More... | |
void | buildTree (std::vector< math::DynMatrix< icl64f > * > &list) |
builds a kd-tree More... | |
void | buildTree (std::vector< math::DynMatrix< icl64f > > &list) |
builds a kd-tree More... | |
void | print () |
Prints the tree on standard output. More... | |
math::DynMatrix< icl64f > * | nearestNeighbour (const math::DynMatrix< icl64f > &point) |
Returns pointer to nearest neighbour to passed point. More... | |
math::DynMatrix< icl64f > * | nearestNeighbour (const math::DynMatrix< icl64f > *point) |
Returns pointer to nearest neighbour to passed point. More... | |
Private Member Functions | |
void | print (Node *node) |
internal print call More... | |
void | buildTree (std::vector< math::DynMatrix< icl64f > > &list, unsigned int depth, Node *node) |
internal call to fill the KDTree with data More... | |
void | buildTree (std::vector< math::DynMatrix< icl64f > * > &list, unsigned int depth, Node *node) |
internal call to fill the KDTree with data More... | |
void | sortList (std::vector< math::DynMatrix< icl64f > > &list, unsigned int dim) |
internal call to sort list by dimension of the vector (unused, instead std::sort) More... | |
void | sortList (std::vector< math::DynMatrix< icl64f > * > &list, unsigned int dim) |
internal call to sort list by dimension of the vector (unused, instead std::sort) More... | |
void | releaseTree () |
internal call to release data from KDTree More... | |
Private Attributes | |
Node | root |
the root node of the tree More... | |
Additional Inherited Members | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
Simple KD-Tree implementation.
This class implements a simple kd-tree. You can create an object of this class with or without given point data. After creating a kd-tree without data you can use the buildTree method to insert data points or to rebuild the kd-tree with new data points. Note: If point data was passed to the KD-Tree constructor, it only references by the KD-Tree instance. Therefore, that tree instance will only stay valid as long as the referenced data does
icl::math::KDTree::KDTree | ( | std::vector< math::DynMatrix< icl64f > > & | list | ) |
Constructor.
Creates a new KDTree object, with data from list.
list | list of points for the kd-tree |
icl::math::KDTree::KDTree | ( | std::vector< math::DynMatrix< icl64f > * > & | list | ) |
Constructor.
Creates a new KDTree object, with data from list.
list | list of points for the kd-tree |
|
inline |
Constructor.
Creates a new KDTree object. Default constructor
icl::math::KDTree::~KDTree | ( | ) |
Destructor.
|
private |
internal call to fill the KDTree with data
|
private |
internal call to fill the KDTree with data
|
inline |
builds a kd-tree
Fills empty kd-tree or the current one with new data.
list | list of points for the kd-tree |
|
inline |
builds a kd-tree
Fills empty KDTree object or the current one with new data.
list | list of points for the kd-tree |
math::DynMatrix<icl64f>* icl::math::KDTree::nearestNeighbour | ( | const math::DynMatrix< icl64f > & | point | ) |
Returns pointer to nearest neighbour to passed point.
point | the point to search nearest neighbor for |
math::DynMatrix<icl64f>* icl::math::KDTree::nearestNeighbour | ( | const math::DynMatrix< icl64f > * | point | ) |
Returns pointer to nearest neighbour to passed point.
point | the point to search nearest neighbor for |
|
private |
internal print call
void icl::math::KDTree::print | ( | ) |
Prints the tree on standard output.
|
private |
internal call to release data from KDTree
|
private |
internal call to sort list by dimension of the vector (unused, instead std::sort)
|
private |
internal call to sort list by dimension of the vector (unused, instead std::sort)
|
private |
the root node of the tree