PrusaSlicer-NonPlainar/xs/xsp/Polygon.xsp

39 lines
1.0 KiB
Plaintext

%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Polygon.hpp"
%}
%name{Slic3r::Polygon} class Polygon {
~Polygon();
Polygon* clone()
%code{% const char* CLASS = "Slic3r::Polygon"; RETVAL = new Polygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
void scale(double factor);
void translate(double x, double y);
Lines lines();
Polyline* split_at_index(int index)
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at_index(index); %};
Polyline* split_at_first_point()
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at_first_point(); %};
%{
Polygon*
Polygon::new(...)
CODE:
RETVAL = new Polygon ();
// 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
%}
};