Minor improvements in debug output

This commit is contained in:
Alessandro Ranellucci 2013-10-13 12:12:03 +02:00
parent f603db5e84
commit 9918c1e97d
2 changed files with 13 additions and 5 deletions

View file

@ -3,7 +3,7 @@ use Moo;
use List::Util qw(sum first); use List::Util qw(sum first);
use Slic3r::ExtrusionPath ':roles'; use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(PI A B scale chained_path_items points_coincide); use Slic3r::Geometry qw(PI A B scale unscale chained_path_items points_coincide);
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex
offset offset2 offset2_ex union_pt traverse_pt diff intersection offset offset2 offset2_ex union_pt traverse_pt diff intersection
union diff); union diff);
@ -86,7 +86,7 @@ sub make_surfaces {
return if !@$loops; return if !@$loops;
$self->slices->clear; $self->slices->clear;
$self->slices->append(_merge_loops($loops)); $self->slices->append($self->_merge_loops($loops));
if (0) { if (0) {
require "Slic3r/SVG.pm"; require "Slic3r/SVG.pm";
@ -100,7 +100,7 @@ sub make_surfaces {
} }
sub _merge_loops { sub _merge_loops {
my ($loops, $safety_offset) = @_; my ($self, $loops, $safety_offset) = @_;
# Input loops are not suitable for evenodd nor nonzero fill types, as we might get # Input loops are not suitable for evenodd nor nonzero fill types, as we might get
# two consecutive concentric loops having the same winding order - and we have to # two consecutive concentric loops having the same winding order - and we have to
@ -134,8 +134,10 @@ sub _merge_loops {
$safety_offset //= scale 0.0499; $safety_offset //= scale 0.0499;
$slices = offset2_ex($slices, +$safety_offset, -$safety_offset); $slices = offset2_ex($slices, +$safety_offset, -$safety_offset);
Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n", Slic3r::debugf "Layer %d (slice_z = %.2f, print_z = %.2f): %d surface(s) having %d holes detected from %d polylines\n",
scalar(@$slices), scalar(map @{$_->holes}, @$slices), scalar(@$loops) if $Slic3r::debug; $self->id, unscale($self->slice_z), $self->print_z,
scalar(@$slices), scalar(map @{$_->holes}, @$slices), scalar(@$loops)
if $Slic3r::debug;
return map Slic3r::Surface->new(expolygon => $_, surface_type => S_TYPE_INTERNAL), @$slices; return map Slic3r::Surface->new(expolygon => $_, surface_type => S_TYPE_INTERNAL), @$slices;
} }

View file

@ -375,6 +375,9 @@ TriangleMesh::slice(const std::vector<double> &z)
std::vector<Polygons>* layers = new std::vector<Polygons>(z.size()); std::vector<Polygons>* layers = new std::vector<Polygons>(z.size());
for (std::vector<IntersectionLines>::iterator it = lines.begin(); it != lines.end(); ++it) { for (std::vector<IntersectionLines>::iterator it = lines.begin(); it != lines.end(); ++it) {
int layer_idx = it - lines.begin(); int layer_idx = it - lines.begin();
#ifdef SLIC3R_DEBUG
printf("Layer %d:\n", layer_idx);
#endif
// remove tangent edges // remove tangent edges
for (IntersectionLines::iterator line = it->begin(); line != it->end(); ++line) { for (IntersectionLines::iterator line = it->begin(); line != it->end(); ++line) {
@ -473,6 +476,9 @@ TriangleMesh::slice(const std::vector<double> &z)
// we can't close this loop! // we can't close this loop!
//// push @failed_loops, [@loop]; //// push @failed_loops, [@loop];
#ifdef SLIC3R_DEBUG
printf(" Unable to close this loop having %d points\n", (int)loop.size());
#endif
goto CYCLE; goto CYCLE;
} }
/* /*