From d609a64b0f9ddc79d735f8b8a851370e50ea11ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 7 Mar 2023 01:03:52 +0100 Subject: [PATCH] Debug code cleaning --- .../Straight_skeleton_builder_2_impl.h | 2 +- .../include/CGAL/Straight_skeleton_2/debug.h | 44 +++++++++---------- .../CGAL/Straight_skeleton_builder_2.h | 2 +- .../CGAL/Straight_skeleton_builder_traits_2.h | 2 + .../include/CGAL/Trisegment_2.h | 1 + .../constructions/Polygon_offset_cons_ftC2.h | 2 +- .../Straight_skeleton_cons_ftC2.h | 19 ++++---- .../predicates/Straight_skeleton_pred_ftC2.h | 2 +- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h index 0c3e45f6852..1b1cea1db7e 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_2_impl.h @@ -304,7 +304,7 @@ void Straight_skeleton_builder_2::CollectSplitEvents( Vertex_handle aNo } } - CGAL_STSKEL_BUILDER_TRACE(4, GetVertexData(aNode).mSplitEvents.size()); + CGAL_STSKEL_BUILDER_TRACE(4, "#Split Events=" << GetVertexData(aNode).mSplitEvents.size()); } diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h index 1ae4436865b..e888874104c 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h @@ -19,28 +19,6 @@ # include #endif -#if defined(CGAL_STRAIGHT_SKELETON_ENABLE_TRACE) \ - || defined(CGAL_POLYGON_OFFSET_ENABLE_TRACE) \ - || defined(CGAL_STRAIGHT_SKELETON_TRAITS_ENABLE_TRACE) \ - || defined(CGAL_STRAIGHT_SKELETON_VALIDITY_ENABLE_TRACE) -# -# define CGAL_STSKEL_TRACE_ON -bool sEnableTrace = true ; -# define CGAL_STSKEL_ENABLE_TRACE sEnableTrace = true ; -# define CGAL_STSKEL_DISABLE_TRACE sEnableTrace = false ; -# include -# include -# include -# include -# define CGAL_STSKEL_TRACE(m) \ - if ( sEnableTrace ) \ - { \ - std::ostringstream ss ; \ - ss << std::setprecision(17) << m ; \ - std::string s = ss.str(); \ - Straight_skeleton_external_trace(s); \ - } - #include template @@ -250,6 +228,28 @@ inline std::string newn2str( char const* name, VH const& v, Triedge const& aTrie return ss.str(); } +#if defined(CGAL_STRAIGHT_SKELETON_ENABLE_TRACE) \ + || defined(CGAL_POLYGON_OFFSET_ENABLE_TRACE) \ + || defined(CGAL_STRAIGHT_SKELETON_TRAITS_ENABLE_TRACE) \ + || defined(CGAL_STRAIGHT_SKELETON_VALIDITY_ENABLE_TRACE) +# +# define CGAL_STSKEL_TRACE_ON +bool sEnableTrace = true ; +# define CGAL_STSKEL_ENABLE_TRACE sEnableTrace = true ; +# define CGAL_STSKEL_DISABLE_TRACE sEnableTrace = false ; +# include +# include +# include +# include +# define CGAL_STSKEL_TRACE(m) \ + if ( sEnableTrace ) \ + { \ + std::ostringstream ss ; \ + ss << std::setprecision(17) << m ; \ + std::string s = ss.str(); \ + Straight_skeleton_external_trace(s); \ + } + #endif #ifdef CGAL_STRAIGHT_SKELETON_ENABLE_TRACE diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h index 36c6c845c62..322a84d8ee2 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -713,7 +713,7 @@ private : CreateSegment(aTriedge.e2()), aTriedge.e2()->weight() ); - CGAL_STSKEL_BUILDER_TRACE(5,"Trisegment for " << aTriedge << ":" << r ) ; + CGAL_STSKEL_BUILDER_TRACE(5,"Trisegment for " << aTriedge << ":\n" << r ) ; // Consecutive collinear segments must not have the same weight CGAL_assertion_code(if(r->collinearity() == TRISEGMENT_COLLINEARITY_01)) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h index 78cbb5addf0..0616791a8af 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_traits_2.h @@ -695,6 +695,8 @@ public: if ( lOptTime && lOptTime->to_nt() > *mApproximate_traits.mFilteringBound ) { + CGAL_STSKEL_TRAITS_TRACE("Ignoring potential split event"); + // avoid filling the cache vectors with times of trisegments that will be removed reset_trisegment(tri->id()); return true; diff --git a/Straight_skeleton_2/include/CGAL/Trisegment_2.h b/Straight_skeleton_2/include/CGAL/Trisegment_2.h index 234b1aea952..ce7fa34a79c 100644 --- a/Straight_skeleton_2/include/CGAL/Trisegment_2.h +++ b/Straight_skeleton_2/include/CGAL/Trisegment_2.h @@ -16,6 +16,7 @@ #include #include +#include #include diff --git a/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h b/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h index 2cbff1b5b7b..78ff0b0368e 100644 --- a/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/constructions/Polygon_offset_cons_ftC2.h @@ -53,7 +53,7 @@ construct_offset_pointC2 ( typename K::FT const& t, CGAL_STSKEL_TRAITS_TRACE("Constructing offset point for t=" << t ) ; CGAL_STSKEL_TRAITS_TRACE("Edges e0=" << s2str(e0) << "w = " << w0 ) ; CGAL_STSKEL_TRAITS_TRACE(" e1=" << s2str(e1) << "w = " << w1 ) ; - CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ; + CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); Optional_line_2 l0 = compute_normalized_line_coeffC2(e0, aCaches) ; Optional_line_2 l1 = compute_normalized_line_coeffC2(e1, aCaches) ; diff --git a/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h b/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h index 3c05a0e8864..c66f9dfb390 100644 --- a/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/constructions/Straight_skeleton_cons_ftC2.h @@ -121,8 +121,8 @@ inexact_sqrt(const Lazy_exact_nt& lz) return inexact_sqrt(exact(lz)); } -// Currently the norm can be inexact even when we are in the exact pipeline of the traits -// if we use something like K = EPICK because there is no exact sqrt. +// Currently the norm can be inexact even if we are in the exact pipeline of the traits. +// For example, if we use something like K = EPICK, there is no exact sqrt in K::Exact_K. // // @todo Ideally, we could compute how much precision is required for the sqrt // given all possible operations that are performed in the SLS and the input values @@ -412,7 +412,7 @@ compute_normal_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec time [" << typeid(FT).name() << "]") ; - CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ); + CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); FT num(0), den(0) ; @@ -609,7 +609,7 @@ compute_artifical_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2 Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing artificial isec time [" << typeid(FT).name() << "]"); - CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ; + CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); CGAL_precondition(tri->e0() == tri->e1()); CGAL_precondition(bool(tri->child_l())); @@ -682,7 +682,7 @@ compute_degenerate_offset_lines_isec_timeC2 ( Trisegment_2_ptr< Trisegment_2id() << ") [" << typeid(FT).name() << "]" ); if ( aCaches.mTime_cache.IsCached(tri->id()) ) - { - CGAL_STSKEL_TRAITS_TRACE("cached"); return aCaches.mTime_cache.Get(tri->id()) ; - } CGAL_precondition ( tri->collinearity() != TRISEGMENT_COLLINEARITY_ALL ) ; @@ -890,7 +887,7 @@ construct_normal_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 Optional_line_2 ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec point [" << typeid(FT).name() << "]"); - CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ; + CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); FT x(0), y(0) ; @@ -945,7 +942,7 @@ construct_artifical_isecC2 ( Trisegment_2_ptr< Trisegment_2e0() == tri->e1()); CGAL_precondition(bool(tri->child_l())); @@ -1011,7 +1008,7 @@ construct_degenerate_offset_lines_isecC2 ( Trisegment_2_ptr< Trisegment_2 exist_offset_lines_isec2 ( Trisegment_2_ptr< Trisegment_2 rResult = Uncertain::indeterminate(); CGAL_STSKEL_TRAITS_TRACE( "\n~~ Checking existence of an event [" << typeid(FT).name() << "]"); - CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ; + CGAL_STSKEL_TRAITS_TRACE("Event:\n" << tri); if ( tri->collinearity() != TRISEGMENT_COLLINEARITY_ALL ) {