Use linestring_length() from Boost

This commit is contained in:
Alessandro Ranellucci 2013-03-31 19:50:22 +02:00
parent 0d6ff22e19
commit bf809d1fd0
3 changed files with 4 additions and 6 deletions

View file

@ -7,7 +7,7 @@ use warnings;
use Boost::Geometry::Utils; use Boost::Geometry::Utils;
use List::Util qw(first); use List::Util qw(first);
use Math::Geometry::Voronoi; use Math::Geometry::Voronoi;
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line line_length epsilon); use Slic3r::Geometry qw(X Y A B point_in_polygon same_line epsilon);
use Slic3r::Geometry::Clipper qw(union_ex JT_MITER); use Slic3r::Geometry::Clipper qw(union_ex JT_MITER);
# the constructor accepts an array of polygons # the constructor accepts an array of polygons
@ -131,7 +131,7 @@ sub encloses_line {
# optimization # optimization
return @$clip == 1 && same_line($clip->[0], $line); return @$clip == 1 && same_line($clip->[0], $line);
} else { } else {
return @$clip == 1 && abs(line_length($clip->[0]) - $line->length) < $tolerance; return @$clip == 1 && abs(Boost::Geometry::Utils::linestring_length($clip->[0]) - $line->length) < $tolerance;
} }
} }

View file

@ -29,7 +29,7 @@ sub coincides_with {
sub length { sub length {
my $self = shift; my $self = shift;
return Slic3r::Geometry::line_length($self); return Boost::Geometry::Utils::linestring_length($self);
} }
sub vector { sub vector {

View file

@ -79,9 +79,7 @@ sub reverse {
sub length { sub length {
my $self = shift; my $self = shift;
my $length = 0; return Boost::Geometry::Utils::linestring_length($self);
$length += $_->length for $self->lines;
return $length;
} }
sub grow { sub grow {