Fixes https://github.com/prusa3d/Slic3r/issues/670
and some of https://github.com/prusa3d/Slic3r/issues/895
PerimeterGenerator was using an unsafe clipper offset function,
which performed offset for both a contour and its holes together.
With this commit the offsets were replaced with their safe counterparts,
though these safe counterparts may be somehow slower
(performing offset on ExPolygon or ExPolygons, piece by piece).
Also there was a bug, where if the infill & gap fill consumed
everything of the polygon, a polygon one onion shell above was still
used for infill.
Dent in perimeters around a hole
Clipper Offset has been extended to remove tiny edges before the offset.
This is important as the tiny edges pose difficulty
for normal calculation, leading to various adverse effects like
kinks and dents in the offsetted contour.
The Clipper library has difficulties processing overlapping polygons.
Namely, the function Clipper::JoinCommonEdges() has potentially a terrible time complexity if the output
of the operation is of the PolyTree type.
This function implmenets a following workaround:
1) Peform the Clipper operation with the output to Paths. This method handles overlaps in a reasonable time.
2) Run Clipper Union once again to extract the PolyTree from the result of 1).
inside ClipperUtils are now using bit shifts instead of multiplication
by doubles, which makes the scaling precise.
Removed the scale parameter from all offset functions.
Modified the safety offset to calculate offset per polygon instead
of over all polygons at once. The old way was not safe and very slow,
sometimes this meant a kiss of death for supports for example.
Added a safe variant of offset(const Slic3r::ExPolygon...), which offsets each loop separately.
New functions "remove_sticks" to remove zero area parts of polygons.
New functions "remove_small" and "remove_degenerate" for polygon clean up.
Extended the C++ supports, those are not finalized yet though.