Ported ExtrusionPath to XS. Failing test for Surface

This commit is contained in:
Alessandro Ranellucci 2013-07-15 12:14:22 +02:00
parent 8c1e1cc3ea
commit f612d4c64e
24 changed files with 501 additions and 143 deletions

45
xs/xsp/Polyline.xsp Normal file
View file

@ -0,0 +1,45 @@
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Polyline.hpp"
%}
%name{Slic3r::Polyline::XS} class Polyline {
~Polyline();
Polyline* clone()
%code{% const char* CLASS = "Slic3r::Polyline::XS"; RETVAL = new Polyline(*THIS); %};
SV* arrayref()
%code{% RETVAL = polyline2perl(*THIS); %};
void pop_back()
%code{% THIS->points.pop_back(); %};
void reverse();
%{
Polyline*
Polyline::new(...)
CODE:
RETVAL = new Polyline ();
// ST(0) is class name, ST(1) is first point
RETVAL->points.resize(items-1);
for (unsigned int i = 1; i < items; i++) {
perl2point(ST(i), RETVAL->points[i-1]);
}
OUTPUT:
RETVAL
void
Polyline::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
Point p;
if (sv_isobject(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PVMG)) {
p = *(Point*)SvIV((SV*)SvRV( ST(i) ));
} else {
perl2point(ST(i), p);
}
THIS->points.push_back(p);
}
%}
};