diff options
author | supermerill <merill@free.fr> | 2022-07-12 22:47:07 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2022-07-13 00:20:38 +0300 |
commit | 3b03a6dbf5751cb1d16c141a923388b3c84b3159 (patch) | |
tree | 04716530527d1d9507f5c9b45712d20061dbef2b | |
parent | 298f4faa47bf42034d31ce8f2bbdfba51ee7ae6a (diff) |
Use an incremental method to create brim to avoid offset() simplification with big values.
supermerill/SuperSlicer#2899
-rw-r--r-- | src/libslic3r/Brim.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libslic3r/Brim.cpp b/src/libslic3r/Brim.cpp index f9400c3f4..99970199b 100644 --- a/src/libslic3r/Brim.cpp +++ b/src/libslic3r/Brim.cpp @@ -1050,21 +1050,22 @@ void make_brim(const Print& print, const Flow& flow, const PrintObjectPtrs& obje } } islands = bigger_islands; + ExPolygons last_islands; for (size_t i = 0; i < num_loops; ++i) { loops.emplace_back(); print.throw_if_canceled(); // only grow the contour, not holes bigger_islands.clear(); if (i > 0) { - for (ExPolygon& expoly : islands) { - for (Polygon& big_contour : offset(expoly.contour, double(scaled_spacing)* i, jtSquare)) { - bigger_islands.emplace_back(expoly); - bigger_islands.back().contour = big_contour; + for (ExPolygon& expoly : last_islands) { + for (Polygon& big_contour : offset(expoly.contour, double(scaled_spacing), jtSquare)) { + bigger_islands.emplace_back(); + bigger_islands.back().contour = big_contour.simplify(scaled_resolution / 10)[0]; } } } else bigger_islands = islands; - bigger_islands = union_ex(bigger_islands); - for (ExPolygon& expoly : bigger_islands) { + last_islands = union_ex(bigger_islands); + for (ExPolygon& expoly : last_islands) { loops[i].emplace_back(expoly.contour); // buggy ////also add hole, in case of it's merged with a contour. <= HOW? if there's an island inside a hole! (in the same object) @@ -1077,7 +1078,10 @@ void make_brim(const Print& print, const Flow& flow, const PrintObjectPtrs& obje std::reverse(loops.begin(), loops.end()); + // Using offset(expoly.contour, num_loops* scaled_spacing, jtSquare) create a different result than the incremental 'loops' creation. + // so i have to restrict with the biggest (first) loop from loops (last_islands). //intersection + brimmable_areas = intersection_ex(brimmable_areas, offset_ex(last_islands, double(scaled_spacing) * 0.5, jtSquare)); Polygons frontiers; //use contour from brimmable_areas (external frontier) for (ExPolygon& expoly : brimmable_areas) { |