From 6911f0c6a3cde0806aed3ddc04e52229c130955d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 7 Jan 2022 15:42:50 +0100 Subject: [PATCH] stop is no proxy can be added fix infinite loop in case no proxy could be added and error threshold is not yet reached --- .../include/CGAL/Variational_shape_approximation.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index ef642b3e074..a5c98d34272 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -1152,7 +1152,9 @@ private: target_px = max_nb_proxies; else target_px *= 2; - add_proxies_error_diffusion(target_px - m_proxies.size()); + // if no proxies could be added, stop + if( add_proxies_error_diffusion(target_px - m_proxies.size()) == 0) + break; const FT err = run(nb_relaxations); error_drop = err / initial_err; }