From cf4a809457a3b00a2bf5a1741fec4be4533e05f8 Mon Sep 17 00:00:00 2001 From: dangerski Date: Tue, 12 Mar 2019 10:49:43 -0600 Subject: [PATCH] Prevent infinite loop in Advancing front surface reconstruction. In some cases K can become really large but doesn't get to infinity and instead gets into a situation where K + epsilon == K and the the while loop never exits. So we check for the case where K stops changing and exits. --- .../include/CGAL/Advancing_front_surface_reconstruction.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h index 317c04ee863..14c1523fe17 100644 --- a/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h +++ b/Advancing_front_surface_reconstruction/include/CGAL/Advancing_front_surface_reconstruction.h @@ -2005,6 +2005,7 @@ namespace CGAL { { // initilisation de la variable globale K: qualite d'echantillonnage requise K = K_init; // valeur d'initialisation de K pour commencer prudemment... + coord_type K_prev = K; Vertex_handle v1, v2; if (_ordered_border.empty()){ @@ -2069,12 +2070,12 @@ namespace CGAL { } while((!_ordered_border.empty())&& (_ordered_border.begin()->first < STANDBY_CANDIDATE_BIS)); - + K_prev = K; K += (std::max)(K_step, min_K - K + eps); // on augmente progressivement le K mais on a deja rempli sans // faire des betises auparavant... } - while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity())); + while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity())&&(K!=K_prev)); #ifdef VERBOSE if ((min_K < infinity())&&(!_ordered_border.empty())) {