From 14a9abcca6e48bb3ec54bca7260446f07c83bf31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 31 Mar 2022 12:50:05 +0200 Subject: [PATCH] Fix assertion: global lbound is init. w/ the initial bound, not the error bound --- .../include/CGAL/Polygon_mesh_processing/distance.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h index f9bd7e82425..a9ad7c689ed 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/distance.h @@ -1733,14 +1733,15 @@ bounded_error_squared_Hausdorff_distance_impl(const TriangleMesh1& tm1, std::cout << "Top of the queue is lower than the lowest!" << std::endl; #endif + // This can happen if the actual Hausdorff distance is smaller than sq_initial_bound, + // which can happen either if the error bound is really large, or if the initial bound + // is non-zero (symmetric Hausdorff distance). In this case, we return 'sq_initial_bound' + CGAL_assertion(global_bounds.lower == sq_initial_bound); + global_bounds.upper = global_bounds.lower; // not really needed since lower is returned but doesn't hurt global_bounds.upair.first = global_bounds.lpair.first; global_bounds.upair.second = global_bounds.lpair.second; - // Current upmost being equal to the lower is fine, but if it's strictly below, it must - // be because we crossed the error bound, or there is some issue... - CGAL_assertion(global_bounds.lower == sq_error_bound); - break; }