diff --git a/Orthtree/include/CGAL/Orthtree.h b/Orthtree/include/CGAL/Orthtree.h index b2931f84429..bb1dd8a2354 100644 --- a/Orthtree/include/CGAL/Orthtree.h +++ b/Orthtree/include/CGAL/Orthtree.h @@ -320,8 +320,21 @@ public: void refine(const Split_predicate& split_predicate) { // If the tree has already been refined, reset it - if (!m_root.is_leaf()) + if (!m_root.is_leaf()){ + std::queue nodes; + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (m_root[i]); + while (!nodes.empty()) + { + Node node = nodes.front(); + nodes.pop(); + if (!node.is_leaf()) + for (std::size_t i = 0; i < Degree::value; ++ i) + nodes.push (node[i]); + node.free(); + } m_root.unsplit(); + } // Reset the side length map, too m_side_per_depth.resize(1); diff --git a/Orthtree/include/CGAL/Orthtree/Node.h b/Orthtree/include/CGAL/Orthtree/Node.h index cfa49fb5366..a16d2fff192 100644 --- a/Orthtree/include/CGAL/Orthtree/Node.h +++ b/Orthtree/include/CGAL/Orthtree/Node.h @@ -365,7 +365,7 @@ public: } /*! - \brief returns the nth child fo this node. + \brief returns the nth child of this node. \pre `!is_null()` \pre `!is_leaf()`