Completely removed Bounded Rectilinear infill

Improved bridge over sparse infill logic - now does not bridge the whole area but only neede part
Filtered out tiny regions of ensuring created after bridge_over_sparse infill expanded the regions
This commit is contained in:
PavelMikus 2023-03-01 16:42:57 +01:00
parent b90e8eb6ec
commit a3430a5b51
6 changed files with 28 additions and 71 deletions

View file

@ -14,8 +14,6 @@ ThickPolylines FillEnsuring::fill_surface_arachne(const Surface *surface, const
assert(this->print_config != nullptr && this->print_object_config != nullptr && this->print_region_config != nullptr);
const coord_t scaled_spacing = scaled<coord_t>(this->spacing);
const EnsuringInfillPattern infill_patter = this->print_object_config->ensure_vertical_shell_infill;
const bool is_bounded_rectilinear = infill_patter == EnsuringInfillPattern::eipBoundedRectilinear;
// Perform offset.
Slic3r::ExPolygons expp = this->overlap != 0. ? offset_ex(surface->expolygon, scaled<float>(this->overlap)) : ExPolygons{surface->expolygon};
@ -23,7 +21,7 @@ ThickPolylines FillEnsuring::fill_surface_arachne(const Surface *surface, const
ThickPolylines thick_polylines_out;
for (ExPolygon &ex_poly : expp) {
Point bbox_size = ex_poly.contour.bounding_box().size();
coord_t loops_count = is_bounded_rectilinear ? 1 : std::max(bbox_size.x(), bbox_size.y()) / scaled_spacing + 1;
coord_t loops_count = std::max(bbox_size.x(), bbox_size.y()) / scaled_spacing + 1;
Polygons polygons = to_polygons(ex_poly);
Arachne::WallToolPaths wall_tool_paths(polygons, scaled_spacing, scaled_spacing, loops_count, 0, params.layer_height, *this->print_object_config, *this->print_config);
if (std::vector<Arachne::VariableWidthLines> loops = wall_tool_paths.getToolPaths(); !loops.empty()) {
@ -77,28 +75,6 @@ ThickPolylines FillEnsuring::fill_surface_arachne(const Surface *surface, const
if (j < thick_polylines_out.size())
thick_polylines_out.erase(thick_polylines_out.begin() + int(j), thick_polylines_out.end());
}
if (is_bounded_rectilinear) {
// Remaining infill area will be filled with classic Rectilinear infill.
ExPolygons infill_contour = union_ex(wall_tool_paths.getInnerContour());
if (offset_ex(infill_contour, -float(scaled_spacing / 2.)).empty())
infill_contour.clear(); // Infill region is too small, so let's filter it out.
Polygons pp;
for (ExPolygon &ex : infill_contour)
ex.simplify_p(scaled<double>(params.resolution), &pp);
// Collapse too narrow infill areas and append them to thick_polylines_out.
const auto min_perimeter_infill_spacing = coord_t(scaled_spacing * (1. - INSET_OVERLAP_TOLERANCE));
const auto infill_overlap = coord_t(scale_(this->print_region_config->get_abs_value("infill_overlap", this->spacing)));
for (ExPolygon &ex_poly : offset2_ex(union_ex(pp), float(-min_perimeter_infill_spacing / 2.), float(infill_overlap + min_perimeter_infill_spacing / 2.))) {
Polylines polylines;
if (Surface new_surface(*surface, std::move(ex_poly)); !fill_surface_by_lines(&new_surface, params, 0.f, 0.f, polylines))
BOOST_LOG_TRIVIAL(error) << "FillBoundedRectilinear::fill_surface() failed to fill a region.";
append(thick_polylines_out, to_thick_polylines(std::move(polylines), scaled<coord_t>(this->spacing)));
}
} else
assert(infill_patter == EnsuringInfillPattern::eipConcentric);
}
return thick_polylines_out;