27 #ifndef MPBLOCKS_KD_TREE_EUCLIDEAN_KNEAREST_HPP_
28 #define MPBLOCKS_KD_TREE_EUCLIDEAN_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 (d2 < m_queue.rbegin()->d2 || m_queue.size() < m_k);
110 #endif // NEARESTNEIGHBOR_H_
void insert(Node_t *)
recursively inserts point as a new node in the tree
Traits::Format_t Format_t
std::set< Key_t, KeyCompare_t, Allocator_t > PQueue_t
KNearest(unsigned int k=1)
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...
const PQueue_t & result()
the node class must be defined in traits since it uses the CTRP, it must derive from kd_tree::Node<Tr...
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...
Eigen::Matrix< Format_t, Traits::NDim, 1 > Point_t
an NDim dimensional hyperrectangle, represented as a min and max extent