Fix infill_overlap and endpoints_overlap not being linked and not considering both perimeter and infill extrusion width (thus causing potential overflows). #3289

This commit is contained in:
Alessandro Ranellucci 2016-12-21 15:39:07 +01:00
parent 2708eb0bad
commit 4a25b3e8be
3 changed files with 6 additions and 10 deletions

View File

@ -283,9 +283,6 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
svg.Close(); svg.Close();
#endif #endif
// Calculate the extension of the vertical endpoints according to the configured value.
const coord_t extra_y = floor((double)min_spacing * this->endpoints_overlap + 0.5f);
// Store the number of polygons already existing in the output container. // Store the number of polygons already existing in the output container.
const size_t n_polylines_out_old = out->size(); const size_t n_polylines_out_old = out->size();
@ -313,7 +310,7 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
// Start our polyline. // Start our polyline.
Polyline polyline; Polyline polyline;
polyline.append(p); polyline.append(p);
polyline.points.back().y -= extra_y; polyline.points.back().y -= this->endpoints_overlap;
while (true) { while (true) {
// Complete the vertical line by finding the corresponding upper or lower point. // Complete the vertical line by finding the corresponding upper or lower point.
@ -331,7 +328,7 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
IntersectionPoint b = it->second; IntersectionPoint b = it->second;
assert(b.type != p.type); assert(b.type != p.type);
polyline.append(b); polyline.append(b);
polyline.points.back().y += extra_y * (b.type == IntersectionPoint::ipTypeUpper ? 1 : -1); polyline.points.back().y += this->endpoints_overlap * (b.type == IntersectionPoint::ipTypeUpper ? 1 : -1);
// Remove the two endpoints of this vertical line from the grid. // Remove the two endpoints of this vertical line from the grid.
{ {
@ -359,7 +356,7 @@ FillRectilinear::_fill_single_direction(ExPolygon expolygon,
const size_t n = polyline.points.size(); const size_t n = polyline.points.size();
polyline.append(b.next); polyline.append(b.next);
for (Points::iterator pit = polyline.points.begin()+n; pit != polyline.points.end(); ++pit) for (Points::iterator pit = polyline.points.begin()+n; pit != polyline.points.end(); ++pit)
pit->y += extra_y * (b.type == IntersectionPoint::ipTypeUpper ? 1 : -1); pit->y += this->endpoints_overlap * (b.type == IntersectionPoint::ipTypeUpper ? 1 : -1);
} }
// Is the final point still available? // Is the final point still available?

View File

@ -34,6 +34,7 @@ LayerRegion::make_fill()
const Flow infill_flow = this->flow(frInfill); const Flow infill_flow = this->flow(frInfill);
const Flow solid_infill_flow = this->flow(frSolidInfill); const Flow solid_infill_flow = this->flow(frSolidInfill);
const Flow top_solid_infill_flow = this->flow(frTopSolidInfill); const Flow top_solid_infill_flow = this->flow(frTopSolidInfill);
const coord_t perimeter_spacing = this->flow(frPerimeter).scaled_spacing();
SurfaceCollection surfaces; SurfaceCollection surfaces;
@ -215,6 +216,8 @@ LayerRegion::make_fill()
} else { } else {
f->spacing = flow.spacing(); f->spacing = flow.spacing();
} }
f->endpoints_overlap = this->region()->config.get_abs_value("infill_overlap",
(perimeter_spacing + scale_(f->spacing))/2);
f->layer_id = this->layer()->id(); f->layer_id = this->layer()->id();
f->z = this->layer()->print_z; f->z = this->layer()->print_z;

View File

@ -298,10 +298,6 @@ PerimeterGenerator::process()
inset += pspacing/2; inset += pspacing/2;
} }
// only apply infill overlap if we actually have one perimeter
if (inset > 0)
inset -= this->config->get_abs_value("infill_overlap", inset + ispacing/2);
{ {
ExPolygons expp = union_ex(last); ExPolygons expp = union_ex(last);