simplify impl + const correctness + minor cleanup

This commit is contained in:
artemp 2017-08-15 11:13:11 +01:00
parent a682cea51e
commit c4a1df6e91

View file

@ -117,7 +117,7 @@ public:
root_ = nodes_[0].get(); root_ = nodes_[0].get();
} }
void insert(value_type data, bbox_type const& box) void insert(value_type const& data, bbox_type const& box)
{ {
unsigned int depth = 0; unsigned int depth = 0;
do_insert_data(data, box, root_, depth); do_insert_data(data, box, root_, depth);
@ -207,13 +207,9 @@ private:
} }
} }
void do_insert_data(value_type data, bbox_type const& box, node * n, unsigned int& depth) void do_insert_data(value_type const& data, bbox_type const& box, node * n, unsigned int& depth)
{ {
if (++depth >= max_depth_) if (++depth < max_depth_)
{
n->cont_.push_back(data);
}
else
{ {
bbox_type const& node_extent = n->extent(); bbox_type const& node_extent = n->extent();
bbox_type ext[4]; bbox_type ext[4];
@ -231,8 +227,8 @@ private:
return; return;
} }
} }
n->cont_.push_back(data);
} }
n->cont_.push_back(data);
} }
void split_box(bbox_type const& node_extent, bbox_type * ext) void split_box(bbox_type const& node_extent, bbox_type * ext)