Fix overflow in distance_to(Line*). It was affecting Douglas-Peucker causing massive loss of geometry. Includes regression test and a couple wkt() implementations

This commit is contained in:
Alessandro Ranellucci 2014-01-17 14:22:37 +01:00
parent 3a3e53b59b
commit 0d7f0705f0
6 changed files with 35 additions and 3 deletions

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 8;
use Test::More tests => 9;
my $point = Slic3r::Point->new(10, 15);
is_deeply [ @$point ], [10, 15], 'point roundtrip';
@ -30,4 +30,13 @@ ok !$point->coincides_with($point2), 'coincides_with';
ok $nearest->coincides_with($point2), 'nearest_point';
}
{
my $line = Slic3r::Line->new(
[18335846,18335845],
[18335846,1664160],
);
$point = Slic3r::Point->new(1664161,18335848);
is $point->distance_to_line($line), 16671685, 'distance_to_line() does not overflow';
}
__END__