Many fixes to the bridge direction detection algorithm and other things. #58

This commit is contained in:
Alessandro Ranellucci 2011-12-03 18:31:31 +01:00
parent 792960aae1
commit 4fe340cc56
7 changed files with 93 additions and 70 deletions

View file

@ -2,7 +2,7 @@ package Slic3r::Perimeter;
use Moo;
use Math::Clipper ':all';
use Slic3r::Geometry qw(X Y shortest_path);
use Slic3r::Geometry qw(X Y shortest_path scale);
use XXX;
sub make_perimeter {
@ -30,13 +30,13 @@ sub make_perimeter {
# organize perimeter surfaces using a shortest path search
my @surfaces = @{shortest_path([
map [ $_->contour->points->[0], $_ ], @{$layer->surfaces},
map [ $_->contour->points->[0], $_ ], @{$layer->slices},
])};
foreach my $surface (@surfaces) {
# the outer loop must be offsetted by half extrusion width inwards
my @last_offsets = ($surface->expolygon);
my $distance = $Slic3r::flow_width / 2 / $Slic3r::resolution;
my $distance = scale $Slic3r::flow_width / 2;
# create other offsets
push @perimeters, [];
@ -51,7 +51,7 @@ sub make_perimeter {
# create one more offset to be used as boundary for fill
{
$distance -= $Slic3r::flow_width * $Slic3r::perimeter_infill_overlap_ratio / $Slic3r::resolution;
$distance -= scale $Slic3r::flow_width * $Slic3r::perimeter_infill_overlap_ratio;
my @fill_boundaries = map Slic3r::Surface->cast_from_expolygon
($_, surface_type => $surface->surface_type),
map $_->offset_ex(-$distance), @last_offsets;