diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing.h index 22f993dee79..a9dd3d89e29 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing.h @@ -223,14 +223,13 @@ namespace Shape_detection { // Try to grow a new region from the index of the seed item. if (!get(m_visited, seed)) { - typename Region_type::Primitive primitive = m_region_type.primitive(); - const bool is_success = propagate(seed, region, primitive); + const bool is_success = propagate(seed, region); // Check global conditions. if (!is_success || !m_region_type.is_valid_region(region)) { revert(region); } else { - *(region_out++) = std::pair(primitive, region); + *(region_out++) = std::pair(m_region_type.primitive(), region); fill_region_map(m_nb_regions++, region); } } @@ -336,7 +335,7 @@ namespace Shape_detection { } } - bool propagate(const Item &seed, Region& region, typename RegionType::Primitive &primitive) { + bool propagate(const Item &seed, Region& region) { region.clear(); // Use two queues, while running on this queue, push to the other queue; @@ -352,7 +351,6 @@ namespace Shape_detection { // Update internal properties of the region. const bool is_well_created = m_region_type.update(region); - primitive = m_region_type.primitive(); if (!is_well_created) return false; bool grown = true; @@ -423,9 +421,6 @@ namespace Shape_detection { return true; } - // If it fits, update the primitive. - primitive = m_region_type.primitive(); - // Try to continue growing the region by considering formerly rejected elements. for (const std::pair& p : rejected) { if (m_region_type.is_part_of_region(p.first, p.second, region)) {