mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Isolate narrow regions in internal solid surfaces for non-line infill patterns (#12107)
This commit is contained in:
@@ -599,16 +599,34 @@ void split_solid_surface(size_t layer_id, const SurfaceFill &fill, ExPolygons &n
|
||||
{
|
||||
assert(fill.surface.surface_type == stInternalSolid);
|
||||
|
||||
switch (fill.params.pattern) {
|
||||
case ipRectilinear:
|
||||
case ipMonotonic:
|
||||
case ipMonotonicLine:
|
||||
case ipAlignedRectilinear:
|
||||
// Only support straight line based infill
|
||||
break;
|
||||
const bool line_based_pattern =
|
||||
fill.params.pattern == ipRectilinear || fill.params.pattern == ipMonotonic ||
|
||||
fill.params.pattern == ipMonotonicLine || fill.params.pattern == ipAlignedRectilinear;
|
||||
|
||||
// ORCA: For non-line patterns, split by a geometric "core" so only thin areas get rerouted.
|
||||
if (!line_based_pattern) {
|
||||
const coord_t scaled_spacing = scaled<coord_t>(fill.params.spacing);
|
||||
|
||||
for (const ExPolygon &expolygon : fill.expolygons) {
|
||||
Polygons filled_area = to_polygons(expolygon);
|
||||
|
||||
// "Core" area: open (erode+dilate) to drop thin features, then clamp back to the original polygon.
|
||||
Polygons inner_area = intersection(filled_area, opening(filled_area, scaled_spacing, scaled_spacing));
|
||||
|
||||
if (inner_area.empty()) {
|
||||
narrow_infill.emplace_back(expolygon);
|
||||
continue;
|
||||
}
|
||||
|
||||
ExPolygons inner_ex = union_ex(inner_area);
|
||||
ExPolygons expolys{expolygon};
|
||||
ExPolygons narrow_ex = diff_ex(expolys, inner_ex);
|
||||
ExPolygons normal_ex = intersection_ex(expolys, inner_ex);
|
||||
|
||||
append(normal_infill, normal_ex); // normal infill area
|
||||
append(narrow_infill, narrow_ex); // narrow infill area
|
||||
}
|
||||
|
||||
default:
|
||||
// For all other types, don't split
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user