fix negative area from elephant foot reduction

assert was screaming, with reason.
This commit is contained in:
remi durand 2021-06-14 00:36:37 +02:00
parent 055794f822
commit 4ea2fc1482

View File

@ -1228,6 +1228,11 @@ ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<s
holes.reserve(expoly.holes.size());
for (const Polygon& hole : expoly.holes)
append(holes, fix_after_outer_offset(mittered_offset_path_scaled(hole.points, deltas[1 + &hole - expoly.holes.data()], miter_limit), ClipperLib::pftNegative, false));
for (auto it = holes.begin(); it != holes.end();)
if (ClipperLib::Area(*it) < 0.) {
it = holes.erase(it);
}
else ++it;
#ifndef NDEBUG
for (auto &c : holes)
assert(ClipperLib::Area(c) > 0.);