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
This commit is contained in:
bubnikv 2019-03-07 16:01:46 +01:00
parent ef3482a427
commit 311df8ecfd

View File

@ -15,7 +15,7 @@ void FillPlanePath::_fill_surface_single(
{ {
expolygon.rotate(- direction.first); 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 // align infill across layers using the object's bounding box
// Rotated bounding box of the whole object. // 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(0, 0));
out.push_back(Vec2d(1, 0)); out.push_back(Vec2d(1, 0));
while (r < rmax) { 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; r = a + b * theta;
out.push_back(Vec2d(r * cos(theta), r * sin(theta))); out.push_back(Vec2d(r * cos(theta), r * sin(theta)));
} }