diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2014-03-08 14:36:48 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2014-03-08 14:36:48 +0400 |
commit | 33da6adc3c9d7b8128830e4f9e6beff9c191956a (patch) | |
tree | 2d69c56e610cdf09769ffd18f7e0e7c61109a387 /t/thin.t | |
parent | 04d80ca392cdba61084785422fac72110521c684 (diff) |
Better pruning
Diffstat (limited to 't/thin.t')
-rw-r--r-- | t/thin.t | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -11,7 +11,7 @@ use Slic3r; use List::Util qw(first); use Slic3r::Geometry qw(epsilon scale unscale); use Slic3r::Test; - +goto TTT; { my $config = Slic3r::Config->new_from_defaults; $config->set('layer_height', 0.2); @@ -65,7 +65,7 @@ use Slic3r::Test; 'medial axis loop has reasonable length'; } -{ +TTT: { my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new_scale( [100, 100], [120, 100], @@ -75,6 +75,21 @@ use Slic3r::Test; my $res = $expolygon->medial_axis(scale 10); is scalar(@$res), 1, 'medial axis of a narrow rectangle is a single line'; ok unscale($res->[0]->length) >= (200-100 - (120-100)) - epsilon, 'medial axis has reasonable length'; + + $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new_scale( + [100, 100], + [120, 100], + [120, 200], + [105, 200], # extra point in the short side + [100, 200], + )); + my $res2 = $expolygon->medial_axis(scale 10); + use Slic3r::SVG; + Slic3r::SVG::output( + "thin.svg", + expolygons => [$expolygon], + polylines => $res2, + ); } { |