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
path: root/t/thin.t
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-03-03 04:48:05 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-03-03 04:48:05 +0400
commitb49a6527360a48b5f56d95e410b94a2b1400e2f2 (patch)
treeb0ade48dcb00f8c3b3e17d528f7036fd289846b1 /t/thin.t
parenteadffe4a9ea2c8ab9784bfc6c03b21b413a4c5dc (diff)
Rewritten half-edge traversal in a more robust way. Includes first medial axis unit test
Diffstat (limited to 't/thin.t')
-rw-r--r--t/thin.t25
1 files changed, 23 insertions, 2 deletions
diff --git a/t/thin.t b/t/thin.t
index 09b060d8b..a19fcd144 100644
--- a/t/thin.t
+++ b/t/thin.t
@@ -1,4 +1,4 @@
-use Test::More tests => 1;
+use Test::More tests => 3;
use strict;
use warnings;
@@ -9,7 +9,7 @@ BEGIN {
use Slic3r;
use List::Util qw(first);
-use Slic3r::Geometry qw(epsilon);
+use Slic3r::Geometry qw(epsilon scale);
use Slic3r::Test;
{
@@ -45,4 +45,25 @@ use Slic3r::Test;
'no superfluous thin walls are generated for toothed profile';
}
+my $square = Slic3r::Polygon->new_scale( # ccw
+ [100, 100],
+ [200, 100],
+ [200, 200],
+ [100, 200],
+);
+my $hole_in_square = Slic3r::Polygon->new_scale( # cw
+ [140, 140],
+ [140, 160],
+ [160, 160],
+ [160, 140],
+);
+
+{
+ my $expolygon = Slic3r::ExPolygon->new($square, $hole_in_square);
+ my $res = $expolygon->medial_axis(scale 10);
+ is scalar(@$res), 1, 'medial axis of a square shape is a single closed loop';
+ ok $res->[0]->length > $hole_in_square->length && $res->[0]->length < $square->length,
+ 'medial axis loop has reasonable length';
+}
+
__END__