Can't union identical polygons where both PolyTypes as Subject
Polygon and line clipping and offsetting library (C++, C#, Delphi)
Brought to you by:
angusj
When you try to union two identical polygons (rectangles in this example) setting both as Subject , the solution polygon is null.
using Polygon = List<IntPoint>;
using Polygons = List<List<IntPoint>>;
public void run() {
Polygons subj = new Polygons(2);
subj.Add(new Polygon(4));
subj[0].Add(new IntPoint(30, 30));
subj[0].Add(new IntPoint(30, 250));
subj[0].Add(new IntPoint(250, 250));
subj[0].Add(new IntPoint(250, 30));
subj.Add(new Polygon(4)); subj[1].Add(new IntPoint(30, 30)); subj[1].Add(new IntPoint(30, 250)); subj[1].Add(new IntPoint(250, 250)); subj[1].Add(new IntPoint(250, 30)); Polygons solution = new Polygons(); Clipper c = new Clipper(); c.AddPaths(subj, PolyType.ptSubject, true); c.Execute(ClipType.ctUnion, solution);
}
Anonymous
Hi Joseph. There is no bug. Since you haven't specified a polygon fill type in the Execute method, it defaults to PolyFillType.pftEvenOdd. Consequently the second fill correctly erases the first. If you set the fill type to PolyFillType.pftNonZero you'll get the result you're expecting.
Angus,
does it mean that odd even filltype op s on the intersection of the
subject contours/paths.?
Mahesh naik
On Sat, Aug 30, 2014 at 2:37 AM, Angus Johnson angusj@users.sf.net wrote:
Related
Bugs:
#106Thanks for your quick response, I understand now. Off to read more...