From 928c4741c279797010f80ae48b4965d53caac3e8 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 8 Nov 2013 11:35:02 +0100 Subject: [PATCH] Fix regression in t/shells.t due to things ported to XS --- lib/Slic3r/ExPolygon.pm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/ExPolygon.pm b/lib/Slic3r/ExPolygon.pm index cad94b491..3e8d91713 100644 --- a/lib/Slic3r/ExPolygon.pm +++ b/lib/Slic3r/ExPolygon.pm @@ -237,17 +237,15 @@ sub _medial_axis_voronoi { next unless @$polyline >= 2; # now replace point indexes with coordinates - @$polyline = map $vertices->[$_], @$polyline; + my @points = map Slic3r::Point->new(@{$vertices->[$_]}), @$polyline; - # cleanup - $polyline = Slic3r::Geometry::douglas_peucker($polyline, $width / 7); - - if ($polyline->[0][X] == $polyline->[-1][X] && $polyline->[0][Y] == $polyline->[-1][Y]) { - next if @$polyline == 2; - push @result, Slic3r::Polygon->new(@$polyline[0..$#$polyline-1]); + if ($points[0]->coincides_with($points[-1])) { + next if @points == 2; + push @result, Slic3r::Polygon->new(@points[0..$#points-1]); } else { - push @result, Slic3r::Polyline->new(@$polyline); + push @result, Slic3r::Polyline->new(@points); } + $result[-1]->simplify($width / 7); } return @result;