Clipping simple 2 point horizontal open path with polygon results in empty solution
Polygon and line clipping and offsetting library (C++, C#, Delphi)
Brought to you by:
angusj
Hi,
I have a simple reproduction which adds a simple 2 point open path as a subject, with a non-intersecting closed polygon clip, using Difference.
I expected the solution to contain the 2 point open path, but instead, the solution is empty.
If I add a third point to my open path, it returns my open path in the solution as expected.
ClipperLib::Path p;
p.push_back(ClipperLib::IntPoint(64175, 36593));
//p.push_back(ClipperLib::IntPoint(95760, 36593)); // Adding this line will produce the correct solution
p.push_back(ClipperLib::IntPoint(95761, 36593));
ClipperLib::Path cl;
cl.push_back(ClipperLib::IntPoint(61650, 113782));
cl.push_back(ClipperLib::IntPoint(63010, 113782));
cl.push_back(ClipperLib::IntPoint(62330, 111761));
ClipperLib::Clipper c;
c.AddPath(p, ClipperLib::ptSubject, false);
c.AddPath(cl, ClipperLib::ptClip, true);
ClipperLib::PolyTree sol;
bool s = c.Execute(ClipperLib::ctDifference, sol);
Does anyone have any ideas of what's going on here?
Anonymous
probably linked to #183: Horizontal line segments in a open subject path are reversed in the solution https://sourceforge.net/p/polyclipping/bugs/183/