From f52e3fef75dbe0893402d7b3da6602281ffb10f2 Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Sun, 30 Sep 2012 13:32:01 -0400 Subject: [PATCH] fix clipper usage to fix accumulator contours. --- src/Lib/Polygon/polygon.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Lib/Polygon/polygon.cxx b/src/Lib/Polygon/polygon.cxx index a54e7880..c980e344 100644 --- a/src/Lib/Polygon/polygon.cxx +++ b/src/Lib/Polygon/polygon.cxx @@ -654,15 +654,10 @@ void tgPolygonDumpAccumulator( char* ds, char* layer, char* name ) void tgPolygonAddToClipperAccumulator( const TGPolygon& subject, bool dump ) { std::ofstream subjectFile, clipFile, resultFile; - + ClipperLib::Polygons clipper_subject; make_clipper_poly( subject, &clipper_subject ); - ClipperLib::Clipper c; - c.Clear(); - c.AddPolygons(clipper_subject, ClipperLib::ptSubject); - c.AddPolygons(clipper_accumulator, ClipperLib::ptClip); - if (dump) { subjectFile.open ("subject.txt"); subjectFile << clipper_subject; @@ -673,7 +668,12 @@ void tgPolygonAddToClipperAccumulator( const TGPolygon& subject, bool dump ) clipFile.close(); } - if ( !c.Execute(ClipperLib::ctUnion, clipper_accumulator, ClipperLib::pftNonZero, ClipperLib::pftNonZero) ) { + ClipperLib::Clipper c; + c.Clear(); + c.AddPolygons(clipper_subject, ClipperLib::ptSubject); + c.AddPolygons(clipper_accumulator, ClipperLib::ptClip); + + if ( !c.Execute(ClipperLib::ctUnion, clipper_accumulator, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd) ) { SG_LOG(SG_GENERAL, SG_ALERT, "Add to Accumulator returned FALSE" ); exit(-1); }