27 #ifndef MPBLOCKS_KD_TREE_TREE_H_
28 #define MPBLOCKS_KD_TREE_TREE_H_
42 template <
class Traits>
57 typedef Eigen::Matrix<Format_t,Traits::NDim,1>
Vector_t;
HyperRect_t m_rect
hyper rectangle for searches
void findRange(RangeIface_t &search)
generic range search, specific search depends on the implementing class of the RangeIface ...
Tree()
constructs a new kd-tree
int m_size
number of points
Enumerates an entire subtree, building a list of nodes along with the hyperectangle bounding the subt...
~Tree()
destructs the tree and recursively frees all node data. note that nodes do not own their data if thei...
Node_t * m_root
root node of the tree (0 if empty)
Traits::Format_t Format_t
number format, i.e. double, float
Eigen::Matrix< Format_t, Traits::NDim, 1 > Vector_t
a vector is the difference of two points
List_t & getList()
return the list
NearestSearchIface< Traits > NNIface_t
ListBuilder_t::List_t & buildList(bool bfs=true)
create a list of all the nodes in the tree, mostly only used for debug drawing
Node< Traits > NodeBase_t
Traits::Node Node_t
the node class, should be defined as an inner class of Traits
ListBuilder_t::List_t & getList()
return the list after buildList has been called, the reference is the same one returned by buildList ...
void findNearest(const Point_t &q, NNIface_t &search)
generic NN search, specific search depends on the implementing class of the NNIface ...
Interface for nearest node type searches.
void insert(Node_t *)
insert a node into the kd tree. The node should be newly created and contain no children ...
Traits::HyperRect HyperRect_t
the hyper rectangle class shoudl be defined as an inner class of Traits, or a typedef in Traits ...
RangeSearchIface< Traits > RangeIface_t
HyperRect_t m_bounds
bounding rectangle
ListBuilder_t m_lister
helper for building a list of all nodes
void set_initRect(const HyperRect_t &h)
ListBuilder< Traits > ListBuilder_t
Vector_t Point_t
the storage type for points
the node class must be defined in traits since it uses the CTRP, it must derive from kd_tree::Node<Tr...
Node_t * getRoot()
return the root node
std::list< Pair_t * > List_t
Base class for nodes in the kd tree.
HyperRect_t m_initRect
initial rectangle, probably 0,0,0...
double Format_t
number format (i.e. double, float)
void clear()
clearout the data structure, note: does not destroy any object references
int size()
return the number of points in the tree
an NDim dimensional hyperrectangle, represented as a min and max extent