27 #ifndef MPBLOCKS_KD_TREE_TREE_HPP_
28 #define MPBLOCKS_KD_TREE_TREE_HPP_
45 template <
class Traits>
53 template <
class Traits>
58 template <
class Traits>
64 template <
class Traits>
70 for(
int i=0; i < pt.size(); i++)
72 if( pt[i] < m_bounds.minExt[i] )
73 m_bounds.minExt[i] = pt[i];
74 if( pt[i] > m_bounds.maxExt[i] )
75 m_bounds.maxExt[i] = pt[i];
90 template <
class Traits>
101 template <
class Traits>
107 static_cast<NodeBase_t*
>(m_root)->findRange(search,m_rect);
113 template <
class Traits>
119 m_lister.buildBFS(m_root);
121 m_lister.buildDFS(m_root);
123 return m_lister.getList();
128 template <
class Traits>
133 m_bounds = m_initRect;
137 template <
class Traits>
__host__ __device__ __forceinline__ void construct(SturmSequence2< Scalar, Spec > &sturm, const Exp &exp)
construct a sturm sequence
void findRange(RangeIface_t &search)
generic range search, specific search depends on the implementing class of the RangeIface ...
Tree()
constructs a new kd-tree
~Tree()
destructs the tree and recursively frees all node data. note that nodes do not own their data if thei...
ListBuilder_t::List_t & buildList(bool bfs=true)
create a list of all the nodes in the tree, mostly only used for debug drawing
void findNearest(const Point_t &q, NNIface_t &search)
generic NN search, specific search depends on the implementing class of the NNIface ...
const Point_t & getPoint()
returns a Point_t of the point stored at this node
Interface for nearest node type searches.
void findNearest(const Point &query, int k, SearchQueue &q, ResultSet &r, const QueueMinKeyFn &minKey, const QueuePopMinFn &popMin, const QueueInsertFn &enqueue, const QueueSizeFn &queueSize, const SetMaxKeyFn &maxKey, const SetPopMaxFn &popMax, const SetInsertFn &insert, const SetSizeFn &size, const PointDistanceFn &pointDist, const CellDistanceFn &cellDist, const IsLeafFn &isLeaf, const ChildrenFn &children, const SitesFn &sites, const CellFn &getCell, const NodeFn &getNode)
void insert(Node_t *)
insert a node into the kd tree. The node should be newly created and contain no children ...
void set_initRect(const HyperRect_t &h)
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...
std::list< Pair_t * > List_t
Base class for nodes in the kd tree.
void clear()
clearout the data structure, note: does not destroy any object references
void insert(NodeRef node, PointRef point, const IsLeafFn &isLeaf, const LeafInsertFn &leafInsert, const IdxFn &idx, const ValueFn &value, const ChildFn &child, const PointGetFn &pointGet)
int size()
return the number of points in the tree
an NDim dimensional hyperrectangle, represented as a min and max extent