From 7d6545dd070b9e563d0b4f04a87ed6cdbf706977 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 17 Jun 2012 19:09:11 +0200 Subject: [PATCH] Further simplification of point_in_polygon() --- lib/Slic3r/Geometry.pm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r/Geometry.pm b/lib/Slic3r/Geometry.pm index 130f791fd..7d473a0d9 100644 --- a/lib/Slic3r/Geometry.pm +++ b/lib/Slic3r/Geometry.pm @@ -155,12 +155,8 @@ sub point_in_polygon { my ($x, $y) = @$point; my $n = @$polygon; - my @x; - my @y; - foreach (0..$n-1) { - push @x, $polygon->[$_]->[X]; - push @y, $polygon->[$_]->[Y]; - } + my @x = map $_->[X], @$polygon; + my @y = map $_->[Y], @$polygon; # Derived from the comp.graphics.algorithms FAQ, # courtesy of Wm. Randolph Franklin