Fixed infill polygons filtering.

This commit is contained in:
Lukáš Hejl 2022-06-16 13:49:41 +02:00
parent e70aea8b30
commit 1622208249
2 changed files with 9 additions and 11 deletions

View File

@ -473,6 +473,7 @@ void PerimeterGenerator::process_arachne()
Arachne::WallToolPaths wallToolPaths(last_p, ext_perimeter_spacing, perimeter_spacing, coord_t(loop_number + 1), 0, *this->object_config, *this->print_config); Arachne::WallToolPaths wallToolPaths(last_p, ext_perimeter_spacing, perimeter_spacing, coord_t(loop_number + 1), 0, *this->object_config, *this->print_config);
std::vector<Arachne::VariableWidthLines> perimeters = wallToolPaths.getToolPaths(); std::vector<Arachne::VariableWidthLines> perimeters = wallToolPaths.getToolPaths();
loop_number = int(perimeters.size()) - 1;
int start_perimeter = int(perimeters.size()) - 1; int start_perimeter = int(perimeters.size()) - 1;
int end_perimeter = -1; int end_perimeter = -1;
@ -607,6 +608,10 @@ void PerimeterGenerator::process_arachne()
this->loops->append(extrusion_coll); this->loops->append(extrusion_coll);
ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour()); ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour());
const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing;
if (offset_ex(infill_contour, -float(spacing / 2.)).empty())
infill_contour.clear(); // Infill region is too small, so let's filter it out.
// create one more offset to be used as boundary for fill // create one more offset to be used as boundary for fill
// we offset by half the perimeter spacing (to get to the actual infill boundary) // we offset by half the perimeter spacing (to get to the actual infill boundary)
// and then we offset back and forth by half the infill spacing to only consider the // and then we offset back and forth by half the infill spacing to only consider the
@ -625,13 +630,12 @@ void PerimeterGenerator::process_arachne()
ex.simplify_p(m_scaled_resolution, &pp); ex.simplify_p(m_scaled_resolution, &pp);
// collapse too narrow infill areas // collapse too narrow infill areas
const auto min_perimeter_infill_spacing = coord_t(solid_infill_spacing * (1. - INSET_OVERLAP_TOLERANCE)); const auto min_perimeter_infill_spacing = coord_t(solid_infill_spacing * (1. - INSET_OVERLAP_TOLERANCE));
const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing;
// append infill areas to fill_surfaces // append infill areas to fill_surfaces
this->fill_surfaces->append( this->fill_surfaces->append(
offset2_ex( offset2_ex(
union_ex(pp), union_ex(pp),
float(- min_perimeter_infill_spacing / 2. - spacing / 2.), float(- min_perimeter_infill_spacing / 2.),
float(inset + min_perimeter_infill_spacing / 2. + spacing / 2.)), float(inset + min_perimeter_infill_spacing / 2.)),
stInternal); stInternal);
} }
} }

View File

@ -376,13 +376,7 @@ use Slic3r::Test;
], ],
); );
} }
# Because of Arachne and the method for detecting non-covered areas, four areas are falsely recognized as non-covered.
if ($config->perimeter_generator eq 'arachne') {
is scalar(grep { $_->area > ($iflow->scaled_width**2) } @$non_covered), 4, 'no gap between perimeters and infill';
} else {
ok !(defined first { $_->area > ($iflow->scaled_width**2) } @$non_covered), 'no gap between perimeters and infill'; ok !(defined first { $_->area > ($iflow->scaled_width**2) } @$non_covered), 'no gap between perimeters and infill';
}
} }
{ {