From e87747d082474cf7e7b03a2694f58ee9ae71d0e6 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 14 Apr 2021 09:20:17 +0200 Subject: [PATCH] Fix candidate counting --- .../Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h index 3536f638ad3..4a796a0ac5d 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h @@ -588,6 +588,7 @@ public: generated_candidates++; //add candidate for each type of primitives + bool candidate_success = false; for(typename std::vector::iterator it = m_shape_factories.begin(); it != m_shape_factories.end(); it++) { if (callback && !callback(num_invalid / double(m_num_total_points))) @@ -611,17 +612,19 @@ public: best_expected = p->expected_value(); candidates.push_back(p); + candidate_success = true; } else { - failed_candidates++; delete p; } } else { - failed_candidates++; delete p; } } + if (!candidate_success) + ++ failed_candidates; + } if (failed_candidates >= limit_failed_candidates)