diff --git a/Octree/include/CGAL/Octree.h b/Octree/include/CGAL/Octree.h index 9fc9b2171a1..cb84b76fe94 100644 --- a/Octree/include/CGAL/Octree.h +++ b/Octree/include/CGAL/Octree.h @@ -23,7 +23,7 @@ #define CGAL_OCTREE_3_H #include -#include +#include #include #include @@ -128,7 +128,7 @@ namespace CGAL { m_root.unsplit(); } - void refine(std::function stop_criterion) { + void refine(std::function split_criterion) { // create a side length map for (int i = 0; i <= (int) 10; i++) @@ -147,7 +147,7 @@ namespace CGAL { int depth = current->depth(); // Check if this node needs to be processed - if (!stop_criterion(*current)) { + if (split_criterion(*current)) { // Split this node current->split(); @@ -164,7 +164,7 @@ namespace CGAL { } void refine(size_t max_depth, size_t bucket_size) { - refine(Stop_at_max_depth_or_bucket_size(max_depth, bucket_size)); + refine(Split_to_max_depth_or_bucket_size(max_depth, bucket_size)); } Node &root() { return m_root; } diff --git a/Octree/include/CGAL/Octree/Stop_criterion.h b/Octree/include/CGAL/Octree/Split_criterion.h similarity index 58% rename from Octree/include/CGAL/Octree/Stop_criterion.h rename to Octree/include/CGAL/Octree/Split_criterion.h index 3d6f709f8f7..ebd07ce14b5 100644 --- a/Octree/include/CGAL/Octree/Stop_criterion.h +++ b/Octree/include/CGAL/Octree/Split_criterion.h @@ -1,50 +1,39 @@ -#ifndef OCTREE_STOP_CRITERION_H -#define OCTREE_STOP_CRITERION_H +#ifndef OCTREE_SPLIT_CRITERION_H +#define OCTREE_SPLIT_CRITERION_H + +#include namespace CGAL { - struct Stop_at_max_depth_or_bucket_size { + struct Split_to_max_depth_or_bucket_size { std::size_t m_max_depth, m_bucket_size; - Stop_at_max_depth_or_bucket_size(std::size_t max_depth, std::size_t bucket_size) : + Split_to_max_depth_or_bucket_size(std::size_t max_depth, std::size_t bucket_size) : m_max_depth(max_depth), m_bucket_size(bucket_size) {} template bool operator()(const Node &n) const { - return (n.num_points() <= m_bucket_size || n.depth() == m_max_depth); + return (n.num_points() > m_bucket_size && n.depth() < m_max_depth); } }; - struct Stop_at_max_depth { + struct Split_to_max_depth { std::size_t m_max_depth; - Stop_at_max_depth(std::size_t max_depth) : m_max_depth(max_depth) {} + Split_to_max_depth(std::size_t max_depth) : m_max_depth(max_depth) {} template bool operator()(const Node &n) const { - return n.depth() == m_max_depth; + return n.depth() < m_max_depth; } }; - } /* -struct Stop_at_max_number_of_points { - std::size_t max_nb_points; - - Stop_at_max_number_of_points(const std::size_t &max_nb_points) - : max_nb_points(max_nb_points) {} - - bool operator()(const Node &n) const { - return n.number_of_points() // internally, the node can use std::distance(begin, end) - < max_nb_points; - } -}; - // Just for an example using outside info (like a normal map) // The normals remain unknown to the octree but are used for construction struct Stop_at_normal_deviation { @@ -71,4 +60,4 @@ struct Stop_at_normal_deviation { */ -#endif //OCTREE_STOP_CRITERION_H +#endif //OCTREE_SPLIT_CRITERION_H