diff options
author | Lukáš Hejl <hejl.lukas@gmail.com> | 2022-07-12 19:59:02 +0300 |
---|---|---|
committer | Lukáš Hejl <hejl.lukas@gmail.com> | 2022-07-12 19:59:48 +0300 |
commit | 22255822a22399b15d1096868a9e2ae9d64f4e9a (patch) | |
tree | 6d6a05e5892f422b4e72b06912ff9f98131289a4 | |
parent | 92f874cdea47e97bf90d26a67b69ee8aa5909e5b (diff) |
Fix of #8488 - Infinite loop in the lightning infill.
-rw-r--r-- | src/libslic3r/Fill/Lightning/DistanceField.cpp | 2 | ||||
-rw-r--r-- | src/libslic3r/Fill/Lightning/DistanceField.hpp | 2 | ||||
-rw-r--r-- | src/libslic3r/Fill/Lightning/Generator.cpp | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/libslic3r/Fill/Lightning/DistanceField.cpp b/src/libslic3r/Fill/Lightning/DistanceField.cpp index 0cbfa9af5..ad1a85ac6 100644 --- a/src/libslic3r/Fill/Lightning/DistanceField.cpp +++ b/src/libslic3r/Fill/Lightning/DistanceField.cpp @@ -17,7 +17,7 @@ namespace Slic3r::FillLightning constexpr coord_t radius_per_cell_size = 6; // The cell-size should be small compared to the radius, but not so small as to be inefficient. #ifdef LIGHTNING_DISTANCE_FIELD_DEBUG_OUTPUT -void export_distance_field_to_svg(const std::string &path, const Polygons &outline, const Polygons &overhang, const std::list<DistanceField::UnsupportedCell> &unsupported_points, const Points &points = {}) +void export_distance_field_to_svg(const std::string &path, const Polygons &outline, const Polygons &overhang, const std::vector<DistanceField::UnsupportedCell> &unsupported_points, const Points &points = {}) { coordf_t stroke_width = scaled<coordf_t>(0.01); BoundingBox bbox = get_extents(outline); diff --git a/src/libslic3r/Fill/Lightning/DistanceField.hpp b/src/libslic3r/Fill/Lightning/DistanceField.hpp index 007ac235e..6e7224384 100644 --- a/src/libslic3r/Fill/Lightning/DistanceField.hpp +++ b/src/libslic3r/Fill/Lightning/DistanceField.hpp @@ -200,7 +200,7 @@ protected: } #ifdef LIGHTNING_DISTANCE_FIELD_DEBUG_OUTPUT - friend void export_distance_field_to_svg(const std::string &path, const Polygons &outline, const Polygons &overhang, const std::list<DistanceField::UnsupportedCell> &unsupported_points, const Points &points); + friend void export_distance_field_to_svg(const std::string &path, const Polygons &outline, const Polygons &overhang, const std::vector<DistanceField::UnsupportedCell> &unsupported_points, const Points &points); #endif }; diff --git a/src/libslic3r/Fill/Lightning/Generator.cpp b/src/libslic3r/Fill/Lightning/Generator.cpp index ebd3afc0e..48377f427 100644 --- a/src/libslic3r/Fill/Lightning/Generator.cpp +++ b/src/libslic3r/Fill/Lightning/Generator.cpp @@ -66,10 +66,11 @@ void Generator::generateInitialInternalOverhangs(const PrintObject &print_object if (surface.surface_type == stInternal || surface.surface_type == stInternalVoid) append(infill_area_here, to_polygons(surface.expolygon)); + infill_area_here = union_(infill_area_here); // Remove the part of the infill area that is already supported by the walls. Polygons overhang = diff(offset(infill_area_here, -float(m_wall_supporting_radius)), infill_area_above); // Filter out unprintable polygons and near degenerated polygons (three almost collinear points and so). - overhang = opening(std::move(overhang), SCALED_EPSILON, SCALED_EPSILON); + overhang = opening(overhang, SCALED_EPSILON, SCALED_EPSILON); m_overhang_per_layer[layer_nr] = overhang; infill_area_above = std::move(infill_area_here); @@ -95,6 +96,8 @@ void Generator::generateTrees(const PrintObject &print_object, const std::functi for (const Surface &surface : layerm->fill_surfaces.surfaces) if (surface.surface_type == stInternal || surface.surface_type == stInternalVoid) append(infill_outlines[layer_id], to_polygons(surface.expolygon)); + + infill_outlines[layer_id] = union_(infill_outlines[layer_id]); } // For various operations its beneficial to quickly locate nearby features on the polygon: |