diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2.h index 3cf2b00fcb0..046f41fa362 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2.h @@ -213,7 +213,7 @@ public : if ( begin->is_border()) ++nb; } - CGAL_STSKEL_VALIDITY_TRACE("summe border halfedges (2*nb) = " << 2 * nb ); + CGAL_STSKEL_VALIDITY_TRACE("sum of border halfedges (2*nb) = " << 2 * nb ); bool nvalid = ( n == this->size_of_halfedges()); diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h index 95fe522f3b3..7d94e9a603d 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Polygon_offset_builder_2_impl.h @@ -66,7 +66,8 @@ Polygon_offset_builder_2::LocateHook( FT Halfedge_const_handle lNext = aBisector->next(); CGAL_POLYOFFSET_TRACE(2,"Testing hook on " << e2str(*aBisector) ) ; - CGAL_POLYOFFSET_TRACE(4, "Next: " << e2str(*lNext) << " ; Prev: " << e2str(*lPrev) ) ; + CGAL_POLYOFFSET_TRACE(4, "Next: " << e2str(*lNext) ) ; + CGAL_POLYOFFSET_TRACE(4, "Prev: " << e2str(*lPrev) ) ; if ( !IsVisited(aBisector) ) { 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 f163c0fdd4b..9819ba88568 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 @@ -46,6 +46,8 @@ Straight_skeleton_builder_2::Straight_skeleton_builder_2 ( boost::optio ,mPQ(mEventCompare) ,mSSkel( new SSkel() ) { + if( mMaxTime ) + CGAL_STSKEL_BUILDER_TRACE(4, "Init with mMaxTime = " << *mMaxTime) } template @@ -98,6 +100,9 @@ Straight_skeleton_builder_2::FindEdgeEvent( Vertex_handle aLNode, Verte { Trisegment_2_ptr lTrisegment = CreateTrisegment(lTriedge,aLNode,aRNode); + CGAL_STSKEL_BUILDER_TRACE(4, "\n[] Considering E" << lTrisegment->e0().mID << " E" << lTrisegment->e1().mID << " E" << lTrisegment->e2().mID + << " Collinearity: " << trisegment_collinearity_to_string(lTrisegment->collinearity()) ) ; + // The 02 collinearity configuration is problematic: 01 or 12 collinearity has a seed position // giving the point through which the bisector passes. However, for 02, it is not a given. // @@ -163,7 +168,9 @@ Straight_skeleton_builder_2::FindEdgeEvent( Vertex_handle aLNode, Verte } else { - CGAL_STSKEL_BUILDER_TRACE(4, "Edge event: " << lTriedge << " is in the past. Compared to L=" << lLNodeD << " to R=" << lRNodeD ) ; + CGAL_STSKEL_BUILDER_TRACE(4, "Edge event: " << lTriedge << " is in the past." ) ; + CGAL_STSKEL_BUILDER_TRACE(4, "\tCompared to L=" << aLNode->id() << " (" << lLNodeD << ")" ) ; + CGAL_STSKEL_BUILDER_TRACE(4, "\tCompared to R=" << aRNode->id() << " (" << lRNodeD << ")" ) ; } } } @@ -605,6 +612,8 @@ void Straight_skeleton_builder_2::CreateContourBisectors() template void Straight_skeleton_builder_2::HarmonizeSpeeds(boost::mpl::bool_) { + CGAL_STSKEL_BUILDER_TRACE ( 2, "Harmonize speeds..." ) ; + // Collinear input edges might not have the exact same speed if an inexact square root is used. // This might cause some inconsistencies in time, resulting in invalid skeletons. Therefore, // if the square root is not exact, we enforce that collinear input edges have the same speed, @@ -1058,7 +1067,7 @@ void Straight_skeleton_builder_2::HandleEdgeEvent( EventPtr aEvent ) SetBisectorSlope(lLSeed,lNewNode); SetBisectorSlope(lRSeed,lNewNode); - CGAL_STSKEL_BUILDER_TRACE( 1, "E" << e2str(*(lRSeed->halfedge()->defining_contour_edge())) << " collapsed." ); + CGAL_STSKEL_BUILDER_TRACE( 1, e2str(*(lRSeed->halfedge()->defining_contour_edge())) << " collapsed." ); CGAL_STSKEL_BUILDER_TRACE( 3, "fictitious node along collapsed face is N" << lRIFicNode->id() << " between " << e2str(*lROBisector) << " and " << e2str(*lLIBisector) ) ; @@ -1539,16 +1548,16 @@ void Straight_skeleton_builder_2::Propagate() if ( !mPQ.empty() ) { #ifdef CGAL_SLS_PRINT_QUEUE_BEFORE_EACH_POP - std::cout << "MAIN QUEUE -------------------------------------------------- " << std::endl; - std::cout << "Queue size: " << mPQ.size() << std::endl; + CGAL_STSKEL_BUILDER_TRACE(4, "MAIN QUEUE -------------------------------------------------- "); + CGAL_STSKEL_BUILDER_TRACE(4, "Queue size: " << mPQ.size()); auto mpq = mPQ; while(!mpq.empty()) { EventPtr event = mpq.top(); mpq.pop(); - std::cout << *event << std::endl; + CGAL_STSKEL_BUILDER_TRACE(4, *event); } - std::cout << "END MAIN QUEUE --------------------------------------------- " << std::endl; + CGAL_STSKEL_BUILDER_TRACE(4, "END MAIN QUEUE --------------------------------------------- "); #endif EventPtr lEvent = PopEventFromPQ(); @@ -2031,7 +2040,7 @@ bool Straight_skeleton_builder_2::FinishUp() mVisitor.on_cleanup_finished(); - // @todo if 'mMaxTime' is sufficiently large, it will be a full skeleton and should be validated as such + // If 'mMaxTime' is sufficiently large, it will be a full skeleton and could be validated as such... if(mMaxTime) // might be a partial skeleton return mSSkel->is_valid(true); else diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h index fba2f93c1d6..10dce56f03b 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_builder_events_2.h @@ -178,7 +178,7 @@ private : virtual void dump ( std::ostream& ss ) const { this->Base::dump(ss); - ss << " (Split Event, Seed=" << mSeed->id() << " (" << mSeed->point() << ") OppBorder=" << this->triedge().e2()->id() << ')' ; + ss << " (Split Event, Seed=" << mSeed->id() << "pos: (" << mSeed->point() << ") OppBorder=" << this->triedge().e2()->id() << ')' ; } private : 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 72887141335..62ad19c8c4e 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/debug.h @@ -22,7 +22,7 @@ #if defined(CGAL_STRAIGHT_SKELETON_ENABLE_TRACE) \ || defined(CGAL_POLYGON_OFFSET_ENABLE_TRACE) \ || defined(CGAL_STRAIGHT_SKELETON_TRAITS_ENABLE_TRACE) \ - || defined(CGAL_STRAIGHT_SKELETON_ENABLE_VALIDITY_TRACE) \ + || defined(CGAL_STRAIGHT_SKELETON_VALIDITY_ENABLE_TRACE) \ || defined(CGAL_STRAIGHT_SKELETON_ENABLE_INTRINSIC_TESTING) # # define CGAL_STSKEL_TRACE_ON @@ -231,6 +231,7 @@ template inline std::string newn2str( char const* name, VH const& v, Triedge const& aTriedge ) { std::ostringstream ss ; + ss.precision(17); ss << "New Node " << name <<" is N" << v->id() << " at " << v->point() << " [E" << aTriedge.e0()->id() @@ -283,7 +284,7 @@ bool sEnableTraitsTrace = true; #endif -#ifdef CGAL_STRAIGHT_SKELETON_ENABLE_VALIDITY_TRACE +#ifdef CGAL_STRAIGHT_SKELETON_VALIDITY_ENABLE_TRACE # define CGAL_STSKEL_VALIDITY_TRACE(m) CGAL_STSKEL_TRACE(m) # define CGAL_STSKEL_VALIDITY_TRACE_IF(cond,m) if ( cond ) CGAL_STSKEL_VALIDITY_TRACE(m) #else 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 33df80101dc..026ab6390fc 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_builder_2.h @@ -447,7 +447,7 @@ private : } } - // @todo Should split events always have lower priority than split events? + // @todo Should split events always have lower priority than edge events? Comparison_result CompareEventsSupportAngles ( EventPtr const& aA, EventPtr const& aB ) { CGAL_precondition ( aA->type() != Event::cEdgeEvent && aB->type() != Event::cEdgeEvent ) ; @@ -1404,8 +1404,6 @@ public: } } - CGAL_assertion_code(std::cout << "lFaceCountThroughWeights = " << lFaceCountThroughWeights << std::endl;) - CGAL_assertion_code(std::cout << "mSSkel->SSkel::Base::size_of_faces() = " << mSSkel->SSkel::Base::size_of_faces() << std::endl;) CGAL_assertion( lFaceCountThroughWeights == mSSkel->SSkel::Base::size_of_faces() ) ; return *this; diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_halfedge_base_2.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_halfedge_base_2.h index 2943861ae1a..81e484da4ff 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_halfedge_base_2.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_halfedge_base_2.h @@ -89,7 +89,7 @@ public: Halfedge_const_handle defining_contour_edge() const { return this->face()->halfedge() ; } Halfedge_handle defining_contour_edge() { return this->face()->halfedge() ; } - // @fixme this isn't documented in the `StraightSkeletonHalfedge_2` concept + // @fixme below is not documented in the `StraightSkeletonHalfedge_2` concept Sign slope() const { return mSlope ; } void set_slope( Sign aSlope ) { mSlope = aSlope ; } diff --git a/Straight_skeleton_2/include/CGAL/Trisegment_2.h b/Straight_skeleton_2/include/CGAL/Trisegment_2.h index 3f85a626b10..f16b8de4919 100644 --- a/Straight_skeleton_2/include/CGAL/Trisegment_2.h +++ b/Straight_skeleton_2/include/CGAL/Trisegment_2.h @@ -156,10 +156,10 @@ public: friend std::ostream& operator << ( std::ostream& os, Self const& aTrisegment ) { - return os << "[" << s2str(aTrisegment.e0()) - << " " << s2str(aTrisegment.e1()) - << " " << s2str(aTrisegment.e2()) - << " " << trisegment_collinearity_to_string(aTrisegment.collinearity()) + return os << "[e0 " << s2str(aTrisegment.e0()) + << "; e1 " << s2str(aTrisegment.e1()) + << "; e2 " << s2str(aTrisegment.e2()) + << "; Collinearity: " << trisegment_collinearity_to_string(aTrisegment.collinearity()) << "]"; } 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 03b25b3352d..87873753b21 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 @@ -48,7 +48,9 @@ boost::optional< Point_2 > construct_offset_pointC2 ( typename K::FT const& t FT x(0.0),y(0.0) ; - CGAL_STSKEL_TRAITS_TRACE("Constructing offset point for t=" << t << " e0=" << s2str(e0) << " e1=" << s2str(e1) << " tri=" << tri ) ; + CGAL_STSKEL_TRAITS_TRACE("Constructing offset point for t=" << t ) ; + CGAL_STSKEL_TRAITS_TRACE("Edges " << " e0=" << s2str(e0) << " w = " << weight0 ) ; + CGAL_STSKEL_TRAITS_TRACE( " e1=" << s2str(e1) << " w = " << weight1 << " tri=" << tri ) ; Optional_line_2 l0 = compute_normalized_line_ceoffC2(e0, aCoeff_cache) ; Optional_line_2 l1 = compute_normalized_line_ceoffC2(e1, aCoeff_cache) ; 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 8ffd6f68eee..8df825fdb6a 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 @@ -142,8 +142,7 @@ boost::optional< Line_2 > compute_normalized_line_ceoffC2( Segment_2 const c = e.source().y(); } - CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for HORIZONTAL line:\n" - << s2str(e) + CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for HORIZONTAL line: " << s2str(e) << "\na="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c) ) ; } @@ -166,8 +165,7 @@ boost::optional< Line_2 > compute_normalized_line_ceoffC2( Segment_2 const c = -e.source().x(); } - CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for VERTICAL line:\n" - << s2str(e) + CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for VERTICAL line: " << s2str(e) << "\na="<< n2str(a) << ", b=" << n2str(b) << ", c=" << n2str(c) ) ; } @@ -186,8 +184,7 @@ boost::optional< Line_2 > compute_normalized_line_ceoffC2( Segment_2 const c = -e.source().x()*a - e.source().y()*b; - CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for line:\n" - << s2str(e) + CGAL_STSKEL_TRAITS_TRACE("Unweighted line coefficients for line: " << s2str(e) << "\nsa="<< n2str(sa) << "\nsb=" << n2str(sb) << "\nl2=" << n2str(l2) << "\nl=" << n2str(l) << "\na="<< n2str(a) << "\nb=" << n2str(b) << "\nc=" << n2str(c) ) ; @@ -211,9 +208,8 @@ boost::optional< Line_2 > compute_normalized_line_ceoffC2( Segment_2 const CGAL_precondition( CGAL_NTS is_finite(b) ) ; CGAL_precondition( CGAL_NTS is_finite(c) ) ; - CGAL_STSKEL_TRAITS_TRACE("Weighted line coefficients for line:\n" - << s2str(e) - << "\nscaling=" << n2str(lScale) + CGAL_STSKEL_TRAITS_TRACE("Weighted line coefficients for line: " << s2str(e) + << "\nweight=" << n2str(aWeight) << "\na="<< n2str(a) << "\nb=" << n2str(b) << "\nc=" << n2str(c) ) ; @@ -312,8 +308,8 @@ compute_normal_offset_lines_isec_timeC2 ( boost::intrusive_ptr< Trisegment_2 > compute_oriented_midpoint ( Segment_2_with_ID c if ( CGAL_NTS is_finite(delta01) && CGAL_NTS is_finite(delta10) ) { if ( delta01 <= delta10 ) - mp = CGAL::midpoint(e0.target(),e1.source()); - else mp = CGAL::midpoint(e1.target(),e0.source()); + mp = CGAL::midpoint(e0.target(),e1.source()); + else + mp = CGAL::midpoint(e1.target(),e0.source()); CGAL_STSKEL_TRAITS_TRACE("Computing oriented midpoint between:" << "\ne0: " << s2str(e0) @@ -668,7 +665,7 @@ construct_normal_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2a()*l2->b() - l0->a()*l1->b() - l1->a()*l2->b() + l2->a()*l1->b() + l0->b()*l1->a() - l0->b()*l2->a(); - CGAL_STSKEL_TRAITS_TRACE("den=" << n2str(den) ) + CGAL_STSKEL_TRAITS_TRACE("\tden=" << n2str(den) ) if ( ! CGAL_NTS certified_is_zero(den) ) { @@ -682,9 +679,8 @@ construct_normal_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2e0().mID << ",E" << tri->e1().mID << ",E" << tri->e2().mID << std::endl + << tri ) ; FT x(0.0),y(0.0) ; @@ -824,7 +823,7 @@ construct_degenerate_offset_lines_isecC2 ( boost::intrusive_ptr< Trisegment_2b()) ? "(vertical)" : "") << " event point: x=" << n2str(x) << " y=" << n2str(y) ) + CGAL_STSKEL_TRAITS_TRACE("\nDegenerate" << (CGAL_NTS is_zero(l0->b()) ? " (vertical)" : "") << " event point: x=" << n2str(x) << " y=" << n2str(y) ) return cgal_make_optional(ok,K().construct_point_2_object()(x,y)) ; } diff --git a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h index dbaa31bbcb8..39ee6bec9cc 100644 --- a/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h +++ b/Straight_skeleton_2/include/CGAL/create_offset_polygons_2.h @@ -389,7 +389,7 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset, ofk); } -// Overloads common to both polygons with and without holes, a simple polygons are returned in any case +// Overloads common to both polygons with and without holes, a simple polygons is returned in any case template::type> std::vector< boost::shared_ptr > diff --git a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h index 6c72defa00d..d0837c9c7c4 100644 --- a/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h +++ b/Straight_skeleton_2/include/CGAL/create_weighted_straight_skeleton_2.h @@ -195,6 +195,8 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset, frame[2] = Point_2(fxmax,fymax); frame[3] = Point_2(fxmin,fymax); + CGAL_STSKEL_BUILDER_TRACE(2, "Frame:\n" << frame[0] << "\n" << frame[1] << "\n" << frame[2] << "\n" << frame[3]); + typedef std::vector Hole; Hole poly(vertices_begin, vertices_end); diff --git a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h index 0a70ea188c9..6f3dedf9d92 100644 --- a/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h +++ b/Straight_skeleton_2/include/CGAL/predicates/Straight_skeleton_pred_ftC2.h @@ -187,6 +187,8 @@ Uncertain exist_offset_lines_isec2 ( boost::intrusive_ptr< Trisegment_2 rResult = Uncertain::indeterminate(); + CGAL_STSKEL_TRAITS_TRACE( "Checking existence of an event for E" << tri->e0().mID << " E" << tri->e1().mID << " E" << tri->e2().mID ) ; + if ( tri->collinearity() != TRISEGMENT_COLLINEARITY_ALL ) { CGAL_STSKEL_TRAITS_TRACE( ( tri->collinearity() == TRISEGMENT_COLLINEARITY_NONE ? " normal edges" : " collinear edges" ) ) ; @@ -206,25 +208,27 @@ Uncertain exist_offset_lines_isec2 ( boost::intrusive_ptr< Trisegment_2