Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 't/clean_polylines.t')
-rw-r--r--t/clean_polylines.t24
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';
}
{