Detection of optimal infill direction for bridges. Includes many fixes and improvements.

This commit is contained in:
Alessandro Ranellucci 2011-10-07 19:07:57 +02:00
parent 1cb515a8e5
commit 743f2abcf2
18 changed files with 445 additions and 68 deletions

View file

@ -3,6 +3,8 @@ use Moo;
extends 'Slic3r::Polyline';
use Math::Clipper qw(JT_MITER);
sub lines {
my $self = shift;
my @lines = $self->SUPER::lines(@_);
@ -32,4 +34,17 @@ sub encloses_point {
return Slic3r::Geometry::point_in_polygon($point->p, $self->p);
}
# returns false if the polyline is too tight to be printed
sub is_printable {
my $self = shift;
# try to get an inwards offset
# for a distance equal to half of the extrusion width;
# if no offset is possible, then polyline is not printable
my $p = $self->p;
@$p = reverse @$p if !Math::Clipper::is_counter_clockwise($p);
my $offsets = Math::Clipper::offset([$p], -($Slic3r::flow_width / 2 / $Slic3r::resolution), $Slic3r::resolution * 100000, JT_MITER, 2);
return @$offsets ? 1 : 0;
}
1;