Optimization in Polyline instantiation

This commit is contained in:
Alessandro Ranellucci 2013-07-05 14:29:57 +02:00
parent 27c421c27f
commit 8061cc6e30
14 changed files with 40 additions and 45 deletions

View file

@ -71,7 +71,7 @@ sub fill_surface {
$x += $m->{distance};
}
push @polygons, Slic3r::Polygon->new($p);
push @polygons, Slic3r::Polygon->new(@$p);
}
$_->rotate(-$rotate_vector->[0][0], $m->{hex_center}) for @polygons;
@ -88,7 +88,7 @@ sub fill_surface {
# consider polygons as polylines without re-appending the initial point:
# this cuts the last segment on purpose, so that the jump to the next
# path is more straight
@paths = map Slic3r::Polyline->new($_),
@paths = map Slic3r::Polyline->new(@$_),
@{ Boost::Geometry::Utils::polygon_multi_linestring_intersection(
$surface->expolygon,
\@polygons,
@ -113,7 +113,7 @@ sub fill_surface {
}
# clip paths again to prevent connection segments from crossing the expolygon boundaries
@paths = map Slic3r::Polyline->new($_),
@paths = map Slic3r::Polyline->new(@$_),
@{ Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection(
[ $surface->expolygon->offset_ex(scaled_epsilon) ],
[ @paths ],

View file

@ -33,9 +33,9 @@ sub fill_surface {
my $path = "Math::PlanePath::$1"->new;
my @n = $self->get_n($path, [ map +($_ / $distance_between_lines), @{$bounding_box->bb} ]);
my $polyline = Slic3r::Polyline->new([
my $polyline = Slic3r::Polyline->new(
map [ map {$_*$distance_between_lines} $path->n_to_xy($_) ], @n,
]);
);
return {} if !@$polyline;
$self->process_polyline($polyline, $bounding_box);