Make rounded corners for skirt
This commit is contained in:
parent
5fec13353c
commit
f892fde123
@ -98,16 +98,13 @@ sub make_perimeter {
|
||||
if ($layer->id == 0 && $Slic3r::skirts > 0) {
|
||||
# find out convex hull
|
||||
my $points = [ map { @{ $_->mgp_polygon->polygons->[0] } } @{ $layer->surfaces } ];
|
||||
my $convex_hull = $self->_mgp_from_points_ref($points)->convexhull2;
|
||||
my $convex_hull_polygon = ref $convex_hull eq 'ARRAY'
|
||||
? $self->_mgp_from_points_ref($convex_hull)
|
||||
: $convex_hull;
|
||||
my $convex_hull = $self->_mgp_from_points_ref($points)->convexhull2; # maybe Math::ConvexHull is faster?
|
||||
my $convex_hull_points = ref $convex_hull eq 'ARRAY' ? $convex_hull : $convex_hull->points;
|
||||
|
||||
# draw outlines from outside to inside
|
||||
for (my $i = $Slic3r::skirts - 1; $i >= 0; $i--) {
|
||||
my $outline = $convex_hull_polygon->offset_polygon(
|
||||
- ($Slic3r::skirt_distance + ($Slic3r::flow_width * $i)) / $Slic3r::resolution
|
||||
);
|
||||
my $distance = ($Slic3r::skirt_distance + ($Slic3r::flow_width * $i)) / $Slic3r::resolution;
|
||||
my $outline = offset([$convex_hull_points], $distance, 0.1, JT_ROUND);
|
||||
push @{$outline->[0]}, $outline->[0][0]; # repeat first point as last to complete the loop
|
||||
push @{ $layer->skirts }, Slic3r::ExtrusionPath->cast([ @{$outline->[0]} ]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user