New option to only infill where strictly needed for supporting ceilings

This commit is contained in:
Alessandro Ranellucci 2013-02-09 23:36:32 +01:00
parent cf8cfc1380
commit cac79c0575
7 changed files with 77 additions and 8 deletions

View file

@ -2,7 +2,7 @@ package Slic3r::Layer::Region;
use Moo;
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(scale chained_path_items);
use Slic3r::Geometry qw(PI scale chained_path_items);
use Slic3r::Geometry::Clipper qw(safety_offset union_ex diff_ex intersection_ex);
use Slic3r::Surface ':types';
@ -16,6 +16,7 @@ has 'layer' => (
has 'region' => (is => 'ro', required => 1);
has 'perimeter_flow' => (is => 'rw');
has 'infill_flow' => (is => 'rw');
has 'overhang_width' => (is => 'lazy');
# collection of spare segments generated by slicing the original geometry;
# these need to be merged in continuos (closed) polylines
@ -64,6 +65,12 @@ sub _update_flows {
: $self->region->flows->{infill});
}
sub _build_overhang_width {
my $self = shift;
my $threshold_rad = PI/2 - atan2($self->perimeter_flow->width / $self->height / 2, 1);
return scale($self->height * ((cos $threshold_rad) / (sin $threshold_rad)));
}
# build polylines from lines
sub make_surfaces {
my $self = shift;