27 #ifndef MPBLOCKS_KD_TREE_R2_S1_KNEAREST_HPP_
28 #define MPBLOCKS_KD_TREE_R2_S1_KNEAREST_HPP_
36 template <
class Traits,
template<
class>
class Allocator>
43 template <
class Traits,
template<
class>
class Allocator>
50 template <
class Traits,
template<
class>
class Allocator>
59 template <
class Traits,
template<
class>
class Allocator>
69 template <
class Traits,
template<
class>
class Allocator>
74 key.
d2 = m_dist2Fn(q,p);
79 if( m_queue.size() > m_k )
80 m_queue.erase( --m_queue.end() );
86 template <
class Traits,
template<
class>
class Allocator>
91 return ( m_queue.size() < m_k || d2 < m_queue.rbegin()->d2 );
110 #endif // NEARESTNEIGHBOR_H_
void insert(Node_t *)
recursively inserts point as a new node in the tree
const PQueue_t & result()
virtual bool shouldRecurse(const Point_t &q, const HyperRect_t &r)
evaluate the Euclidean distance from q to it's closest point in r and if that distance is less than t...
virtual void evaluate(const Point_t &q, const Point_t &p, Node_t *n)
calculates Euclidean distance from q to p, and if its less than the current best replaces the current...
Traits::Format_t Format_t
KNearest(unsigned int k=1)
std::set< Key_t, KeyCompare_t, Allocator_t > PQueue_t
the node class must be defined in traits since it uses the CTRP, it must derive from kd_tree::Node<Tr...
an NDim dimensional hyperrectangle, represented as a min and max extent