diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-08-03 17:03:11 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-08-03 17:03:47 +0400 |
commit | 30fa055995fc0cb63bdd869f291e1873af9a3ad0 (patch) | |
tree | f8d86c4b894d41fed06078d5e167e562322ff3a3 /t/thin.t | |
parent | e897fbbd51abd54af2b79f904c3becd28fc07dd8 (diff) |
Bugfix: medial axis missed some segments. #2144
Diffstat (limited to 't/thin.t')
-rw-r--r-- | t/thin.t | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,4 +1,4 @@ -use Test::More tests => 13; +use Test::More tests => 14; use strict; use warnings; @@ -8,7 +8,7 @@ BEGIN { } use Slic3r; -use List::Util qw(first); +use List::Util qw(first sum); use Slic3r::Geometry qw(epsilon scale unscale scaled_epsilon Y); use Slic3r::Test; @@ -121,4 +121,16 @@ if (0) { ok $len > 80*2 && $len < 100*2, 'medial axis has reasonable length'; } +{ + my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new( + [-203064906,-51459966],[-219312231,-51459966],[-219335477,-51459962],[-219376095,-51459962],[-219412047,-51459966], + [-219572094,-51459966],[-219624814,-51459962],[-219642183,-51459962],[-219656665,-51459966],[-220815482,-51459966], + [-220815482,-37738966],[-221117540,-37738966],[-221117540,-51762024],[-203064906,-51762024], + )); + my $polylines = $expolygon->medial_axis(819998, 102499.75); + + my $perimeter = $expolygon->contour->split_at_first_point->length; + ok sum(map $_->length, @$polylines) > $perimeter/2/4*3, 'medial axis has a reasonable length'; +} + __END__ |