mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-05-15 16:48:08 +08:00
Some better debug messages and a note about self-intersecting polygons. #160
This commit is contained in:
parent
478775ef1c
commit
bba91fc0a5
@ -105,6 +105,8 @@ sub make_surfaces {
|
|||||||
my ($loops) = @_;
|
my ($loops) = @_;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# TODO: fix self-intersecting polygons in $loops (GH #160)
|
||||||
|
|
||||||
# merge everything
|
# merge everything
|
||||||
my $expolygons = union_ex($loops);
|
my $expolygons = union_ex($loops);
|
||||||
|
|
||||||
@ -130,7 +132,7 @@ sub make_surfaces {
|
|||||||
foreach my $contour (map $_->contour, @expolygons_without_holes) {
|
foreach my $contour (map $_->contour, @expolygons_without_holes) {
|
||||||
foreach my $hole (grep !exists $bogus_holes{$_}, @reversed_holes) {
|
foreach my $hole (grep !exists $bogus_holes{$_}, @reversed_holes) {
|
||||||
my $xor = xor_ex([$contour], [$hole]);
|
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;
|
$bogus_holes{$hole} = $hole;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -170,10 +172,14 @@ sub make_surfaces {
|
|||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
# TODO: remove very small expolygons from diff before attempting to do medial axis
|
||||||
|
# (benchmark first)
|
||||||
push @{$self->thin_walls},
|
push @{$self->thin_walls},
|
||||||
grep $_,
|
grep $_,
|
||||||
map $_->medial_axis(scale $Slic3r::flow_width),
|
map $_->medial_axis(scale $Slic3r::flow_width),
|
||||||
@$diff;
|
@$diff;
|
||||||
|
|
||||||
|
Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}) if @{$self->thin_walls};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
|
@ -168,6 +168,7 @@ sub layer {
|
|||||||
|
|
||||||
sub detect_surfaces_type {
|
sub detect_surfaces_type {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
Slic3r::debugf "Detecting solid surfaces...\n";
|
||||||
|
|
||||||
# prepare a reusable subroutine to make surface differences
|
# prepare a reusable subroutine to make surface differences
|
||||||
my $surface_difference = sub {
|
my $surface_difference = sub {
|
||||||
@ -184,7 +185,6 @@ sub detect_surfaces_type {
|
|||||||
|
|
||||||
for (my $i = 0; $i < $self->layer_count; $i++) {
|
for (my $i = 0; $i < $self->layer_count; $i++) {
|
||||||
my $layer = $self->layers->[$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 $upper_layer = $self->layers->[$i+1];
|
||||||
my $lower_layer = $i > 0 ? $self->layers->[$i-1] : undef;
|
my $lower_layer = $i > 0 ? $self->layers->[$i-1] : undef;
|
||||||
|
|
||||||
@ -225,8 +225,8 @@ sub detect_surfaces_type {
|
|||||||
# save surfaces to layer
|
# save surfaces to layer
|
||||||
@{$layer->slices} = (@bottom, @top, @internal);
|
@{$layer->slices} = (@bottom, @top, @internal);
|
||||||
|
|
||||||
Slic3r::debugf " layer %d has %d bottom, %d top and %d internal surfaces\n",
|
Slic3r::debugf " layer %d (%d sliced expolygons) has %d bottom, %d top and %d internal surfaces\n",
|
||||||
$layer->id, scalar(@bottom), scalar(@top), scalar(@internal);
|
$layer->id, scalar(@{$layer->slices}), scalar(@bottom), scalar(@top), scalar(@internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
# clip surfaces to the fill boundaries
|
# clip surfaces to the fill boundaries
|
||||||
|
Loading…
x
Reference in New Issue
Block a user