27 #ifndef MPBLOCKS_KD2_FINDNEAREST_H_
28 #define MPBLOCKS_KD2_FINDNEAREST_H_
52 class PointDistanceFn,
66 const QueueMinKeyFn& minKey,
67 const QueuePopMinFn& popMin,
68 const QueueInsertFn& enqueue,
69 const QueueSizeFn& queueSize,
70 const SetMaxKeyFn& maxKey,
71 const SetPopMaxFn& popMax,
73 const SetSizeFn& size,
74 const PointDistanceFn& pointDist,
75 const CellDistanceFn& cellDist,
76 const IsLeafFn& isLeaf,
77 const ChildrenFn& children,
79 const CellFn& getCell,
80 const NodeFn& getNode)
84 while( queueSize(q) > 0 && (size(r) < k || minKey(q) < maxKey(r)) )
88 auto pair = popMin(q);
89 auto node = getNode(pair);
95 for(
auto site : sites(node) )
97 insert( r, pointDist(query,site), site );
104 for(
auto childPair : children(pair) )
105 enqueue(q,cellDist(query,getCell(childPair)),childPair);
129 #endif // FINDNEAREST_H_
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(NodeRef node, PointRef point, const IsLeafFn &isLeaf, const LeafInsertFn &leafInsert, const IdxFn &idx, const ValueFn &value, const ChildFn &child, const PointGetFn &pointGet)