PrusaSlicer-NonPlainar/xs/xsp/Polyline.xsp
Alessandro Ranellucci 439255ca46 Polyline->lines
2013-07-15 23:12:13 +02:00

45 lines
994 B
Plaintext

%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Polyline.hpp"
%}
%name{Slic3r::Polyline} class Polyline {
~Polyline();
Polyline* clone()
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = new Polyline(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
void pop_back()
%code{% THIS->points.pop_back(); %};
void reverse();
Lines lines();
%{
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++) {
RETVAL->points[i-1].from_SV_check( ST(i) );
}
OUTPUT:
RETVAL
void
Polyline::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
Point p;
p.from_SV_check( ST(1) );
THIS->points.push_back(p);
}
%}
};