Improve debug messages

This commit is contained in:
Mael Rouxel-Labbé 2023-02-22 10:39:54 +01:00
parent 1ffde0eeaf
commit 23a9ab5a49
5 changed files with 37 additions and 34 deletions

View File

@ -72,7 +72,7 @@ inline std::string n2str( N const& n )
{ {
std::ostringstream ss ; std::ostringstream ss ;
ss << std::setprecision(17); ss << std::setprecision(17);
ss << CGAL_NTS to_double(n); ss << n;
return ss.str(); return ss.str();
} }
@ -120,7 +120,7 @@ inline std::string n2str( CGAL::MP_Float const& n )
{ {
std::ostringstream ss ; std::ostringstream ss ;
ss << std::setprecision(17) ; ss << std::setprecision(17) ;
ss << CGAL_NTS to_double(n) ; ss << n ;
return ss.str(); return ss.str();
} }
@ -128,7 +128,7 @@ inline std::string n2str( CGAL::Quotient< CGAL::MP_Float > const& n )
{ {
std::ostringstream ss ; std::ostringstream ss ;
ss << std::setprecision(17) ; ss << std::setprecision(17) ;
ss << CGAL_NTS to_double(n) ; ss << n ;
return ss.str(); return ss.str();
} }
#endif #endif

View File

@ -865,7 +865,7 @@ private :
if ( !lPQ.empty() ) if ( !lPQ.empty() )
{ {
// When there are simultaneous split events, we sort them to handle nearby pseudo split events // When there are simultaneous split events, we sort them to handle nearby pseudo split events
// together as to avoid multiple fronts crossing each other without seeing // together as to avoid multiple fronts crossing each other without noticing each other.
// and creating an invalid SLS. // and creating an invalid SLS.
// //
// Unfortunately, the way that this sorting is performed requires knowing whether an event // Unfortunately, the way that this sorting is performed requires knowing whether an event
@ -941,7 +941,10 @@ private :
Comparison_result CompareEvents ( EventPtr const& aA, EventPtr const& aB ) const Comparison_result CompareEvents ( EventPtr const& aA, EventPtr const& aB ) const
{ {
return aA->triedge() != aB->triedge() ? CompareEvents( aA->trisegment(), aB->trisegment() ) : EQUAL ; Comparison_result rResult = aA->triedge() != aB->triedge() ? CompareEvents( aA->trisegment(), aB->trisegment() ) : EQUAL;
CGAL_STSKEL_BUILDER_TRACE(3, "Compare events " << aA->triedge() << " and " << aB->triedge() << " -> " << rResult);
return rResult;
} }
Comparison_result CompareEvents( Trisegment_2_ptr const& aTrisegment, Vertex_handle aSeedNode ) const Comparison_result CompareEvents( Trisegment_2_ptr const& aTrisegment, Vertex_handle aSeedNode ) const

View File

@ -192,9 +192,10 @@ public:
friend std::ostream& operator << ( std::ostream& os, Self const& aTrisegment ) friend std::ostream& operator << ( std::ostream& os, Self const& aTrisegment )
{ {
return os << "[" return os << "["
<< "\n\te0 " << s2str(aTrisegment.e0()) << " weight = " << n2str(aTrisegment.w0()) << ";" << "\n\tE" << aTrisegment.e0().mID << " E" << aTrisegment.e1().mID << " E" << aTrisegment.e2().mID
<< "\n\te1 " << s2str(aTrisegment.e1()) << " weight = " << n2str(aTrisegment.w1()) << ";" << "\n\t" << s2str(aTrisegment.e0()) << " w = " << n2str(aTrisegment.w0()) << ";"
<< "\n\te2 " << s2str(aTrisegment.e2()) << " weight = " << n2str(aTrisegment.w2()) << ";" << "\n\t" << s2str(aTrisegment.e1()) << " w = " << n2str(aTrisegment.w1()) << ";"
<< "\n\t" << s2str(aTrisegment.e2()) << " w = " << n2str(aTrisegment.w2()) << ";"
<< "\n\tCollinearity: " << trisegment_collinearity_to_string(aTrisegment.collinearity()) << "\n\tCollinearity: " << trisegment_collinearity_to_string(aTrisegment.collinearity())
<< "\n]"; << "\n]";
} }

View File

@ -114,10 +114,11 @@ inline Lazy_exact_nt<NT> inexact_sqrt( Lazy_exact_nt<NT> const& lz)
template<class K> template<class K>
boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2<K> const& e ) boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2<K> const& e )
{ {
bool finite = true ;
typedef typename K::FT FT ; typedef typename K::FT FT ;
CGAL_STSKEL_TRAITS_TRACE("\n~~ Unweighted line coefficients for " << s2str(e) );
bool finite = true ;
FT a(0), b(0), c(0) ; FT a(0), b(0), c(0) ;
if(e.source().y() == e.target().y()) if(e.source().y() == e.target().y())
@ -139,9 +140,7 @@ boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2<
c = e.source().y(); c = e.source().y();
} }
CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for HORIZONTAL line: " << s2str(e) CGAL_STSKEL_TRAITS_TRACE("HORIZONTAL line; a="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c) ) ;
<< "\na="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c)
) ;
} }
else if(e.target().x() == e.source().x()) else if(e.target().x() == e.source().x())
{ {
@ -162,9 +161,7 @@ boost::optional< typename K::Line_2> compute_normalized_line_coeffC2( Segment_2<
c = -e.source().x(); c = -e.source().x();
} }
CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for VERTICAL line: " << s2str(e) CGAL_STSKEL_TRAITS_TRACE("VERTICAL line; a="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c) ) ;
<< "\na="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c)
) ;
} }
else else
{ {
@ -216,7 +213,7 @@ boost::optional< typename K::Line_2 > compute_weighted_line_coeffC2( Segment_2_w
FT b = l->b() * aWeight ; FT b = l->b() * aWeight ;
FT c = l->c() * aWeight ; FT c = l->c() * aWeight ;
CGAL_STSKEL_TRAITS_TRACE("Weighted line coefficients for line: " << s2str(e) CGAL_STSKEL_TRAITS_TRACE("\n~~ Weighted line coefficients for line: " << s2str(e)
<< "\nweight=" << n2str(aWeight) << "\nweight=" << n2str(aWeight)
<< "\na="<< n2str(a) << "\nb=" << n2str(b) << "\nc=" << n2str(c) << "\na="<< n2str(a) << "\nb=" << n2str(b) << "\nc=" << n2str(c)
) ; ) ;
@ -308,7 +305,8 @@ compute_normal_offset_lines_isec_timeC2 ( boost::intrusive_ptr< Trisegment_2<K,
typedef boost::optional<Line_2> Optional_line_2 ; typedef boost::optional<Line_2> Optional_line_2 ;
CGAL_STSKEL_TRAITS_TRACE(" ~~ Computing normal offset lines isec time for: " << tri ) ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec time [" << typeid(FT).name() << "]") ;
CGAL_STSKEL_TRAITS_TRACE("Event" << tri );
FT num(0), den(0) ; FT num(0), den(0) ;
@ -343,12 +341,9 @@ compute_normal_offset_lines_isec_timeC2 ( boost::intrusive_ptr< Trisegment_2<K,
if ( l0 && l1 && l2 ) if ( l0 && l1 && l2 )
{ {
CGAL_STSKEL_TRAITS_TRACE("\tl0 ID: " << tri->e0().mID << " w: " << n2str(tri->w0()) ) ; CGAL_STSKEL_TRAITS_TRACE("coeffs 0 [" << n2str(l0->a()) << "; " << n2str(l0->b()) << "; " << n2str(l0->c()) << "]"
CGAL_STSKEL_TRAITS_TRACE("\tl1 ID: " << tri->e1().mID << " w: " << n2str(tri->w1()) ); << "\ncoeffs 1 [" << n2str(l1->a()) << "; " << n2str(l1->b()) << "; " << n2str(l1->c()) << "]"
CGAL_STSKEL_TRAITS_TRACE("\tl2 ID: " << tri->e2().mID << " w: " << n2str(tri->w2()) ) ; << "\ncoeffs 2 [" << n2str(l2->a()) << "; " << n2str(l2->b()) << "; " << n2str(l2->c()) << "]") ;
CGAL_STSKEL_TRAITS_TRACE("\tLabc [" << n2str(l0->a()) << "; " << n2str(l0->b()) << "; " << n2str(l0->c()) << "]"
<< "[" << n2str(l1->a()) << "; " << n2str(l1->b()) << "; " << n2str(l1->c()) << "]"
<< "[" << n2str(l2->a()) << "; " << n2str(l2->b()) << "; " << n2str(l2->c()) << "]") ;
num = (l2->a()*l0->b()*l1->c()) num = (l2->a()*l0->b()*l1->c())
-(l2->a()*l1->b()*l0->c()) -(l2->a()*l1->b()*l0->c())
@ -514,7 +509,7 @@ compute_degenerate_offset_lines_isec_timeC2 ( boost::intrusive_ptr< Trisegment_2
typedef boost::optional<Point_2> Optional_point_2 ; typedef boost::optional<Point_2> Optional_point_2 ;
typedef boost::optional<Line_2> Optional_line_2 ; typedef boost::optional<Line_2> Optional_line_2 ;
CGAL_STSKEL_TRAITS_TRACE(" ~~ Computing degenerate offset lines isec time for: " << tri ) ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing degenerate offset lines isec time for: " << tri ) ;
// DETAILS: // DETAILS:
// //
@ -716,7 +711,8 @@ construct_normal_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2<K, Seg
typedef boost::optional<Line_2> Optional_line_2 ; typedef boost::optional<Line_2> Optional_line_2 ;
CGAL_STSKEL_TRAITS_TRACE(" ~~ Computing normal offset lines isec point for:" << tri ) ; CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing normal offset lines isec point [" << typeid(FT).name() << "]");
CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ;
FT x(0), y(0) ; FT x(0), y(0) ;
@ -737,6 +733,8 @@ construct_normal_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2<K, Seg
FT numX = l0->b()*l2->c() - l0->b()*l1->c() - l1->b()*l2->c() + l2->b()*l1->c() + l1->b()*l0->c() - l2->b()*l0->c(); FT numX = l0->b()*l2->c() - l0->b()*l1->c() - l1->b()*l2->c() + l2->b()*l1->c() + l1->b()*l0->c() - l2->b()*l0->c();
FT numY = l0->a()*l2->c() - l0->a()*l1->c() - l1->a()*l2->c() + l2->a()*l1->c() + l1->a()*l0->c() - l2->a()*l0->c(); FT numY = l0->a()*l2->c() - l0->a()*l1->c() - l1->a()*l2->c() + l2->a()*l1->c() + l1->a()*l0->c() - l2->a()*l0->c();
CGAL_STSKEL_TRAITS_TRACE("\tnumX=" << n2str(numX) << "\n\tnumY=" << n2str(numY) ) ;
if ( CGAL_NTS is_finite(den) && CGAL_NTS is_finite(numX) && CGAL_NTS is_finite(numY) ) if ( CGAL_NTS is_finite(den) && CGAL_NTS is_finite(numX) && CGAL_NTS is_finite(numY) )
{ {
ok = true ; ok = true ;
@ -744,13 +742,11 @@ construct_normal_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2<K, Seg
x = numX / den ; x = numX / den ;
y = -numY / den ; y = -numY / den ;
CGAL_STSKEL_TRAITS_TRACE("\tnumX=" << n2str(numX) << "\n\tnumY=" << n2str(numY) CGAL_STSKEL_TRAITS_TRACE("\n\tx=" << n2str(x) << "\n\ty=" << n2str(y) ) ;
<< "\n\tx=" << n2str(x) << "\n\ty=" << n2str(y) ) ;
} }
} }
} }
return cgal_make_optional(ok,K().construct_point_2_object()(x,y)) ; return cgal_make_optional(ok,K().construct_point_2_object()(x,y)) ;
} }
@ -779,9 +775,8 @@ construct_degenerate_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2<K,
typedef boost::optional<Point_2> Optional_point_2 ; typedef boost::optional<Point_2> Optional_point_2 ;
typedef boost::optional<Line_2> Optional_line_2 ; typedef boost::optional<Line_2> Optional_line_2 ;
CGAL_STSKEL_TRAITS_TRACE(" ~~ Computing degenerate offset lines isec point for:" CGAL_STSKEL_TRAITS_TRACE("\n~~ Computing degenerate offset lines isec point [" << typeid(FT).name() << "]");
<< " E" << tri->e0().mID << ",E" << tri->e1().mID << ",E" << tri->e2().mID CGAL_STSKEL_TRAITS_TRACE("Event: " << tri ) ;
<< tri ) ;
FT x(0),y(0) ; FT x(0),y(0) ;

View File

@ -185,7 +185,9 @@ Uncertain<bool> exist_offset_lines_isec2 ( boost::intrusive_ptr< Trisegment_2<K,
Uncertain<bool> rResult = Uncertain<bool>::indeterminate(); Uncertain<bool> rResult = Uncertain<bool>::indeterminate();
CGAL_STSKEL_TRAITS_TRACE( "Checking existence of an event for E" << tri->e0().mID << " E" << tri->e1().mID << " E" << tri->e2().mID ) ;
CGAL_STSKEL_TRAITS_TRACE( "\n~~ Checking existence of an event [" << typeid(FT).name() << "]");
CGAL_STSKEL_TRAITS_TRACE("Event:" << tri ) ;
if ( tri->collinearity() != TRISEGMENT_COLLINEARITY_ALL ) if ( tri->collinearity() != TRISEGMENT_COLLINEARITY_ALL )
{ {
@ -260,6 +262,7 @@ compare_offset_lines_isec_timesC2 ( boost::intrusive_ptr< Trisegment_2<K, Segmen
{ {
Quotient mt = mt_->to_quotient(); Quotient mt = mt_->to_quotient();
Quotient nt = nt_->to_quotient(); Quotient nt = nt_->to_quotient();
if ( CGAL_NTS certified_is_positive(mt) && CGAL_NTS certified_is_positive(nt) ) if ( CGAL_NTS certified_is_positive(mt) && CGAL_NTS certified_is_positive(nt) )
rResult = CGAL_NTS certified_compare(mt,nt); rResult = CGAL_NTS certified_compare(mt,nt);
} }
@ -416,7 +419,8 @@ oriented_side_of_event_point_wrt_bisectorC2 ( boost::intrusive_ptr< Trisegment_2
Line_2 l0 = validate(compute_weighted_line_coeffC2(e0, w0, aCoeff_cache)) ; Line_2 l0 = validate(compute_weighted_line_coeffC2(e0, w0, aCoeff_cache)) ;
Line_2 l1 = validate(compute_weighted_line_coeffC2(e1, w1, aCoeff_cache)) ; Line_2 l1 = validate(compute_weighted_line_coeffC2(e1, w1, aCoeff_cache)) ;
CGAL_STSKEL_TRAITS_TRACE("Getting oriented side of point " << p2str(p) CGAL_STSKEL_TRAITS_TRACE("\n~~ Oriented side of point [" << typeid(FT).name() << "]" );
CGAL_STSKEL_TRAITS_TRACE("p = " << p2str(p)
<< " w.r.t. bisector [" << " w.r.t. bisector ["
<< s2str(e0) << ( primary_is_0 ? "*" : "" ) << s2str(e0) << ( primary_is_0 ? "*" : "" )
<< "," << ","