mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
Minor tidying
This commit is contained in:
parent
09684c67c2
commit
8607c559c7
1 changed files with 8 additions and 11 deletions
|
@ -346,11 +346,11 @@ sub detect_surfaces_type {
|
||||||
Slic3r::debugf "Detecting solid surfaces...\n";
|
Slic3r::debugf "Detecting solid surfaces...\n";
|
||||||
|
|
||||||
# prepare a reusable subroutine to make surface differences
|
# prepare a reusable subroutine to make surface differences
|
||||||
my $surface_difference = sub {
|
my $difference = sub {
|
||||||
my ($subject_surfaces, $clip_surfaces, $result_type, $layerm) = @_;
|
my ($subject, $clip, $result_type) = @_;
|
||||||
my $expolygons = diff_ex(
|
my $expolygons = diff_ex(
|
||||||
[ map @$_, @$subject_surfaces ],
|
[ map @$_, @$subject ],
|
||||||
[ map @$_, @$clip_surfaces ],
|
[ map @$_, @$clip ],
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
return map Slic3r::Surface->new(expolygon => $_, surface_type => $result_type),
|
return map Slic3r::Surface->new(expolygon => $_, surface_type => $result_type),
|
||||||
|
@ -370,11 +370,10 @@ sub detect_surfaces_type {
|
||||||
# find top surfaces (difference between current surfaces
|
# find top surfaces (difference between current surfaces
|
||||||
# of current layer and upper one)
|
# of current layer and upper one)
|
||||||
if ($upper_layer) {
|
if ($upper_layer) {
|
||||||
@top = $surface_difference->(
|
@top = $difference->(
|
||||||
[ map $_->expolygon, @{$layerm->slices} ],
|
[ map $_->expolygon, @{$layerm->slices} ],
|
||||||
$upper_layer->slices,
|
$upper_layer->slices,
|
||||||
S_TYPE_TOP,
|
S_TYPE_TOP,
|
||||||
$layerm,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
# if no upper layer, all surfaces of this one are solid
|
# if no upper layer, all surfaces of this one are solid
|
||||||
|
@ -387,11 +386,10 @@ sub detect_surfaces_type {
|
||||||
# of current layer and lower one)
|
# of current layer and lower one)
|
||||||
if ($lower_layer) {
|
if ($lower_layer) {
|
||||||
# lower layer's slices are already Surface objects
|
# lower layer's slices are already Surface objects
|
||||||
@bottom = $surface_difference->(
|
@bottom = $difference->(
|
||||||
[ map $_->expolygon, @{$layerm->slices} ],
|
[ map $_->expolygon, @{$layerm->slices} ],
|
||||||
$lower_layer->slices,
|
$lower_layer->slices,
|
||||||
S_TYPE_BOTTOM,
|
S_TYPE_BOTTOM,
|
||||||
$layerm,
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
# if no lower layer, all surfaces of this one are solid
|
# if no lower layer, all surfaces of this one are solid
|
||||||
|
@ -406,15 +404,14 @@ sub detect_surfaces_type {
|
||||||
if (@top && @bottom) {
|
if (@top && @bottom) {
|
||||||
my $overlapping = intersection_ex([ map $_->p, @top ], [ map $_->p, @bottom ]);
|
my $overlapping = intersection_ex([ map $_->p, @top ], [ map $_->p, @bottom ]);
|
||||||
Slic3r::debugf " layer %d contains %d membrane(s)\n", $layerm->id, scalar(@$overlapping);
|
Slic3r::debugf " layer %d contains %d membrane(s)\n", $layerm->id, scalar(@$overlapping);
|
||||||
@top = $surface_difference->([map $_->expolygon, @top], $overlapping, S_TYPE_TOP, $layerm);
|
@top = $difference->([map $_->expolygon, @top], $overlapping, S_TYPE_TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
# find internal surfaces (difference between top/bottom surfaces and others)
|
# find internal surfaces (difference between top/bottom surfaces and others)
|
||||||
@internal = $surface_difference->(
|
@internal = $difference->(
|
||||||
[ map $_->expolygon, @{$layerm->slices} ],
|
[ map $_->expolygon, @{$layerm->slices} ],
|
||||||
[ map $_->expolygon, @top, @bottom ],
|
[ map $_->expolygon, @top, @bottom ],
|
||||||
S_TYPE_INTERNAL,
|
S_TYPE_INTERNAL,
|
||||||
$layerm,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
# save surfaces to layer
|
# save surfaces to layer
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue