Merge branch 'adaptive-slicing' into adaptive-slicing-layer-gradation

This commit is contained in:
Florens Wasserfall 2016-11-09 19:15:23 +01:00
commit cf8ea335f9
2 changed files with 39 additions and 5 deletions

View File

@ -177,7 +177,7 @@ sub horizontal_facet_distance {
# min_z == max_z -> horizontal facet # min_z == max_z -> horizontal facet
if($self->ordered_facets->[$ordered_id]->[1] > $z) { if($self->ordered_facets->[$ordered_id]->[1] > $z) {
if($self->ordered_facets->[$ordered_id]->[1] == $self->ordered_facets->[$ordered_id]->[2]) { if($self->ordered_facets->[$ordered_id]->[1] == $self->ordered_facets->[$ordered_id]->[2]) {
return unscale $self->ordered_facets->[$ordered_id]->[1] - $z; return unscale($self->ordered_facets->[$ordered_id]->[1] - $z);
} }
} }
@ -185,11 +185,11 @@ sub horizontal_facet_distance {
} }
# objects maximum? # objects maximum?
if($z + $max_height > $self->size) { if($z + $max_height > scale($self->size)) {
return max(unscale $self->size - $z, 0); return max($self->size - unscale($z), 0);
} }
return unscale $max_height; return unscale $max_height;
} }
1; 1;

View File

@ -1,4 +1,4 @@
use Test::More tests => 5; use Test::More tests => 8;
use strict; use strict;
use warnings; use warnings;
@ -84,4 +84,38 @@ ok (_eq($adaptive_slicing->cusp_height(scale 2.798, 0.1, 0.1, 0.5), 0.1414), 'r
# slopes cusp height must be smaller than the distance to the slope # slopes cusp height must be smaller than the distance to the slope
ok (_eq($adaptive_slicing->cusp_height(scale 2.6289, 0.15, 0.1, 0.5), 0.3), 'reducing cusp_height to z-diff'); ok (_eq($adaptive_slicing->cusp_height(scale 2.6289, 0.15, 0.1, 0.5), 0.3), 'reducing cusp_height to z-diff');
subtest 'horizontal planes' => sub {
plan tests => 3;
print "facet_distance: " . $adaptive_slicing->horizontal_facet_distance(scale 1, 1.2) . "\n";
ok (_eq($adaptive_slicing->horizontal_facet_distance(scale 1, 1.2), 1.2), 'max_height limit');
ok (_eq($adaptive_slicing->horizontal_facet_distance(scale 8.5, 4), 1.5), 'normal horizontal facet');
ok (_eq($adaptive_slicing->horizontal_facet_distance(scale 17, 5), 3.0), 'object maximum');
};
# shrink current layer to fit another layer under horizontal facet
$config->set('start_gcode', ''); # to avoid dealing with the nozzle lift in start G-code
$config->set('z_offset', 0);
$config->set('adaptive_slicing', 1);
$config->set('first_layer_height', 0.42893); # to catch lower slope edge
$config->set('nozzle_diameter', [0.5]);
$config->set('min_layer_height', [0.1]);
$config->set('max_layer_height', [0.5]);
$config->set('cusp_value', [0.19]);
# slope height: 7,07107 (2.92893 to 10)
subtest 'shrink to match horizontal facets' => sub {
plan tests => 3;
$test->();
};
# widen current layer to match horizontal facet
$config->set('cusp_value', [0.1]);
subtest 'widen to match horizontal facets' => sub {
plan tests => 3;
$test->();
};
__END__ __END__