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;
 
Balanced tree over a set of points.
void add_point_with_id(const base_node &n, size_type i)
insert a new point, with an associated number.
size_type add_point(const base_node &n)
insert a new point
void clear()
reset the tree, remove all points
std::vector< index_node_pair > kdtree_tab_type
store a set of points with associated indexes.
size_t size_type
used as the common size type in the library
store a point and the associated index for the kdtree.