Bugfix: medial axis missed some segments. #2144

This commit is contained in:
Alessandro Ranellucci 2014-08-03 15:03:11 +02:00
parent e897fbbd51
commit 30fa055995
6 changed files with 48 additions and 8 deletions

View file

@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
plan tests => 26;
plan tests => 34;
BEGIN {
use FindBin;
@ -28,6 +28,20 @@ use Slic3r::Geometry qw(rad2deg_dir angle3points PI);
#==========================================================
{
is line_orientation([ [0, 0], [10, 0] ]), (0), 'E orientation';
is line_orientation([ [0, 0], [0, 10] ]), (PI/2), 'N orientation';
is line_orientation([ [10, 0], [0, 0] ]), (PI), 'W orientation';
is line_orientation([ [0, 10], [0, 0] ]), (PI*3/2), 'S orientation';
is line_orientation([ [0, 0], [10, 10] ]), (PI*1/4), 'NE orientation';
is line_orientation([ [10, 0], [0, 10] ]), (PI*3/4), 'NW orientation';
is line_orientation([ [10, 10], [0, 0] ]), (PI*5/4), 'SW orientation';
is line_orientation([ [0, 10], [10, 0] ]), (PI*7/4), 'SE orientation';
}
#==========================================================
{
is line_direction([ [0, 0], [10, 0] ]), (0), 'E direction';
is line_direction([ [10, 0], [0, 0] ]), (0), 'W direction';
@ -67,6 +81,11 @@ sub line_atan {
return Slic3r::Line->new(@$l)->atan2_;
}
sub line_orientation {
my ($l) = @_;
return Slic3r::Line->new(@$l)->orientation;
}
sub line_direction {
my ($l) = @_;
return Slic3r::Line->new(@$l)->direction;