Merge branch 'master' into dynamic-flow

Conflicts:
	lib/Slic3r/ExPolygon.pm
This commit is contained in:
Alessandro Ranellucci 2012-09-12 16:05:06 +02:00
commit 1cedb00f20
34 changed files with 529 additions and 260 deletions

View file

@ -11,7 +11,7 @@ BEGIN {
use Slic3r;
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(epsilon scale X Y);
use Slic3r::Geometry qw(scaled_epsilon scale X Y);
{
my $path = Slic3r::ExtrusionPath->new(polyline => Slic3r::Polyline->new(
@ -61,17 +61,17 @@ use Slic3r::Geometry qw(epsilon scale X Y);
isa_ok $collection2->paths->[0], 'Slic3r::ExtrusionPath::Arc', 'path';
my $expected_length = scale 7.06858347057701;
ok abs($collection1->paths->[0]->length - $expected_length) < scale epsilon, 'cw oriented arc has correct length';
ok abs($collection2->paths->[0]->length - $expected_length) < scale epsilon, 'ccw oriented arc has correct length';
ok abs($collection1->paths->[0]->length - $expected_length) < scaled_epsilon, 'cw oriented arc has correct length';
ok abs($collection2->paths->[0]->length - $expected_length) < scaled_epsilon, 'ccw oriented arc has correct length';
is $collection1->paths->[0]->orientation, 'cw', 'cw orientation was correctly detected';
is $collection2->paths->[0]->orientation, 'ccw', 'ccw orientation was correctly detected';
my $center1 = [ map sprintf('%.0f', $_), @{ $collection1->paths->[0]->center } ];
ok abs($center1->[X] - scale 10) < scale epsilon && abs($center1->[Y] - scale 10) < scale epsilon, 'center was correctly detected';
ok abs($center1->[X] - scale 10) < scaled_epsilon && abs($center1->[Y] - scale 10) < scaled_epsilon, 'center was correctly detected';
my $center2 = [ map sprintf('%.0f', $_), @{ $collection2->paths->[0]->center } ];
ok abs($center2->[X] - scale 10) < scale epsilon && abs($center1->[Y] - scale 10) < scale epsilon, 'center was correctly detected';
ok abs($center2->[X] - scale 10) < scaled_epsilon && abs($center1->[Y] - scale 10) < scaled_epsilon, 'center was correctly detected';
}
#==========================================================

View file

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 2;
plan tests => 4;
BEGIN {
use FindBin;
@ -10,14 +10,13 @@ BEGIN {
}
use Slic3r;
use Slic3r::Geometry qw(scale X Y);
use Slic3r::Surface qw(:types);
my $print = Slic3r::Print->new(
x_length => 50,
y_length => 50,
);
sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
{
my $filler = Slic3r::Fill::Rectilinear->new(print => $print);
my $filler = Slic3r::Fill::Rectilinear->new(print => Slic3r::Print->new);
my $surface_width = 250;
my $distance = $filler->adjust_solid_spacing(
width => $surface_width,
@ -27,4 +26,20 @@ my $print = Slic3r::Print->new(
is $surface_width % $distance, 0, 'adjusted solid distance';
}
{
my $filler = Slic3r::Fill::Rectilinear->new(
print => Slic3r::Print->new,
max_print_dimension => scale 100,
);
my $surface = Slic3r::Surface->new(
surface_type => S_TYPE_TOP,
expolygon => Slic3r::ExPolygon->new([ scale_points [0,0], [50,0], [50,50], [0,50] ]),
);
foreach my $angle (0, 45) {
$surface->expolygon->rotate($angle, [0,0]);
my ($params, @paths) = $filler->fill_surface($surface, flow_spacing => 0.69, density => 0.4);
is scalar @paths, 1, 'one continuous path';
}
}
__END__