Failing test cases for Clipper bug returning empty result set. #2028
This commit is contained in:
parent
70ceb853f1
commit
fcdb462abe
3 changed files with 29 additions and 2 deletions
|
@ -302,7 +302,7 @@ sub make_perimeters {
|
|||
height => $self->height,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
# reapply the nearest point search for starting point
|
||||
# (clone because the collection gets DESTROY'ed)
|
||||
# We allow polyline reversal because Clipper may have randomly
|
||||
|
|
|
@ -15,6 +15,11 @@ sub wkt {
|
|||
return sprintf "POLYGON((%s))", join ',', map "$_->[0] $_->[1]", @$self;
|
||||
}
|
||||
|
||||
sub dump_perl {
|
||||
my $self = shift;
|
||||
return sprintf "[%s]", join ',', map "[$_->[0],$_->[1]]", @$self;
|
||||
}
|
||||
|
||||
sub grow {
|
||||
my $self = shift;
|
||||
return $self->split_at_first_point->grow(@_);
|
||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
|||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 17;
|
||||
use Test::More tests => 19;
|
||||
|
||||
my $square = Slic3r::Polygon->new( # ccw
|
||||
[200, 100],
|
||||
|
@ -155,4 +155,26 @@ if (0) { # Clipper does not preserve polyline orientation
|
|||
}
|
||||
}
|
||||
|
||||
{
|
||||
my $subject = Slic3r::Polyline->new(
|
||||
[44735000,31936670],[55270000,31936670],[55270000,25270000],[74730000,25270000],[74730000,44730000],[68063296,44730000],[68063296,55270000],[74730000,55270000],[74730000,74730000],[55270000,74730000],[55270000,68063296],[44730000,68063296],[44730000,74730000],[25270000,74730000],[25270000,55270000],[31936670,55270000],[31936670,44730000],[25270000,44730000],[25270000,25270000],[44730000,25270000],[44730000,31936670]
|
||||
);
|
||||
my $clip = [
|
||||
Slic3r::Polygon->new([75200000,45200000],[54800000,45200000],[54800000,24800000],[75200000,24800000]),
|
||||
];
|
||||
my $result = Slic3r::Geometry::Clipper::intersection_pl([$subject], $clip);
|
||||
is scalar(@$result), 1, 'intersection_pl - result is not empty';
|
||||
}
|
||||
|
||||
{
|
||||
my $subject = Slic3r::Polygon->new(
|
||||
[44730000,31936670],[55270000,31936670],[55270000,25270000],[74730000,25270000],[74730000,44730000],[68063296,44730000],[68063296,55270000],[74730000,55270000],[74730000,74730000],[55270000,74730000],[55270000,68063296],[44730000,68063296],[44730000,74730000],[25270000,74730000],[25270000,55270000],[31936670,55270000],[31936670,44730000],[25270000,44730000],[25270000,25270000],[44730000,25270000]
|
||||
);
|
||||
my $clip = [
|
||||
Slic3r::Polygon->new([75200000,45200000],[54800000,45200000],[54800000,24800000],[75200000,24800000]),
|
||||
];
|
||||
my $result = Slic3r::Geometry::Clipper::intersection_ppl([$subject], $clip);
|
||||
is scalar(@$result), 1, 'intersection_ppl - result is not empty';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
|
Loading…
Reference in a new issue