From 283c1a21163093731a01897993c95f9cb1518615 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 27 Feb 2024 16:39:56 +0100 Subject: [PATCH] More debug message in cdt.is_valid(true) --- .../Constrained_Delaunay_triangulation_3.h | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h index d59c4edfdd0..1001aa015b8 100644 --- a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h @@ -2764,13 +2764,29 @@ public: { if(!it->is_facet_constrained(i) && this->side_of_sphere(it, n->vertex(n_index)->point()) == ON_BOUNDED_SIDE) { if(verbose) { + const auto v = tr.vertices(it); std::cerr << "non-empty sphere at non-constrained facet (" << IO::oformat(Cell_handle(it)) << ", " << i << ") the cell is:\n " - << IO::oformat(it->vertex(0), with_point) << "\n " - << IO::oformat(it->vertex(1), with_point) << "\n " - << IO::oformat(it->vertex(2), with_point) << "\n " - << IO::oformat(it->vertex(3), with_point) << "\ncontains:\n " + << IO::oformat(v[0], with_point) << "\n " + << IO::oformat(v[1], with_point) << "\n " + << IO::oformat(v[2], with_point) << "\n " + << IO::oformat(v[3], with_point) << "\ncontains:\n " << IO::oformat(n->vertex(n_index), with_point_and_info) << '\n'; + using EK = CGAL::Exact_predicates_exact_constructions_kernel; + const auto to_exact = CGAL::Cartesian_converter(); + const auto from_exact = CGAL::Cartesian_converter(); + + const auto exact_circ = CGAL::circumcenter(to_exact(tr.point(v[0])), + to_exact(tr.point(v[1])), + to_exact(tr.point(v[2])), + to_exact(tr.point(v[3]))); + const auto exact_sq_circumradius = CGAL::squared_distance(to_exact(tr.point(v[0])), exact_circ); + const auto exact_sq_distance = + CGAL::squared_distance(exact_circ, to_exact(tr.point(n->vertex(n_index)))); + std::cerr << "exact squared circumradius: " << exact_sq_circumradius << '\n'; + std::cerr << "exact squared distance: " << exact_sq_distance << '\n'; + std::cerr << "ratio (non-squared): " + << CGAL::sqrt(CGAL::to_double(from_exact(exact_sq_distance / exact_sq_circumradius))) << '\n'; } result = false; }