Use perimeter length, not area, to detect small perimeters. #355

This commit is contained in:
Alessandro Ranellucci 2012-05-14 00:30:52 +02:00
parent f1905256f8
commit 4bffa9cb6b
2 changed files with 5 additions and 5 deletions

View File

@ -82,7 +82,7 @@ our $infill_acceleration = 50; # mm/s^2
# accuracy options # accuracy options
our $scaling_factor = 0.00000001; our $scaling_factor = 0.00000001;
our $resolution = 0.01; our $resolution = 0.01;
our $small_perimeter_area = ((6.5 / $scaling_factor)**2)*PI; our $small_perimeter_length = (6.5 / $scaling_factor)*2*PI;
our $layer_height = 0.4; our $layer_height = 0.4;
our $first_layer_height_ratio = 1; our $first_layer_height_ratio = 1;
our $infill_every_layers = 1; our $infill_every_layers = 1;

View File

@ -194,9 +194,9 @@ sub make_perimeters {
# experimental hole compensation (see ArcCompensation in the RepRap wiki) # experimental hole compensation (see ArcCompensation in the RepRap wiki)
foreach my $hole ($last_offsets[0]->holes) { foreach my $hole ($last_offsets[0]->holes) {
my $area = abs($hole->area); my $circumference = abs($hole->length);
next unless $area <= $Slic3r::small_perimeter_area; next unless $circumference <= $Slic3r::small_perimeter_length;
my $radius = sqrt($area / PI); my $radius = ($circumference / PI / 2);
my $new_radius = (scale($Slic3r::flow_width) + sqrt((scale($Slic3r::flow_width)**2) + (4*($radius**2)))) / 2; my $new_radius = (scale($Slic3r::flow_width) + sqrt((scale($Slic3r::flow_width)**2) + (4*($radius**2)))) / 2;
# holes are always turned to contours, so reverse point order before and after # holes are always turned to contours, so reverse point order before and after
$hole->reverse; $hole->reverse;
@ -294,7 +294,7 @@ sub make_perimeters {
# detect small perimeters by checking their area # detect small perimeters by checking their area
for (@{ $self->perimeters }) { for (@{ $self->perimeters }) {
$_->role('small-perimeter') if abs($_->polygon->area) < $Slic3r::small_perimeter_area; $_->role('small-perimeter') if abs($_->polygon->length) <= $Slic3r::small_perimeter_length;
} }
# add thin walls as perimeters # add thin walls as perimeters