Ported Surface->p

This commit is contained in:
Alessandro Ranellucci 2013-08-26 23:03:00 +02:00
parent 494ed5c5ad
commit 85011dfef3
3 changed files with 13 additions and 2 deletions

View File

@ -45,7 +45,7 @@ sub simplify {
sub p { sub p {
my $self = shift; my $self = shift;
return @{$self->expolygon->pp}; return @{$self->polygons};
} }
sub is_solid { sub is_solid {

View File

@ -4,7 +4,7 @@ use strict;
use warnings; use warnings;
use Slic3r::XS; use Slic3r::XS;
use Test::More tests => 11; use Test::More tests => 12;
my $square = [ # ccw my $square = [ # ccw
[100, 100], [100, 100],
@ -29,6 +29,7 @@ $surface = $surface->clone;
isa_ok $surface->expolygon, 'Slic3r::ExPolygon', 'expolygon'; isa_ok $surface->expolygon, 'Slic3r::ExPolygon', 'expolygon';
is_deeply [ @{$surface->expolygon->pp} ], [$square, $hole_in_square], 'expolygon roundtrip'; is_deeply [ @{$surface->expolygon->pp} ], [$square, $hole_in_square], 'expolygon roundtrip';
is scalar(@{$surface->polygons}), 2, 'polygons roundtrip';
is $surface->surface_type, Slic3r::Surface::S_TYPE_INTERNAL, 'surface_type'; is $surface->surface_type, Slic3r::Surface::S_TYPE_INTERNAL, 'surface_type';
$surface->surface_type(Slic3r::Surface::S_TYPE_BOTTOM); $surface->surface_type(Slic3r::Surface::S_TYPE_BOTTOM);

View File

@ -67,6 +67,16 @@ Surface::extra_perimeters(...)
OUTPUT: OUTPUT:
RETVAL RETVAL
Polygons
Surface::polygons()
CODE:
RETVAL.push_back(THIS->expolygon.contour);
for (Polygons::iterator it = THIS->expolygon.holes.begin(); it != THIS->expolygon.holes.end(); ++it) {
RETVAL.push_back((*it));
}
OUTPUT:
RETVAL
%} %}
}; };