diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-08-08 04:10:34 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-08-08 04:10:34 +0400 |
commit | b38cc2c2442dfc8abd5b24e2964246075b2b3a19 (patch) | |
tree | 99efc93e474098e9c7664b40dd36a43d36b96dd6 /t/clean_polylines.t | |
parent | d881c5ab2f9c8f43ab72a2a5310962a89a8f9af6 (diff) | |
parent | 4438aec12ce3b90b6a4ffde680a0d2b6dc1ed7d1 (diff) |
Merge branch 'master' into xsdata
Conflicts:
lib/Slic3r.pm
lib/Slic3r/ExPolygon.pm
lib/Slic3r/Fill.pm
lib/Slic3r/Fill/Rectilinear.pm
lib/Slic3r/GCode.pm
lib/Slic3r/GUI/Plater.pm
lib/Slic3r/Geometry/Clipper.pm
lib/Slic3r/Layer/Region.pm
lib/Slic3r/Print.pm
lib/Slic3r/Print/Object.pm
lib/Slic3r/TriangleMesh.pm
t/shells.t
xs/MANIFEST
Diffstat (limited to 't/clean_polylines.t')
-rw-r--r-- | t/clean_polylines.t | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/t/clean_polylines.t b/t/clean_polylines.t index 300025dd4..acd72a288 100644 --- a/t/clean_polylines.t +++ b/t/clean_polylines.t @@ -2,7 +2,7 @@ use Test::More; use strict; use warnings; -plan tests => 7; +plan tests => 10; BEGIN { use FindBin; @@ -78,6 +78,28 @@ use Slic3r; ok @simplified == 1, 'gear simplified to a single polygon'; note sprintf "original points: %d\nnew points: %d", $num_points, scalar(@{$simplified[0]}); ok @{$simplified[0]} < $num_points, 'gear was further simplified using Douglas-Peucker'; + + my @simplified_ex = Slic3r::ExPolygon->new($polygon)->simplify(10); + is_deeply [ map $_->pp, @simplified_ex ], [ [ map $_->pp, @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'; } { |