Thin walls. #24

This commit is contained in:
Alessandro Ranellucci 2011-12-30 17:17:37 +01:00
parent 62ee79f0c9
commit 1c7564e4a4
12 changed files with 203 additions and 12 deletions

View file

@ -30,6 +30,10 @@ has 'slices' => (
default => sub { [] },
);
# collection of polygons or polylines representing thin walls contained
# in the original geometry
has 'thin_walls' => (is => 'rw', default => sub { [] });
# collection of surfaces generated by offsetting the innermost perimeter(s)
# they represent boundaries of areas to fill
has 'fill_boundaries' => (
@ -160,6 +164,19 @@ sub make_surfaces {
($_, surface_type => 'internal'),
$surface->expolygon->offset_ex(-$distance);
}
# now detect thin walls by re-outgrowing offsetted surfaces and subtracting
# them from the original slices
my $outgrown = Math::Clipper::offset([ map $_->p, @{$self->slices} ], $distance);
my $diff = diff_ex(
[ map $_->p, @surfaces ],
$outgrown,
);
push @{$self->thin_walls},
grep $_,
map $_->medial_axis(scale $Slic3r::flow_width),
@$diff;
}
if (0) {