Extend tests about solid infill adjustment
This commit is contained in:
parent
2a2d15e422
commit
99963775ff
1 changed files with 34 additions and 15 deletions
49
t/fill.t
49
t/fill.t
|
@ -2,7 +2,7 @@ use Test::More;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
plan tests => 11;
|
plan tests => 31;
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
use FindBin;
|
use FindBin;
|
||||||
|
@ -50,27 +50,46 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
my $test = sub {
|
||||||
|
my ($expolygon) = @_;
|
||||||
|
$expolygon->align_to_origin;
|
||||||
|
my $filler = Slic3r::Fill::Rectilinear->new(
|
||||||
|
bounding_box => $expolygon->bounding_box,
|
||||||
|
angle => 0,
|
||||||
|
);
|
||||||
|
my $surface = Slic3r::Surface->new(
|
||||||
|
surface_type => S_TYPE_BOTTOM,
|
||||||
|
expolygon => $expolygon,
|
||||||
|
);
|
||||||
|
my ($params, @paths) = $filler->fill_surface($surface, flow_spacing => 0.55, density => 1);
|
||||||
|
|
||||||
|
# check whether any part was left uncovered
|
||||||
|
my @grown_paths = map Slic3r::Polyline->new(@$_)->grow(scale $params->{flow_spacing}/2), @paths;
|
||||||
|
my $uncovered = diff_ex([ @$expolygon ], [ @grown_paths ], 1);
|
||||||
|
is scalar(@$uncovered), 0, 'solid surface is fully filled';
|
||||||
|
if (0 && @$uncovered) {
|
||||||
|
require "Slic3r/SVG.pm";
|
||||||
|
Slic3r::SVG::output(
|
||||||
|
"uncovered.svg",
|
||||||
|
expolygons => [$expolygon],
|
||||||
|
red_expolygons => $uncovered,
|
||||||
|
);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
my $expolygon = Slic3r::ExPolygon->new([
|
my $expolygon = Slic3r::ExPolygon->new([
|
||||||
[6883102, 9598327.01296997],
|
[6883102, 9598327.01296997],
|
||||||
[6883102, 20327272.01297],
|
[6883102, 20327272.01297],
|
||||||
[3116896, 20327272.01297],
|
[3116896, 20327272.01297],
|
||||||
[3116896, 9598327.01296997],
|
[3116896, 9598327.01296997],
|
||||||
]);
|
]);
|
||||||
$expolygon->align_to_origin;
|
$test->($expolygon);
|
||||||
my $filler = Slic3r::Fill::Rectilinear->new(
|
|
||||||
bounding_box => $expolygon->bounding_box,
|
|
||||||
angle => 0,
|
|
||||||
);
|
|
||||||
my $surface = Slic3r::Surface->new(
|
|
||||||
surface_type => S_TYPE_BOTTOM,
|
|
||||||
expolygon => $expolygon,
|
|
||||||
);
|
|
||||||
my ($params, @paths) = $filler->fill_surface($surface, flow_spacing => 0.55, density => 1);
|
|
||||||
|
|
||||||
# check whether any part was left uncovered
|
for (1..20) {
|
||||||
my @grown_paths = map Slic3r::Polyline->new(@$_)->grow(scale $params->{flow_spacing}/2), @paths;
|
$expolygon->scale(1.05);
|
||||||
my $uncovered = diff_ex([ @$expolygon ], [ @grown_paths ]);
|
$test->($expolygon);
|
||||||
is scalar(@$uncovered), 0, 'solid surface is fully filled';
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue