add a tgPolygon::Diff for diff againt another polygon
(unused for now, but was used in experiments)
This commit is contained in:
parent
d2bc41428c
commit
9df1e2a81b
2 changed files with 18 additions and 0 deletions
|
@ -2041,6 +2041,23 @@ tgPolygon tgPolygon::Union( const tgPolygon& subject, tgPolygon& clip )
|
|||
return tgPolygon::FromClipper( clipper_result );
|
||||
}
|
||||
|
||||
tgPolygon tgPolygon::Diff( const tgPolygon& subject, tgPolygon& clip )
|
||||
{
|
||||
tgPolygon result;
|
||||
|
||||
ClipperLib::Polygons clipper_subject = tgPolygon::ToClipper( subject );
|
||||
ClipperLib::Polygons clipper_clip = tgPolygon::ToClipper( clip );
|
||||
ClipperLib::Polygons clipper_result;
|
||||
|
||||
ClipperLib::Clipper c;
|
||||
c.Clear();
|
||||
c.AddPolygons(clipper_subject, ClipperLib::ptSubject);
|
||||
c.AddPolygons(clipper_clip, ClipperLib::ptClip);
|
||||
c.Execute(ClipperLib::ctDifference, clipper_result, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
|
||||
|
||||
return tgPolygon::FromClipper( clipper_result );
|
||||
}
|
||||
|
||||
tgPolygon tgPolygon::Intersect( const tgPolygon& subject, const tgPolygon& clip )
|
||||
{
|
||||
tgPolygon result;
|
||||
|
|
|
@ -590,6 +590,7 @@ public:
|
|||
// init_accumulator should return a handle...
|
||||
static tgPolygon Union( const tgContour& subject, tgPolygon& clip );
|
||||
static tgPolygon Union( const tgPolygon& subject, tgPolygon& clip );
|
||||
static tgPolygon Diff( const tgPolygon& subject, tgPolygon& clip );
|
||||
static tgPolygon Intersect( const tgPolygon& subject, const tgPolygon& clip );
|
||||
|
||||
static tgPolygon DiffWithAccumulator( const tgPolygon& subject );
|
||||
|
|
Loading…
Add table
Reference in a new issue