SPE-1820 Fix missing solid infill in thin parts by improving the ensuring filtering

This commit is contained in:
Pavel 2023-07-31 10:00:47 +02:00 committed by Pavel Mikuš
parent eacffe0a57
commit b6ed64428a

View File

@ -1539,21 +1539,33 @@ void PrintObject::discover_vertical_shells()
// Finally expand the infill a bit to remove tiny gaps between solid infill and the other regions. // Finally expand the infill a bit to remove tiny gaps between solid infill and the other regions.
narrow_sparse_infill_region_radius - tiny_overlap_radius, ClipperLib::jtSquare); narrow_sparse_infill_region_radius - tiny_overlap_radius, ClipperLib::jtSquare);
Polygons object_volume;
Polygons internal_volume; Polygons internal_volume;
{ {
Polygons shrinked_bottom_slice = idx_layer > 0 ? to_polygons(m_layers[idx_layer - 1]->lslices) : Polygons{}; Polygons shrinked_bottom_slice = idx_layer > 0 ? to_polygons(m_layers[idx_layer - 1]->lslices) : Polygons{};
Polygons shrinked_upper_slice = (idx_layer + 1) < m_layers.size() ? Polygons shrinked_upper_slice = (idx_layer + 1) < m_layers.size() ?
to_polygons(m_layers[idx_layer + 1]->lslices) : to_polygons(m_layers[idx_layer + 1]->lslices) :
Polygons{}; Polygons{};
internal_volume = intersection(shrinked_bottom_slice, shrinked_upper_slice); object_volume = intersection(shrinked_bottom_slice, shrinked_upper_slice);
internal_volume = closing(polygonsInternal, SCALED_EPSILON);
} }
// The opening operation may cause scattered tiny drops on the smooth parts of the model, filter them out // The regularization operation may cause scattered tiny drops on the smooth parts of the model, filter them out
// If the region checks both following conditions, it is removed:
// 1. the area is very small,
// OR the area is quite small and it is fully wrapped in model (not visible)
// the in-model condition is there due to small sloping surfaces, e.g. top of the hull of the benchy
// 2. the area does not fully cover an internal polygon
// This is there mainly for a very thin parts, where the solid layers would be missing if the part area is quite small
regularized_shell.erase(std::remove_if(regularized_shell.begin(), regularized_shell.end(), regularized_shell.erase(std::remove_if(regularized_shell.begin(), regularized_shell.end(),
[&min_perimeter_infill_spacing, &internal_volume](const ExPolygon &p) { [&internal_volume, &min_perimeter_infill_spacing,
return p.area() < min_perimeter_infill_spacing * scaled(1.5) || &object_volume](const ExPolygon &p) {
(p.area() < min_perimeter_infill_spacing * scaled(8.0) && return (p.area() < min_perimeter_infill_spacing * scaled(1.5) ||
diff(to_polygons(p), internal_volume).empty()); (p.area() < min_perimeter_infill_spacing * scaled(8.0) &&
diff(to_polygons(p), object_volume).empty())) &&
diff(internal_volume,
expand(to_polygons(p), min_perimeter_infill_spacing))
.size() >= internal_volume.size();
}), }),
regularized_shell.end()); regularized_shell.end());
} }