More work (breaks centering and internal surfaces detection)

This commit is contained in:
Alessandro Ranellucci
2012-09-22 19:38:25 +02:00
parent 02356fd613
commit d488afd243
4 changed files with 24 additions and 19 deletions

View File

@@ -14,7 +14,7 @@ has 'flow' => (is => 'lazy');
has 'perimeter_flow' => (is => 'lazy');
has 'infill_flow' => (is => 'lazy');
# collection of surfaces generated by slicing the original geometry;
# collection of expolygons generated by slicing the original geometry;
# also known as 'islands' (all materials are merged here)
has 'slices' => (is => 'rw');
@@ -68,8 +68,8 @@ sub material {
my $self = shift;
my ($material_idx) = @_;
for my $i (grep !defined $self->materials->[$_], 0..$material_idx) {
$self->materials->[$i] = Slic3r::Layer::Material->new(
if (!defined $self->materials->[$material_idx]) {
$self->materials->[$material_idx] = Slic3r::Layer::Material->new(
layer => $self,
);
}
@@ -83,11 +83,11 @@ sub make_slices {
# optimization for single-material layers
my @materials_with_slices = grep { @{$_->slices} } @{$self->materials};
if (@materials_with_slices == 1) {
$self->slices($materials_with_slices[0]->slices);
$self->slices([ map $_->expolygon, @{$materials_with_slices[0]->slices} ]);
return;
}
$self->slices(union_ex([ map @{$_->slices}, @{$self->materials} ]));
$self->slices(union_ex([ map $_->p, map @{$_->slices}, @{$self->materials} ]));
}
sub make_perimeters {