Optimization
This commit is contained in:
parent
4dd12b57a1
commit
f104659020
1 changed files with 12 additions and 12 deletions
|
@ -589,7 +589,7 @@ sub discover_horizontal_shells {
|
||||||
# not work in some situations, as there won't be any grown region in the perimeter
|
# not work in some situations, as there won't be any grown region in the perimeter
|
||||||
# area (this was seen in a model where the top layer had one extra perimeter, thus
|
# area (this was seen in a model where the top layer had one extra perimeter, thus
|
||||||
# its fill_surfaces was thinner than the lower layer's infill)
|
# its fill_surfaces was thinner than the lower layer's infill)
|
||||||
my $solid = offset_ex([ map $_->p, @{$layerm->slices->filter_by_type($type)} ], $margin);
|
my $solid = offset([ map $_->p, @{$layerm->slices->filter_by_type($type)} ], $margin);
|
||||||
next if !@$solid;
|
next if !@$solid;
|
||||||
Slic3r::debugf "Layer %d has %s surfaces\n", $i, ($type == S_TYPE_TOP) ? 'top' : 'bottom';
|
Slic3r::debugf "Layer %d has %s surfaces\n", $i, ($type == S_TYPE_TOP) ? 'top' : 'bottom';
|
||||||
|
|
||||||
|
@ -614,8 +614,8 @@ sub discover_horizontal_shells {
|
||||||
# shells to be generated in the base but not in the walls (where there are many
|
# shells to be generated in the base but not in the walls (where there are many
|
||||||
# narrow bottom surfaces): reassigning $solid will consider the 'shadow' of the
|
# narrow bottom surfaces): reassigning $solid will consider the 'shadow' of the
|
||||||
# upper perimeter as an obstacle and shell will not be propagated to more upper layers
|
# upper perimeter as an obstacle and shell will not be propagated to more upper layers
|
||||||
my $new_internal_solid = $solid = intersection_ex(
|
my $new_internal_solid = $solid = intersection(
|
||||||
[ map @$_, @$solid ],
|
$solid,
|
||||||
[ map $_->p, grep { ($_->surface_type == S_TYPE_INTERNAL) || ($_->surface_type == S_TYPE_INTERNALSOLID) } @neighbor_fill_surfaces ],
|
[ map $_->p, grep { ($_->surface_type == S_TYPE_INTERNAL) || ($_->surface_type == S_TYPE_INTERNALSOLID) } @neighbor_fill_surfaces ],
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
@ -630,9 +630,9 @@ sub discover_horizontal_shells {
|
||||||
# would have a different shape from the external surface and we'd still
|
# would have a different shape from the external surface and we'd still
|
||||||
# have the same angle, so the next shell would be grown even more and so on.
|
# have the same angle, so the next shell would be grown even more and so on.
|
||||||
my $margin = 3 * $layerm->solid_infill_flow->scaled_width; # require at least this size
|
my $margin = 3 * $layerm->solid_infill_flow->scaled_width; # require at least this size
|
||||||
my $too_narrow = diff_ex(
|
my $too_narrow = diff(
|
||||||
[ map @$_, @$new_internal_solid ],
|
$new_internal_solid,
|
||||||
offset2([ map @$_, @$new_internal_solid ], -$margin, +$margin, CLIPPER_OFFSET_SCALE, JT_MITER, 5),
|
offset2($new_internal_solid, -$margin, +$margin, CLIPPER_OFFSET_SCALE, JT_MITER, 5),
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -645,15 +645,15 @@ sub discover_horizontal_shells {
|
||||||
|
|
||||||
# make sure our grown surfaces don't exceed the fill area
|
# make sure our grown surfaces don't exceed the fill area
|
||||||
my @grown = @{intersection(
|
my @grown = @{intersection(
|
||||||
offset([ map @$_, @$too_narrow ], +$margin),
|
offset($too_narrow, +$margin),
|
||||||
[ map $_->p, @neighbor_fill_surfaces ],
|
[ map $_->p, @neighbor_fill_surfaces ],
|
||||||
)};
|
)};
|
||||||
$new_internal_solid = $solid = union_ex([ @grown, (map @$_, @$new_internal_solid) ]);
|
$new_internal_solid = $solid = union([ @grown, @$new_internal_solid ]);
|
||||||
} else {
|
} else {
|
||||||
# if we're printing a hollow object, we discard such small parts
|
# if we're printing a hollow object, we discard such small parts
|
||||||
$new_internal_solid = $solid = diff_ex(
|
$new_internal_solid = $solid = diff(
|
||||||
[ map @$_, @$new_internal_solid ],
|
$new_internal_solid,
|
||||||
[ map @$_, @$too_narrow ],
|
$too_narrow,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -663,7 +663,7 @@ sub discover_horizontal_shells {
|
||||||
# and new ones
|
# and new ones
|
||||||
my $internal_solid = union_ex([
|
my $internal_solid = union_ex([
|
||||||
( map $_->p, grep $_->surface_type == S_TYPE_INTERNALSOLID, @neighbor_fill_surfaces ),
|
( map $_->p, grep $_->surface_type == S_TYPE_INTERNALSOLID, @neighbor_fill_surfaces ),
|
||||||
( map @$_, @$new_internal_solid ),
|
@$new_internal_solid,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# subtract intersections from layer surfaces to get resulting internal surfaces
|
# subtract intersections from layer surfaces to get resulting internal surfaces
|
||||||
|
|
Loading…
Reference in a new issue