From caf20664cd72919996798643cceb8d04b4191995 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 19 Apr 2014 01:26:21 +0200 Subject: [PATCH] Bugfix: ExPolygon::contains_line() was called with a Polyline object but didn't throw any error. Thanks ledvinap #1945 --- lib/Slic3r/GCode/MotionPlanner.pm | 4 ++-- lib/Slic3r/Line.pm | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/GCode/MotionPlanner.pm b/lib/Slic3r/GCode/MotionPlanner.pm index 1a433816c..823e6641d 100644 --- a/lib/Slic3r/GCode/MotionPlanner.pm +++ b/lib/Slic3r/GCode/MotionPlanner.pm @@ -175,13 +175,13 @@ sub _add_point_to_space { # find candidates by checking visibility from $from to them foreach my $idx (0..$#{$space->nodes}) { - my $line = Slic3r::Polyline->new($point, $space->nodes->[$idx]); + my $line = Slic3r::Line->new($point, $space->nodes->[$idx]); # if $point is inside an island, it is visible from $idx when island contains their line # if $point is outside an island, it is visible from $idx when their line does not cross any island if ( ($inside && defined first { $_->contains_line($line) } @{$self->_inner}) || (!$inside && !@{intersection_pl( - [ $line ], + [ $line->as_polyline ], [ map @$_, @{$self->islands} ], )}) ) { diff --git a/lib/Slic3r/Line.pm b/lib/Slic3r/Line.pm index a50e7064e..952ee8b6b 100644 --- a/lib/Slic3r/Line.pm +++ b/lib/Slic3r/Line.pm @@ -18,4 +18,9 @@ sub grow { return Slic3r::Polyline->new(@$self)->grow(@_); } +sub as_polyline { + my ($self) = @_; + return Slic3r::Polyline->new(@$self); +} + 1;