From f892fde123588f9ee0b3c206238a8094564eb2ef Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 25 Sep 2011 20:24:14 +0200 Subject: [PATCH] Make rounded corners for skirt --- lib/Slic3r/Perimeter.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/Perimeter.pm b/lib/Slic3r/Perimeter.pm index 2e15c6139..723a9b1b0 100644 --- a/lib/Slic3r/Perimeter.pm +++ b/lib/Slic3r/Perimeter.pm @@ -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]} ]); }