Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Private Member Functions | Private Attributes
icl::math::KDTree Class Reference

Simple KD-Tree implementation. More...

#include <KDTree.h>

Inheritance diagram for icl::math::KDTree:
icl::utils::Uncopyable

List of all members.

Classes

struct  Node
 Keeps data of node. More...

Public Member Functions

 KDTree (std::vector< math::DynMatrix< icl64f > > &list)
 Constructor.
 KDTree (std::vector< math::DynMatrix< icl64f > * > &list)
 Constructor.
 KDTree ()
 Constructor.
 ~KDTree ()
 Destructor.
void buildTree (std::vector< math::DynMatrix< icl64f > * > &list)
 builds a kd-tree
void buildTree (std::vector< math::DynMatrix< icl64f > > &list)
 builds a kd-tree
void print ()
 Prints the tree on standard output.
math::DynMatrix< icl64f > * nearestNeighbour (const math::DynMatrix< icl64f > &point)
 Returns pointer to nearest neighbour to passed point.
math::DynMatrix< icl64f > * nearestNeighbour (const math::DynMatrix< icl64f > *point)
 Returns pointer to nearest neighbour to passed point.

Private Member Functions

void print (Node *node)
 internal print call
void buildTree (std::vector< math::DynMatrix< icl64f > > &list, unsigned int depth, Node *node)
 internal call to fill the KDTree with data
void buildTree (std::vector< math::DynMatrix< icl64f > * > &list, unsigned int depth, Node *node)
 internal call to fill the KDTree with data
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)
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)
void releaseTree ()
 internal call to release data from KDTree

Private Attributes

Node root
 the root node of the tree

Detailed Description

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


Constructor & Destructor Documentation

icl::math::KDTree::KDTree ( std::vector< math::DynMatrix< icl64f > > &  list)

Constructor.

Creates a new KDTree object, with data from list.

Parameters:
listlist 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.

Parameters:
listlist of points for the kd-tree

Constructor.

Creates a new KDTree object. Default constructor

Destructor.


Member Function Documentation

void icl::math::KDTree::buildTree ( std::vector< math::DynMatrix< icl64f > > &  list,
unsigned int  depth,
Node node 
) [private]

internal call to fill the KDTree with data

void icl::math::KDTree::buildTree ( std::vector< math::DynMatrix< icl64f > * > &  list,
unsigned int  depth,
Node node 
) [private]

internal call to fill the KDTree with data

void icl::math::KDTree::buildTree ( std::vector< math::DynMatrix< icl64f > * > &  list) [inline]

builds a kd-tree

Fills empty kd-tree or the current one with new data.

Parameters:
listlist of points for the kd-tree
void icl::math::KDTree::buildTree ( std::vector< math::DynMatrix< icl64f > > &  list) [inline]

builds a kd-tree

Fills empty KDTree object or the current one with new data.

Parameters:
listlist of points for the kd-tree

Returns pointer to nearest neighbour to passed point.

Parameters:
pointthe point to search nearest neighbor for
Returns:
the pointer to nearest neighbour

Returns pointer to nearest neighbour to passed point.

Parameters:
pointthe point to search nearest neighbor for
Returns:
the pointer to nearest neighbour
void icl::math::KDTree::print ( Node node) [private]

internal print call

Prints the tree on standard output.

void icl::math::KDTree::releaseTree ( ) [private]

internal call to release data from KDTree

void icl::math::KDTree::sortList ( std::vector< math::DynMatrix< icl64f > > &  list,
unsigned int  dim 
) [private]

internal call to sort list by dimension of the vector (unused, instead std::sort)

void icl::math::KDTree::sortList ( std::vector< math::DynMatrix< icl64f > * > &  list,
unsigned int  dim 
) [private]

internal call to sort list by dimension of the vector (unused, instead std::sort)


Member Data Documentation

the root node of the tree


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines