Use XS Point everywhere

This commit is contained in:
Alessandro Ranellucci 2013-07-15 20:31:43 +02:00
parent d0701cdcd4
commit 9af2a1c007
37 changed files with 238 additions and 303 deletions

View file

@ -7,7 +7,7 @@ our $VERSION = '0.01';
use XSLoader;
XSLoader::load(__PACKAGE__, $VERSION);
package Slic3r::Point::XS;
package Slic3r::Point;
use overload
'@{}' => sub { $_[0]->arrayref };

View file

@ -9,6 +9,7 @@ extern "C" {
}
#include "Polygon.hpp"
#include <vector>
namespace Slic3r {
@ -17,7 +18,8 @@ class ExPolygon
public:
Polygon contour;
Polygons holes;
SV* arrayref();
bool in_collection;
SV* to_SV(bool pureperl = false, bool pureperl_children = false);
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
@ -52,6 +54,25 @@ ExPolygon::rotate(double angle, Point* center)
}
}
SV*
ExPolygon::to_SV(bool pureperl, bool pureperl_children)
{
if (pureperl) {
const unsigned int num_holes = this->holes.size();
AV* av = newAV();
av_extend(av, num_holes); // -1 +1
av_store(av, 0, this->contour.to_SV(pureperl_children, pureperl_children));
for (unsigned int i = 0; i < num_holes; i++) {
av_store(av, i+1, this->holes[i].to_SV(pureperl_children, pureperl_children));
}
return sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::ExPolygon", GV_ADD));
} else {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::ExPolygon::XS", this );
return sv;
}
}
void
perl2expolygon(SV* expoly_sv, ExPolygon& expoly)
{
@ -60,23 +81,23 @@ perl2expolygon(SV* expoly_sv, ExPolygon& expoly)
expoly.holes.resize(num_polygons-1);
SV** polygon_sv = av_fetch(expoly_av, 0, 0);
perl2polygon(*polygon_sv, expoly.contour);
expoly.contour.from_SV(*polygon_sv);
for (unsigned int i = 0; i < num_polygons-1; i++) {
polygon_sv = av_fetch(expoly_av, i+1, 0);
perl2polygon(*polygon_sv, expoly.holes[i]);
expoly.holes[i].from_SV(*polygon_sv);
}
}
SV*
expolygon2perl(ExPolygon& expoly) {
const unsigned int num_holes = expoly.holes.size();
AV* av = newAV();
av_extend(av, num_holes); // -1 +1
av_store(av, 0, polygon2perl(expoly.contour));
for (unsigned int i = 0; i < num_holes; i++) {
av_store(av, i+1, polygon2perl(expoly.holes[i]));
void
perl2expolygon_check(SV* expoly_sv, ExPolygon& expoly)
{
if (sv_isobject(expoly_sv) && (SvTYPE(SvRV(expoly_sv)) == SVt_PVMG)) {
// a XS ExPolygon was supplied
expoly = *(ExPolygon *)SvIV((SV*)SvRV( expoly_sv ));
} else {
// a Perl arrayref was supplied
perl2expolygon(expoly_sv, expoly);
}
return sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::ExPolygon", GV_ADD));
}
}

View file

@ -8,6 +8,7 @@ extern "C" {
#include "ppport.h"
}
#include <vector>
#include <math.h>
namespace Slic3r {
@ -17,7 +18,8 @@ class Point
public:
long x;
long y;
Point(long _x = 0, long _y = 0): x(_x), y(_y) {};
explicit Point(long _x = 0, long _y = 0): x(_x), y(_y) {};
SV* to_SV(bool pureperl = false);
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
@ -56,11 +58,18 @@ Point::coincides_with(Point* point)
}
SV*
point2perl(Point& point) {
AV* av = newAV();
av_fill(av, 1);
av_store_point_xy(av, point.x, point.y);
return sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::Point", GV_ADD));
Point::to_SV(bool pureperl) {
if (pureperl) {
AV* av = newAV();
av_fill(av, 1);
av_store(av, 0, newSViv(this->x));
av_store(av, 1, newSViv(this->y));
return newRV_noinc((SV*)av);
} else {
SV* sv = newSV(0);
sv_setref_pv( sv, "Slic3r::Point", new Point(*this) );
return sv;
}
}
void

View file

@ -8,48 +8,20 @@ extern "C" {
#include "ppport.h"
}
#include <vector>
#include "Polyline.hpp"
namespace Slic3r {
class Polygon : public Polyline {};
class Polygon : public Polyline {
protected:
char* perl_class() {
return (char*)"Slic3r::Polygon";
}
};
typedef std::vector<Polygon> Polygons;
void
perl2polygon(SV* poly_sv, Polygon& poly)
{
AV* poly_av = (AV*)SvRV(poly_sv);
const unsigned int num_points = av_len(poly_av)+1;
poly.points.resize(num_points);
for (unsigned int i = 0; i < num_points; i++) {
SV** point_sv = av_fetch(poly_av, i, 0);
perl2point(*point_sv, poly.points[i]);
}
}
void
perl2polygon_check(SV* poly_sv, Polygon& poly)
{
if (sv_isobject(poly_sv) && (SvTYPE(SvRV(poly_sv)) == SVt_PVMG)) {
poly = *(Polygon*)SvIV((SV*)SvRV( poly_sv ));
} else {
perl2polygon(poly_sv, poly);
}
}
SV*
polygon2perl(Polygon& poly) {
const unsigned int num_points = poly.points.size();
AV* av = newAV();
av_extend(av, num_points-1);
for (unsigned int i = 0; i < num_points; i++) {
av_store(av, i, point2perl(poly.points[i]));
}
return sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::Polygon", GV_ADD));
}
}
#endif

View file

@ -10,6 +10,8 @@ extern "C" {
#include "Point.hpp"
#include <algorithm>
#include <string>
#include <vector>
namespace Slic3r {
@ -17,10 +19,17 @@ class Polyline
{
public:
Points points;
void from_SV(SV* poly_sv);
void from_SV_check(SV* poly_sv);
SV* to_SV(bool pureperl = false, bool pureperl_children = false);
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center);
void reverse();
protected:
virtual char* perl_class() {
return (char*)"Slic3r::Polyline";
}
};
typedef std::vector<Polyline> Polylines;
@ -56,37 +65,37 @@ Polyline::reverse()
}
void
perl2polyline(SV* poly_sv, Polyline& poly)
Polyline::from_SV(SV* poly_sv)
{
AV* poly_av = (AV*)SvRV(poly_sv);
const unsigned int num_points = av_len(poly_av)+1;
poly.points.resize(num_points);
this->points.resize(num_points);
for (unsigned int i = 0; i < num_points; i++) {
SV** point_sv = av_fetch(poly_av, i, 0);
perl2point(*point_sv, poly.points[i]);
perl2point_check(*point_sv, this->points[i]);
}
}
void
perl2polyline_check(SV* poly_sv, Polyline& poly)
Polyline::from_SV_check(SV* poly_sv)
{
if (sv_isobject(poly_sv) && (SvTYPE(SvRV(poly_sv)) == SVt_PVMG)) {
poly = *(Polyline*)SvIV((SV*)SvRV( poly_sv ));
*this = *(Polyline*)SvIV((SV*)SvRV( poly_sv ));
} else {
perl2polyline(poly_sv, poly);
this->from_SV(poly_sv);
}
}
SV*
polyline2perl(Polyline& poly) {
const unsigned int num_points = poly.points.size();
Polyline::to_SV(bool pureperl, bool pureperl_children) {
const unsigned int num_points = this->points.size();
AV* av = newAV();
av_extend(av, num_points-1);
for (unsigned int i = 0; i < num_points; i++) {
av_store(av, i, point2perl(poly.points[i]));
av_store(av, i, this->points[i].to_SV(pureperl_children));
}
return sv_bless(newRV_noinc((SV*)av), gv_stashpv("Slic3r::Polyline", GV_ADD));
return sv_bless(newRV_noinc((SV*)av), gv_stashpv(this->perl_class(), GV_ADD));
}
}

View file

@ -1,13 +1,7 @@
#ifndef _myinit_h_
#define _myinit_h_
#include <vector>
namespace Slic3r {}
using namespace Slic3r;
#define av_store_point_xy(AV, X, Y) \
av_store(AV, 0, newSViv(X)); \
av_store(AV, 1, newSViv(Y))
#endif

View file

@ -4,13 +4,11 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 6;
use Test::More tests => 5;
my $point = Slic3r::Point::XS->new(10, 15);
my $point = Slic3r::Point->new(10, 15);
is_deeply [ @$point ], [10, 15], 'point roundtrip';
isa_ok $point->arrayref, 'Slic3r::Point', 'Perl point is blessed';
my $point2 = $point->clone;
$point2->scale(2);
is_deeply [ @$point2 ], [20, 30], 'scale';

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 13;
use Test::More tests => 15;
use constant PI => 4 * atan2(1, 1);
@ -22,15 +22,19 @@ my $hole_in_square = [ # cw
];
my $expolygon = Slic3r::ExPolygon::XS->new($square, $hole_in_square);
is_deeply [ @$expolygon ], [$square, $hole_in_square], 'expolygon roundtrip';
is_deeply [ @{$expolygon->arrayref_pp} ], [$square, $hole_in_square], 'expolygon roundtrip';
isa_ok $expolygon->arrayref, 'Slic3r::ExPolygon', 'Perl expolygon is blessed';
isa_ok $expolygon->[0], 'Slic3r::Polygon', 'Perl polygons are blessed';
isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
my $arrayref = $expolygon->arrayref;
isa_ok $arrayref, 'Slic3r::ExPolygon', 'Perl expolygon is blessed';
my $arrayref_pp = $expolygon->arrayref_pp;
isa_ok $arrayref_pp, 'Slic3r::ExPolygon', 'Perl expolygon is blessed';
isa_ok $arrayref_pp->[0], 'Slic3r::Polygon', 'Perl polygons are blessed';
isnt ref($arrayref_pp->[0][0]), 'Slic3r::Point', 'Perl polygon points are not blessed';
{
my $clone = $expolygon->clone;
is_deeply [ @$clone ], [$square, $hole_in_square], 'clone';
is_deeply [ @{$clone->arrayref_pp} ], [$square, $hole_in_square], 'clone';
# The following tests implicitely check that modifying clones
# does not modify the original one.
}
@ -38,7 +42,7 @@ isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
{
my $expolygon2 = $expolygon->clone;
$expolygon2->scale(2.5);
is_deeply [ @$expolygon2 ], [
is_deeply [ @{$expolygon2->arrayref_pp} ], [
[map [ 2.5*$_->[0], 2.5*$_->[1] ], @$square],
[map [ 2.5*$_->[0], 2.5*$_->[1] ], @$hole_in_square]
], 'scale';
@ -47,7 +51,7 @@ isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
{
my $expolygon2 = $expolygon->clone;
$expolygon2->translate(10, -5);
is_deeply [ @$expolygon2 ], [
is_deeply [ @{$expolygon2->arrayref_pp} ], [
[map [ $_->[0]+10, $_->[1]-5 ], @$square],
[map [ $_->[0]+10, $_->[1]-5 ], @$hole_in_square]
], 'translate';
@ -55,17 +59,17 @@ isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
{
my $expolygon2 = $expolygon->clone;
$expolygon2->rotate(PI/2, Slic3r::Point::XS->new(150,150));
is_deeply [ @$expolygon2 ], [
$expolygon2->rotate(PI/2, Slic3r::Point->new(150,150));
is_deeply [ @{$expolygon2->arrayref_pp} ], [
[ @$square[1,2,3,0] ],
[ @$hole_in_square[3,0,1,2] ]
], 'rotate around Point::XS';
], 'rotate around Point';
}
{
my $expolygon2 = $expolygon->clone;
$expolygon2->rotate(PI/2, [150,150]);
is_deeply [ @$expolygon2 ], [
is_deeply [ @{$expolygon2->arrayref_pp} ], [
[ @$square[1,2,3,0] ],
[ @$hole_in_square[3,0,1,2] ]
], 'rotate around pure-Perl Point';
@ -74,17 +78,19 @@ isa_ok $expolygon->[0][0], 'Slic3r::Point', 'Perl polygon points are blessed';
{
my $expolygon2 = $expolygon->clone;
$expolygon2->scale(2);
my $collection = Slic3r::ExPolygon::Collection->new($expolygon->arrayref, $expolygon2->arrayref);
is_deeply [ @$collection ], [ $expolygon->arrayref, $expolygon2->arrayref ],
my $collection = Slic3r::ExPolygon::Collection->new($expolygon->arrayref_pp, $expolygon2->arrayref_pp);
is_deeply [ @{$collection->arrayref_pp} ], [ $expolygon->arrayref_pp, $expolygon2->arrayref_pp ],
'expolygon collection';
my $collection2 = Slic3r::ExPolygon::Collection->new($expolygon, $expolygon2);
is_deeply [ @$collection ], [ @$collection2 ],
is_deeply [ @{$collection->arrayref_pp} ], [ @{$collection2->arrayref_pp} ],
'expolygon collection with XS expolygons';
$collection->clear;
is scalar(@$collection), 0, 'clear collection';
$collection->append($expolygon);
is scalar(@$collection), 1, 'append to collection';
is_deeply $collection->[0]->clone->arrayref_pp, $expolygon->arrayref_pp, 'clone collection item';
}
__END__

View file

@ -28,7 +28,7 @@ my $surface = Slic3r::Surface->new(
$surface = $surface->clone;
isa_ok $surface->expolygon, 'Slic3r::ExPolygon::XS', 'expolygon';
is_deeply [ @{$surface->expolygon} ], [$square, $hole_in_square], 'expolygon roundtrip';
is_deeply [ @{$surface->expolygon->arrayref_pp} ], [$square, $hole_in_square], 'expolygon roundtrip';
is $surface->surface_type, Slic3r::Surface::S_TYPE_INTERNAL, 'surface_type';
$surface->surface_type(Slic3r::Surface::S_TYPE_BOTTOM);
@ -43,7 +43,7 @@ is $surface->extra_perimeters, 2, 'extra_perimeters';
{
my $collection = Slic3r::Surface::Collection->new($surface, $surface->clone);
is scalar(@$collection), 2, 'collection has the right number of items';
is_deeply $collection->[0]->expolygon->arrayref, [$square, $hole_in_square],
is_deeply $collection->[0]->expolygon->arrayref_pp, [$square, $hole_in_square],
'collection returns a correct surface expolygon';
$collection->clear;
is scalar(@$collection), 0, 'clear collection';

View file

@ -14,9 +14,10 @@ my $square = [ # ccw
];
my $polygon = Slic3r::Polygon::XS->new(@$square);
is_deeply [ @$polygon ], [ @$square ], 'polygon roundtrip';
is_deeply [ @{$polygon->arrayref_pp} ], [ @$square ], 'polygon roundtrip';
isa_ok $polygon->arrayref, 'Slic3r::Polygon', 'Perl polygon is blessed';
isa_ok $polygon->[0], 'Slic3r::Point', 'Perl points are blessed';
my $arrayref = $polygon->arrayref;
isa_ok $arrayref, 'Slic3r::Polygon', 'Perl polygon is blessed';
isa_ok $arrayref->[0], 'Slic3r::Point', 'Perl points are blessed';
__END__

View file

@ -17,10 +17,10 @@ my $path = Slic3r::ExtrusionPath->new(
role => Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER,
);
isa_ok $path->as_polyline, 'Slic3r::Polyline::XS', 'path polyline';
is_deeply [ @{ $path->as_polyline } ], [ @$points ], 'path points roundtrip';
is_deeply [ @{ $path->as_polyline->arrayref_pp } ], [ @$points ], 'path points roundtrip';
$path->reverse;
is_deeply [ @{ $path->as_polyline } ], [ reverse @$points ], 'reverse path';
is_deeply [ @{ $path->as_polyline->arrayref_pp } ], [ reverse @$points ], 'reverse path';
$path->append([ 150, 150 ]);
is scalar(@{ $path }), 4, 'append to path';

View file

@ -18,7 +18,7 @@ my $loop = Slic3r::ExtrusionLoop->new(
role => Slic3r::ExtrusionPath::EXTR_ROLE_EXTERNAL_PERIMETER,
);
isa_ok $loop->as_polygon, 'Slic3r::Polygon::XS', 'loop polygon';
is_deeply [ @{ $loop->as_polygon } ], [ @$square ], 'polygon points roundtrip';
is_deeply [ @{ $loop->as_polygon->arrayref_pp } ], [ @$square ], 'polygon points roundtrip';
$loop = $loop->clone;

View file

@ -6,11 +6,12 @@
%}
%name{Slic3r::ExPolygon::XS} class ExPolygon {
~ExPolygon();
ExPolygon* clone()
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); %};
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); RETVAL->in_collection = false; %};
SV* arrayref()
%code{% RETVAL = expolygon2perl(*THIS); %};
%code{% RETVAL = THIS->to_SV(true, false); %};
SV* arrayref_pp()
%code{% RETVAL = THIS->to_SV(true, true); %};
void scale(double factor);
void translate(double x, double y);
%{
@ -20,14 +21,22 @@ ExPolygon::new(...)
CODE:
RETVAL = new ExPolygon ();
// ST(0) is class name, ST(1) is contour and others are holes
perl2polygon(ST(1), RETVAL->contour);
RETVAL->contour.from_SV_check(ST(1));
RETVAL->holes.resize(items-2);
for (unsigned int i = 2; i < items; i++) {
perl2polygon(ST(i), RETVAL->holes[i-2]);
RETVAL->holes[i-2].from_SV_check(ST(i));
}
OUTPUT:
RETVAL
void
ExPolygon::DESTROY()
CODE:
if (!THIS->in_collection) {
delete THIS;
THIS = NULL;
}
void
ExPolygon::rotate(angle, center_sv)
double angle;

View file

@ -23,13 +23,8 @@ ExPolygonCollection::new(...)
// ST(0) is class name, others are expolygons
RETVAL->expolygons.resize(items-1);
for (unsigned int i = 1; i < items; i++) {
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
// a XS ExPolygon was supplied
RETVAL->expolygons[i-1] = *(ExPolygon *)SvIV((SV*)SvRV( ST(i) ));
} else {
// a Perl arrayref was supplied
perl2expolygon(ST(i), RETVAL->expolygons[i-1]);
}
perl2expolygon_check(ST(i), RETVAL->expolygons[i-1]);
RETVAL->expolygons[i-1].in_collection = true;
}
OUTPUT:
RETVAL
@ -41,7 +36,20 @@ ExPolygonCollection::arrayref()
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
av_store(av, i++, expolygon2perl(*it));
av_store(av, i++, (*it).to_SV(false, false));
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
SV*
ExPolygonCollection::arrayref_pp()
CODE:
AV* av = newAV();
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
av_store(av, i++, (*it).to_SV(true, true));
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
@ -52,6 +60,7 @@ ExPolygonCollection::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
THIS->expolygons.push_back(*(ExPolygon *)SvIV((SV*)SvRV( ST(i) )));
THIS->expolygons.back().in_collection = true;
}
%}

View file

@ -8,11 +8,13 @@
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
~ExtrusionLoop();
SV* arrayref()
%code{% RETVAL = polygon2perl(THIS->polygon); %};
%code{% RETVAL = THIS->polygon.to_SV(true, false); %};
SV* arrayref_pp()
%code{% RETVAL = THIS->polygon.to_SV(true, true); %};
Polygon* as_polygon()
%code{% const char* CLASS = "Slic3r::Polygon::XS"; RETVAL = new Polygon(THIS->polygon); %};
void set_polygon(SV* polygon_sv)
%code{% perl2polygon_check(polygon_sv, THIS->polygon); %};
%code{% THIS->polygon.from_SV_check(polygon_sv); %};
%{
ExtrusionLoop*
@ -24,7 +26,7 @@ _new(CLASS, polygon_sv, role, height, flow_spacing)
double flow_spacing;
CODE:
RETVAL = new ExtrusionLoop ();
perl2polygon_check(polygon_sv, RETVAL->polygon);
RETVAL->polygon.from_SV_check(polygon_sv);
RETVAL->role = role;
RETVAL->height = height;
RETVAL->flow_spacing = flow_spacing;

View file

@ -8,11 +8,13 @@
%name{Slic3r::ExtrusionPath} class ExtrusionPath {
~ExtrusionPath();
SV* arrayref()
%code{% RETVAL = polyline2perl(THIS->polyline); %};
%code{% RETVAL = THIS->polyline.to_SV(true, false); %};
SV* arrayref_pp()
%code{% RETVAL = THIS->polyline.to_SV(true, true); %};
Polyline* as_polyline()
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(THIS->polyline); %};
void set_polyline(SV* polyline_sv)
%code{% perl2polyline_check(polyline_sv, THIS->polyline); %};
%code{% THIS->polyline.from_SV_check(polyline_sv); %};
void pop_back()
%code{% THIS->polyline.points.pop_back(); %};
void reverse();
@ -27,7 +29,7 @@ _new(CLASS, polyline_sv, role, height, flow_spacing)
double flow_spacing;
CODE:
RETVAL = new ExtrusionPath ();
perl2polyline_check(polyline_sv, RETVAL->polyline);
RETVAL->polyline.from_SV_check(polyline_sv);
RETVAL->role = role;
RETVAL->height = height;
RETVAL->flow_spacing = flow_spacing;

View file

@ -5,15 +5,19 @@
#include "Point.hpp"
%}
%name{Slic3r::Point::XS} class Point {
%name{Slic3r::Point} class Point {
Point(unsigned long _x = 0, unsigned long _y = 0);
~Point();
Point* clone()
%code{% const char* CLASS = "Slic3r::Point::XS"; RETVAL = new Point(*THIS); %};
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
void scale(double factor);
void translate(double x, double y);
SV* arrayref()
%code{% RETVAL = point2perl(*THIS); %};
%code{% RETVAL = THIS->to_SV(true); %};
unsigned long x()
%code{% RETVAL = THIS->x; %};
unsigned long y()
%code{% RETVAL = THIS->y; %};
%{
@ -39,16 +43,3 @@ Point::coincides_with(point_sv)
%}
};
%package{Slic3r::Point::XS};
%{
PROTOTYPES: DISABLE
std::string
hello_world()
CODE:
RETVAL = "Hello world!";
OUTPUT:
RETVAL
%}

View file

@ -10,7 +10,9 @@
Polygon* clone()
%code{% const char* CLASS = "Slic3r::Polygon::XS"; RETVAL = new Polygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = polygon2perl(*THIS); %};
%code{% RETVAL = THIS->to_SV(true, false); %};
SV* arrayref_pp()
%code{% RETVAL = THIS->to_SV(true, true); %};
%{
Polygon*

View file

@ -10,7 +10,9 @@
Polyline* clone()
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(*THIS); %};
SV* arrayref()
%code{% RETVAL = polyline2perl(*THIS); %};
%code{% RETVAL = THIS->to_SV(true, false); %};
SV* arrayref_pp()
%code{% RETVAL = THIS->to_SV(true, true); %};
void pop_back()
%code{% THIS->points.pop_back(); %};
void reverse();