Bugfix: legacy return value exception caused problems with vertical surfaces

This commit is contained in:
Florens Wasserfall 2017-06-21 10:19:35 +02:00
parent 6d063a4413
commit ad9c4e2565
2 changed files with 5 additions and 5 deletions

View File

@ -71,9 +71,9 @@ $adaptive_slicing->prepare(20);
subtest 'max layer_height limited by extruder capabilities' => sub { subtest 'max layer_height limited by extruder capabilities' => sub {
plan tests => 3; plan tests => 3;
ok (_eq($adaptive_slicing->next_layer_height(1, 50, 0.1, 0.15), 0.15), 'low'); ok (_eq($adaptive_slicing->next_layer_height(1, 20, 0.1, 0.15), 0.15), 'low');
ok (_eq($adaptive_slicing->next_layer_height(1, 80, 0.1, 0.4), 0.4), 'higher'); ok (_eq($adaptive_slicing->next_layer_height(1, 20, 0.1, 0.4), 0.4), 'higher');
ok (_eq($adaptive_slicing->next_layer_height(1, 80, 0.1, 0.65), 0.65), 'highest'); ok (_eq($adaptive_slicing->next_layer_height(1, 20, 0.1, 0.65), 0.65), 'highest');
}; };
subtest 'min layer_height limited by extruder capabilities' => sub { subtest 'min layer_height limited by extruder capabilities' => sub {
@ -87,7 +87,7 @@ subtest 'min layer_height limited by extruder capabilities' => sub {
subtest 'correct layer_height depending on the facet normals' => sub { subtest 'correct layer_height depending on the facet normals' => sub {
plan tests => 3; plan tests => 3;
ok (_eq($adaptive_slicing->next_layer_height(1, 90, 0.1, 0.5), 0.5), 'limit'); ok (_eq($adaptive_slicing->next_layer_height(1, 10, 0.1, 0.5), 0.5), 'limit');
ok (_eq($adaptive_slicing->next_layer_height(4, 80, 0.1, 0.5), 0.1546), '45deg facet, quality_value: 0.2'); ok (_eq($adaptive_slicing->next_layer_height(4, 80, 0.1, 0.5), 0.1546), '45deg facet, quality_value: 0.2');
ok (_eq($adaptive_slicing->next_layer_height(4, 50, 0.1, 0.5), 0.3352), '45deg facet, quality_value: 0.5'); ok (_eq($adaptive_slicing->next_layer_height(4, 50, 0.1, 0.5), 0.3352), '45deg facet, quality_value: 0.5');
}; };

View File

@ -176,7 +176,7 @@ float SlicingAdaptive::_layer_height_from_facet(int ordered_id, float scaled_qua
{ {
float normal_z = std::abs(m_face_normal_z[ordered_id]); float normal_z = std::abs(m_face_normal_z[ordered_id]);
float height = scaled_quality_factor/(SURFACE_CONST + normal_z/2); float height = scaled_quality_factor/(SURFACE_CONST + normal_z/2);
return (normal_z == 0.f) ? 9999.f : height; return height;
} }
}; // namespace Slic3r }; // namespace Slic3r