Some better debug messages and a note about self-intersecting polygons. #160
This commit is contained in:
parent
478775ef1c
commit
bba91fc0a5
2 changed files with 10 additions and 4 deletions
|
@ -105,6 +105,8 @@ sub make_surfaces {
|
|||
my ($loops) = @_;
|
||||
|
||||
{
|
||||
# TODO: fix self-intersecting polygons in $loops (GH #160)
|
||||
|
||||
# merge everything
|
||||
my $expolygons = union_ex($loops);
|
||||
|
||||
|
@ -130,7 +132,7 @@ sub make_surfaces {
|
|||
foreach my $contour (map $_->contour, @expolygons_without_holes) {
|
||||
foreach my $hole (grep !exists $bogus_holes{$_}, @reversed_holes) {
|
||||
my $xor = xor_ex([$contour], [$hole]);
|
||||
if (!@$xor || $area_sum->(@$xor) < scale 1) { # TODO: define this threshold better
|
||||
if ($area_sum->(@$xor) < scale 1) { # TODO: define this threshold better
|
||||
$bogus_holes{$hole} = $hole;
|
||||
}
|
||||
}
|
||||
|
@ -170,10 +172,14 @@ sub make_surfaces {
|
|||
1,
|
||||
);
|
||||
|
||||
# TODO: remove very small expolygons from diff before attempting to do medial axis
|
||||
# (benchmark first)
|
||||
push @{$self->thin_walls},
|
||||
grep $_,
|
||||
map $_->medial_axis(scale $Slic3r::flow_width),
|
||||
@$diff;
|
||||
|
||||
Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}) if @{$self->thin_walls};
|
||||
}
|
||||
|
||||
if (0) {
|
||||
|
|
|
@ -168,6 +168,7 @@ sub layer {
|
|||
|
||||
sub detect_surfaces_type {
|
||||
my $self = shift;
|
||||
Slic3r::debugf "Detecting solid surfaces...\n";
|
||||
|
||||
# prepare a reusable subroutine to make surface differences
|
||||
my $surface_difference = sub {
|
||||
|
@ -184,7 +185,6 @@ sub detect_surfaces_type {
|
|||
|
||||
for (my $i = 0; $i < $self->layer_count; $i++) {
|
||||
my $layer = $self->layers->[$i];
|
||||
Slic3r::debugf "Detecting solid surfaces for layer %d\n", $layer->id;
|
||||
my $upper_layer = $self->layers->[$i+1];
|
||||
my $lower_layer = $i > 0 ? $self->layers->[$i-1] : undef;
|
||||
|
||||
|
@ -225,8 +225,8 @@ sub detect_surfaces_type {
|
|||
# save surfaces to layer
|
||||
@{$layer->slices} = (@bottom, @top, @internal);
|
||||
|
||||
Slic3r::debugf " layer %d has %d bottom, %d top and %d internal surfaces\n",
|
||||
$layer->id, scalar(@bottom), scalar(@top), scalar(@internal);
|
||||
Slic3r::debugf " layer %d (%d sliced expolygons) has %d bottom, %d top and %d internal surfaces\n",
|
||||
$layer->id, scalar(@{$layer->slices}), scalar(@bottom), scalar(@top), scalar(@internal);
|
||||
}
|
||||
|
||||
# clip surfaces to the fill boundaries
|
||||
|
|
Loading…
Reference in a new issue