From f2d9066aafd4c22c8fb206579d8e488f2dbc1dbe Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 19 Aug 2021 12:05:30 +0200 Subject: [PATCH] added more debug output for failure cases --- .../Region_growing/internal/utils.h | 7 ++++++- ...region_growing_on_point_set_3_with_sorting.cpp | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/utils.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/utils.h index 59220d5f863..8a016036dea 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/utils.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/utils.h @@ -47,7 +47,12 @@ namespace internal { // TODO: This happens for circles and cylinders only! Maybe after my // precision cleaning in the new revision PR, this will be gone for all platforms. if (value < FT(0)) return FT(0); // clamp to zero - CGAL_precondition(value >= FT(0)); + const bool is_value_ok = (value >= FT(0)); + if (!is_value_ok) { // TODO: remove that! + std::cout.precision(20); + std::cout << "- wrong value: " << value << std::endl; + } + CGAL_precondition(is_value_ok); return static_cast(CGAL::sqrt(CGAL::to_double(value))); } }; diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp index 813d0fa0d13..0886c23feee 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp @@ -115,7 +115,10 @@ int main(int argc, char *argv[]) { distance_threshold, angle_threshold, min_region_size, input_range.point_map(), input_range.normal_map()); }, - [](const auto& r) -> bool { return (r.size() >= 6 && r.size() <= 8); }); + [](const auto& r) -> bool { + std::cout << "- num regions planes: " << r.size() << std::endl; + return (r.size() >= 6 && r.size() <= 8); + }); if (!success) return EXIT_FAILURE; @@ -140,7 +143,10 @@ int main(int argc, char *argv[]) { min_radius, max_radius, input_range.point_map(), input_range.normal_map()); }, - [](const auto& r) -> bool { return (r.size() > 28 && r.size() < 48); }); + [](const auto& r) -> bool { + std::cout << "- num regions spheres: " << r.size() << std::endl; + return (r.size() > 28 && r.size() < 48); + }); if (!success) return EXIT_FAILURE; @@ -165,7 +171,10 @@ int main(int argc, char *argv[]) { min_radius, max_radius, input_range.point_map(), input_range.normal_map()); }, - [](const auto& r) -> bool { return (r.size() > 4 && r.size() < 12); }); + [](const auto& r) -> bool { + std::cout << "- num regions cylinders: " << r.size() << std::endl; + return (r.size() > 4 && r.size() < 12); + }); if (!success) return EXIT_FAILURE;