From be0e1a6e0bee215f88084ad9d2f268e6b58a89e5 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 25 Feb 2012 22:41:53 +0100 Subject: [PATCH] Bugfix: fill escapes perimeters. However, we keep it disabled. #139 --- lib/Slic3r/Fill/Rectilinear.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Fill/Rectilinear.pm b/lib/Slic3r/Fill/Rectilinear.pm index 990ff401c..5394e7526 100644 --- a/lib/Slic3r/Fill/Rectilinear.pm +++ b/lib/Slic3r/Fill/Rectilinear.pm @@ -59,9 +59,11 @@ sub fill_surface { ); @paths = (); + # the 1 below disables the fix for connection lines being extruded outside $expolygon + # (this happens to gears, for example). it works, but it's 30% slower with it enabled my $can_connect = $is_line_pattern ? sub { $_[X] <= (abs((($_[2][Y] - $bounding_box->[Y1])*(2 * $line_oscillation)/($bounding_box->[Y2] - $bounding_box->[Y1])) - $line_oscillation) + $distance_between_lines) && $_[Y] <= $distance_between_lines * 5 } - : sub { ($_[X] >= $distance_between_lines - epsilon) && ($_[X] <= $distance_between_lines + epsilon) && ($_[Y] <= $distance_between_lines * 5) }; + : sub { ($_[X] >= $distance_between_lines - epsilon) && ($_[X] <= $distance_between_lines + epsilon) && ($_[Y] <= $distance_between_lines * 5) && (1 || $expolygon->encloses_point(Slic3r::Line->new(@_[2,3])->midpoint)) }; foreach my $path ($collection->shortest_path) { if (@paths) { @@ -69,7 +71,7 @@ sub fill_surface { # TODO: we should also check that both points are on a fill_boundary to avoid # connecting paths on the boundaries of internal regions - if ($can_connect->(@distance, $paths[-1][-1])) { + if ($can_connect->(@distance, $paths[-1][-1], $path->points->[0])) { push @{$paths[-1]}, @{$path->points}; next; }