mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 19:02:10 +00:00
Fix of Can't convert polyline with more than two points to a line (#6933)
Sometimes Clipper produces a polyline with more than 2 points when clipping a line with a polygon or a set of polygons. We hope the intermediate points are collinear with the line, so we may just ignore them.
This commit is contained in:
@@ -647,7 +647,9 @@ Lines _clipper_ln(ClipperLib::ClipType clipType, const Lines &subject, const Pol
|
||||
// convert Polylines to Lines
|
||||
Lines retval;
|
||||
for (Polylines::const_iterator polyline = polylines.begin(); polyline != polylines.end(); ++polyline)
|
||||
retval.emplace_back(polyline->line());
|
||||
if (polyline->size() >= 2)
|
||||
//FIXME It may happen, that Clipper produced a polyline with more than 2 collinear points by clipping a single line with polygons. It is a very rare issue, but it happens, see GH #6933.
|
||||
retval.push_back({ polyline->front(), polyline->back() });
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user