Refactoring: move direction math into a single function. Includes some fixes and adjustments

This commit is contained in:
Alessandro Ranellucci 2014-05-02 18:46:22 +02:00
parent 8240f71d07
commit cb1527f7ef
9 changed files with 59 additions and 13 deletions

View file

@ -34,7 +34,7 @@ sub is_straight {
# first point and last point. (Checking each line against the previous
# one would have caused the error to accumulate.)
my $dir = Slic3r::Line->new($self->first_point, $self->last_point)->direction;
return !defined first { abs($_->direction - $dir) > epsilon } @{$self->lines};
return !defined first { !$_->parallel_to($dir) } @{$self->lines};
}
1;