mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 00:55:54 +08:00
Support material: refactoring
This commit is contained in:
parent
a24ffee2aa
commit
cc695c6c22
@ -295,6 +295,7 @@ sub polygon_has_vertex {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# polygon must be simple (non complex) and ccw
|
||||||
sub polygon_is_convex {
|
sub polygon_is_convex {
|
||||||
my ($points) = @_;
|
my ($points) = @_;
|
||||||
for (my $i = 0; $i <= $#$points; $i++) {
|
for (my $i = 0; $i <= $#$points; $i++) {
|
||||||
|
@ -496,27 +496,36 @@ sub generate_support_material {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
# now apply the pattern to layers below unsupported surfaces
|
# now determine where to apply the pattern below unsupported surfaces
|
||||||
my (@a, @b) = ();
|
my %layers = ();
|
||||||
for (my $i = $#{$self->layers}; $i >=0; $i--) {
|
{
|
||||||
my $layer = $self->layers->[$i];
|
my (@a, @b) = ();
|
||||||
my @c = ();
|
for (my $i = $#{$self->layers}; $i >=0; $i--) {
|
||||||
if (@b) {
|
my $layer = $self->layers->[$i];
|
||||||
@c = @{diff_ex(
|
my @c = ();
|
||||||
[ map @$_, @b ],
|
if (@b) {
|
||||||
[ map @$_, map $_->expolygon->offset_ex(scale $Slic3r::flow_width), @{$layer->slices} ],
|
@c = @{diff_ex(
|
||||||
)};
|
[ map @$_, @b ],
|
||||||
$layer->support_fills(Slic3r::ExtrusionPath::Collection->new);
|
[ map @$_, map $_->expolygon->offset_ex(scale $Slic3r::flow_width), @{$layer->slices} ],
|
||||||
foreach my $expolygon (@c) {
|
)};
|
||||||
push @{$layer->support_fills->paths}, map $_->clip_with_expolygon($expolygon),
|
$layers{$i} = [@c];
|
||||||
map $_->clip_with_polygon($expolygon->bounding_box_polygon), @$support_pattern;
|
|
||||||
}
|
}
|
||||||
|
@b = @{union_ex([ map @$_, @c, @a ])};
|
||||||
|
@a = map $_->expolygon->offset_ex(scale 2),
|
||||||
|
grep $_->surface_type eq 'bottom' && !defined $_->bridge_angle,
|
||||||
|
@{$layer->slices};
|
||||||
|
$_->simplify(scale $Slic3r::flow_spacing * 3) for @a;
|
||||||
}
|
}
|
||||||
@b = @{union_ex([ map @$_, @c, @a ])};
|
}
|
||||||
@a = map $_->expolygon->offset_ex(scale 2),
|
|
||||||
grep $_->surface_type eq 'bottom' && !defined $_->bridge_angle,
|
# apply the pattern to layers
|
||||||
@{$layer->slices};
|
foreach my $layer_id (keys %layers) {
|
||||||
$_->simplify(scale $Slic3r::flow_spacing * 3) for @a;
|
my $layer = $self->layers->[$layer_id];
|
||||||
|
$layer->support_fills(Slic3r::ExtrusionPath::Collection->new);
|
||||||
|
foreach my $expolygon (@{ $layers{$layer_id} }) {
|
||||||
|
push @{$layer->support_fills->paths}, map $_->clip_with_expolygon($expolygon),
|
||||||
|
map $_->clip_with_polygon($expolygon->bounding_box_polygon), @$support_pattern;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user