diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index 350b9f533d8..2d47eab2d12 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -196,7 +196,7 @@ class Kd_tree { if (try_parallel_internal_node_creation (nh, c, c_low, tag)) return; - if (c_low.size() > split.bucket_size()) + if (c_low.size() > split.bucket_size() && c_low.max_tight_spread() > 0) { nh->lower_ch = new_internal_node(); create_internal_node (nh->lower_ch, c_low, tag); @@ -204,7 +204,7 @@ class Kd_tree { else nh->lower_ch = create_leaf_node(c_low); - if (c.size() > split.bucket_size()) + if (c.size() > split.bucket_size() && c.max_tight_spread() > 0) { nh->upper_ch = new_internal_node(); create_internal_node (nh->upper_ch, c, tag); @@ -341,7 +341,7 @@ class Kd_tree { Point_container c(dim_, data.begin(), data.end(),traits_); bbox = new Kd_tree_rectangle(c.bounding_box()); - if (c.size() <= split.bucket_size()){ + if (c.size() <= split.bucket_size() || c.max_tight_spread() == 0){ tree_root = create_leaf_node(c); }else { tree_root = new_internal_node();