Bugfix: some holes were filled. #291

This commit is contained in:
Alessandro Ranellucci 2012-04-02 11:40:12 +02:00
parent f380b1007d
commit 0afb5ad9dd
5 changed files with 21 additions and 19 deletions

View File

@ -8,7 +8,7 @@ our @EXPORT_OK = qw(explode_expolygon explode_expolygons safety_offset offset
diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND
is_counter_clockwise); is_counter_clockwise);
use Math::Clipper 1.03 ':all'; use Math::Clipper 1.05 ':all';
use Slic3r::Geometry qw(scale); use Slic3r::Geometry qw(scale);
our $clipper = Math::Clipper->new; our $clipper = Math::Clipper->new;

View File

@ -37,6 +37,21 @@ sub lines {
return @lines; return @lines;
} }
sub is_counter_clockwise {
my $self = shift;
return Math::Clipper::is_counter_clockwise($self);
}
sub make_counter_clockwise {
my $self = shift;
$self->reverse if !$self->is_counter_clockwise;
}
sub make_clockwise {
my $self = shift;
$self->reverse if $self->is_counter_clockwise;
}
sub cleanup { sub cleanup {
my $self = shift; my $self = shift;
$self->merge_continuous_lines; $self->merge_continuous_lines;

View File

@ -66,21 +66,6 @@ sub reverse {
@$self = CORE::reverse @$self; @$self = CORE::reverse @$self;
} }
sub is_counter_clockwise {
my $self = shift;
return Math::Clipper::is_counter_clockwise($self);
}
sub make_counter_clockwise {
my $self = shift;
$self->reverse if !$self->is_counter_clockwise;
}
sub make_clockwise {
my $self = shift;
$self->reverse if $self->is_counter_clockwise;
}
sub nearest_point_to { sub nearest_point_to {
my $self = shift; my $self = shift;
my ($point) = @_; my ($point) = @_;

View File

@ -222,8 +222,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 (%d sliced expolygons) has %d bottom, %d top and %d internal surfaces\n", Slic3r::debugf " layer %d has %d bottom, %d top and %d internal surfaces\n",
$layer->id, scalar(@{$layer->slices}), scalar(@bottom), scalar(@top), scalar(@internal); $layer->id, scalar(@bottom), scalar(@top), scalar(@internal);
} }
# clip surfaces to the fill boundaries # clip surfaces to the fill boundaries

View File

@ -245,8 +245,10 @@ sub make_loops {
$line = $next_line; $line = $next_line;
} while ($first_facet_index != $line->facet_index); } while ($first_facet_index != $line->facet_index);
Slic3r::debugf " Discovered polygon of %d points\n", scalar(@points);
push @polygons, Slic3r::Polygon->new(@points); push @polygons, Slic3r::Polygon->new(@points);
Slic3r::debugf " Discovered %s polygon of %d points\n",
($polygons[-1]->is_counter_clockwise ? 'ccw' : 'cw'), scalar(@points)
if $Slic3r::debug;
pop @polygons if !$polygons[-1]->cleanup; pop @polygons if !$polygons[-1]->cleanup;
} }