diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-09-05 15:33:09 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-09-05 15:33:09 +0400 |
commit | 5595839b31919fbf6d2b98e57f05c2ecee506980 (patch) | |
tree | 88fb194d53f7782f7e87d69bdf0975894575dbcb /lib/Slic3r/Fill | |
parent | 778e4f6ffa1ec29224c86b7c93e61603c25464d6 (diff) |
Command line interface
Diffstat (limited to 'lib/Slic3r/Fill')
-rw-r--r-- | lib/Slic3r/Fill/Rectilinear.pm | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/Slic3r/Fill/Rectilinear.pm b/lib/Slic3r/Fill/Rectilinear.pm index 4e3be8072..0edd89f94 100644 --- a/lib/Slic3r/Fill/Rectilinear.pm +++ b/lib/Slic3r/Fill/Rectilinear.pm @@ -18,10 +18,9 @@ sub make_fill { # let's alternate fill direction my @axes = $layer->id % 2 == 0 ? (0,1) : (1,0); - printf " primary axis: %d\n", $axes[0]; foreach my $surface (@{ $layer->fill_surfaces }) { - printf " Processing surface %s:\n", $surface->id; + Slic3r::debugf " Processing surface %s:\n", $surface->id; my $polygon = $surface->mgp_polygon; # rotate surface as needed @@ -34,10 +33,6 @@ sub make_fill { my $distance_between_lines = $Slic3r::flow_width / $Slic3r::resolution / $density; my $number_of_lines = ($axes[0] == 0 ? $print->x_length : $print->y_length) / $distance_between_lines; - #printf "distance_between_lines = %f\n", $distance_between_lines; - #printf "number_of_lines = %d\n", $number_of_lines; - #printf "axes = %d, %d\n", @axes; - # this arrayref will hold intersection points of the fill grid with surface segments my $points = [ map [], 0..$number_of_lines-1 ]; foreach my $line (map $self->_lines_from_mgp_points($_), @{ $polygon->polygons }) { @@ -49,7 +44,7 @@ sub make_fill { # find out the coordinates my @coordinates = map @$_, @$line; - printf "Segment %d,%d - %d,%d\n", @coordinates; + Slic3r::debugf "Segment %d,%d - %d,%d\n", @coordinates; # get the extents of the segment along the primary axis my @line_c = sort ($coordinates[X1], $coordinates[X2]); @@ -59,15 +54,15 @@ sub make_fill { # if the segment is parallel to our ray, there will be two intersection points if ($line_c[0] == $line_c[1]) { - printf " Segment is parallel!\n"; + Slic3r::debugf " Segment is parallel!\n"; push @{ $points->[$i] }, $coordinates[Y1], $coordinates[Y2]; - printf " intersections at %f (%d) = %f, %f\n", $c, $i, $points->[$i][-2], $points->[$i][-1]; + Slic3r::debugf " intersections at %f (%d) = %f, %f\n", $c, $i, $points->[$i][-2], $points->[$i][-1]; } else { - printf " Segment NOT parallel!\n"; + Slic3r::debugf " Segment NOT parallel!\n"; # one point of intersection push @{ $points->[$i] }, $coordinates[Y1] + ($coordinates[Y2] - $coordinates[Y1]) * ($c - $coordinates[X1]) / ($coordinates[X2] - $coordinates[X1]); - printf " intersection at %f (%d) = %f\n", $c, $i, $points->[$i][-1]; + Slic3r::debugf " intersection at %f (%d) = %f\n", $c, $i, $points->[$i][-1]; } } } @@ -102,13 +97,13 @@ sub make_fill { # loop through rows ROW: for (my $i = 0; $i < $number_of_lines; $i++) { my $row = $points->[$i]; - printf "Processing row %d...\n", $i; + Slic3r::debugf "Processing row %d...\n", $i; if (!@$row) { - printf " no points\n"; + Slic3r::debugf " no points\n"; $stop_path->(); next ROW; } - printf " points = %s\n", join ', ', @$row; + Slic3r::debugf " points = %s\n", join ', ', @$row if $Slic3r::debug; # coordinate of current row my $c = ($i + 1) * $distance_between_lines; @@ -120,8 +115,8 @@ sub make_fill { my @connectable_points = $self->find_connectable_points($polygon, $path_points[-1], $c, $row); @connectable_points = reverse @connectable_points if $direction == 1; - printf " found %d connectable points = %s\n", scalar(@connectable_points), - join ', ', @connectable_points; + Slic3r::debugf " found %d connectable points = %s\n", scalar(@connectable_points), + join ', ', @connectable_points if $Slic3r::debug; if (!@connectable_points && @path_points && $path_points[-1][0] != $c) { # no connectable in this row |