From 311df8ecfd93803bd51e6c2fa706a7e3d90bb338 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 7 Mar 2019 16:01:46 +0100 Subject: [PATCH] Reworked discretization step of Archimedean Chords infill to lower slicing time and memory requirements. Fixes "Infill pattern Archimedean causing total freeze at Infilling patterns" #1871 --- src/libslic3r/Fill/FillPlanePath.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Fill/FillPlanePath.cpp b/src/libslic3r/Fill/FillPlanePath.cpp index 615cc6efe..c52353b02 100644 --- a/src/libslic3r/Fill/FillPlanePath.cpp +++ b/src/libslic3r/Fill/FillPlanePath.cpp @@ -15,7 +15,7 @@ void FillPlanePath::_fill_surface_single( { expolygon.rotate(- direction.first); - coord_t distance_between_lines = scale_(this->spacing) / params.density; + coord_t distance_between_lines = coord_t(scale_(this->spacing) / params.density); // align infill across layers using the object's bounding box // Rotated bounding box of the whole object. @@ -89,7 +89,8 @@ Pointfs FillArchimedeanChords::_generate(coord_t min_x, coord_t min_y, coord_t m out.push_back(Vec2d(0, 0)); out.push_back(Vec2d(1, 0)); while (r < rmax) { - theta += 1. / r; + // Discretization angle to achieve a discretization error lower than RESOLUTION. + theta += 2. * acos(1. - RESOLUTION / r); r = a + b * theta; out.push_back(Vec2d(r * cos(theta), r * sin(theta))); }