Use bridge math for the first solid infill layer above sparse infill. #240

This commit is contained in:
Alessandro Ranellucci 2013-02-23 21:39:13 +01:00
parent 3b1e921171
commit 08a72c0824
5 changed files with 99 additions and 5 deletions

View file

@ -4,7 +4,7 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(S_TYPE_TOP S_TYPE_BOTTOM S_TYPE_INTERNAL S_TYPE_INTERNALSOLID);
our @EXPORT_OK = qw(S_TYPE_TOP S_TYPE_BOTTOM S_TYPE_INTERNAL S_TYPE_INTERNALSOLID S_TYPE_INTERNALBRIDGE);
our %EXPORT_TAGS = (types => \@EXPORT_OK);
use constant S_EXPOLYGON => 0;
@ -17,6 +17,7 @@ use constant S_TYPE_TOP => 0;
use constant S_TYPE_BOTTOM => 1;
use constant S_TYPE_INTERNAL => 2;
use constant S_TYPE_INTERNALSOLID => 3;
use constant S_TYPE_INTERNALBRIDGE => 4;
sub new {
my $class = shift;
@ -51,7 +52,7 @@ sub group {
my %unique_types = ();
foreach my $surface (@surfaces) {
my $type = ($params->{merge_solid} && grep { $surface->surface_type == $_ } S_TYPE_TOP, S_TYPE_BOTTOM, S_TYPE_INTERNALSOLID)
my $type = ($params->{merge_solid} && $surface->is_solid)
? 'solid'
: $surface->surface_type;
$type .= "_" . ($surface->bridge_angle // ''); #/
@ -89,4 +90,28 @@ sub p {
return @{$self->expolygon};
}
sub is_solid {
my $self = shift;
my $type = $self->surface_type;
return $type == S_TYPE_TOP
|| $type == S_TYPE_BOTTOM
|| $type == S_TYPE_INTERNALSOLID
|| $type == S_TYPE_INTERNALBRIDGE;
}
sub is_internal {
my $self = shift;
my $type = $self->surface_type;
return $type == S_TYPE_INTERNAL
|| $type == S_TYPE_INTERNALSOLID
|| $type == S_TYPE_INTERNALBRIDGE;
}
sub is_bridge {
my $self = shift;
my $type = $self->surface_type;
return $type == S_TYPE_BOTTOM
|| $type == S_TYPE_INTERNALBRIDGE;
}
1;