32 #ifndef BGEOT_KDTREE_H
33 #define BGEOT_KDTREE_H
47 struct kdtree_elt_base {
48 enum { PTS_PER_LEAF=8 };
50 bool isleaf()
const {
return (n != 0); }
51 kdtree_elt_base(
unsigned n_) : n(n_) {}
52 virtual ~kdtree_elt_base() {}
64 void swap(
index_node_pair& other) { std::swap(i,other.i); n.swap(other.n);}
104 std::unique_ptr<kdtree_elt_base> tree;
114 void reserve(
size_type n) { pts.reserve(n); }
124 GMM_ASSERT2(N == n.size(),
"invalid dimension");
125 if (tree) clear_tree();
128 size_type nb_points()
const {
return pts.size(); }
133 const base_node &min,
134 const base_node &max);
137 scalar_type nearest_neighbor(index_node_pair &ipt,
138 const base_node &pos);
140 typedef std::vector<size_type>::const_iterator ITER;