Reapply correct optimization for simplifiying fill_surfaces before performing the offset. #1325

This commit is contained in:
Alessandro Ranellucci 2013-07-20 12:22:41 +02:00
parent 9433048873
commit e29aca3553
5 changed files with 40 additions and 12 deletions

View file

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 8;
plan tests => 10;
BEGIN {
use FindBin;
@ -84,6 +84,25 @@ use Slic3r;
is_deeply \@simplified_ex, [ \@simplified ], 'simplified polygon equals simplified expolygon';
}
{
my $square = Slic3r::Polygon->new( # ccw
[100, 100],
[200, 100],
[200, 200],
[100, 200],
);
my $hole_in_square = Slic3r::Polygon->new( # cw
[140, 140],
[140, 160],
[160, 160],
[160, 140],
);
my $expolygon = Slic3r::ExPolygon->new($square, $hole_in_square);
my @simplified = $hole_in_square->simplify;
is scalar(@simplified), 1, 'hole simplification returns one polygon';
ok $simplified[0]->is_counter_clockwise, 'hole simplification turns cw polygon into ccw polygon';
}
{
my $circle = [
[3744.8,8045.8],[3788.1,8061.4],[3940.6,8116.3],[3984.8,8129.2],[4140.6,8174.4],[4185.5,8184.4],[4343.8,8219.9],