Fix connection algorithm for rectilinear infill as sometimes it wasn't connecting segments correctly

This commit is contained in:
Alessandro Ranellucci 2013-06-16 18:05:56 +02:00
parent 0ad78eaf55
commit 45611d6742

View File

@ -78,13 +78,13 @@ sub fill_surface {
@paths = (); @paths = ();
my $tolerance = 10 * scaled_epsilon; my $tolerance = 10 * scaled_epsilon;
my $diagonal_distance = $distance_between_lines * 5; my $diagonal_distance = $distance_between_lines * 2;
my $can_connect = $is_line_pattern my $can_connect = $is_line_pattern
? sub { ? sub {
($_[X] >= ($distance_between_lines - $line_oscillation) - $tolerance) && ($_[X] <= ($distance_between_lines + $line_oscillation) + $tolerance) ($_[X] >= ($distance_between_lines - $line_oscillation) - $tolerance) && ($_[X] <= ($distance_between_lines + $line_oscillation) + $tolerance)
&& $_[Y] <= $diagonal_distance && $_[Y] <= $diagonal_distance
} }
: sub { abs($_[X] - $distance_between_lines) <= $tolerance && $_[Y] <= $diagonal_distance }; : sub { $_[X] <= $diagonal_distance && $_[Y] <= $diagonal_distance };
foreach my $path ($collection->chained_path) { foreach my $path ($collection->chained_path) {
if (@paths) { if (@paths) {