More robust medial axis pruning. #2800

This commit is contained in:
Alessandro Ranellucci 2015-05-13 20:47:26 +02:00
parent 1dc63071ed
commit 97211f35e7
5 changed files with 78 additions and 67 deletions

View file

@ -1,4 +1,4 @@
use Test::More tests => 14;
use Test::More tests => 16;
use strict;
use warnings;
@ -133,4 +133,15 @@ if (0) {
ok sum(map $_->length, @$polylines) > $perimeter/2/4*3, 'medial axis has a reasonable length';
}
{
my $expolygon = Slic3r::ExPolygon->new(Slic3r::Polygon->new_scale(
[50, 100],
[300, 102],
[50, 104],
));
my $res = $expolygon->medial_axis(scale 4, scale 0.5);
is scalar(@$res), 1, 'medial axis of a narrow triangle is a single line';
ok unscale($res->[0]->length) >= (200-100 - (120-100)) - epsilon, 'medial axis has reasonable length';
}
__END__