Slic3r/xs/xsp/ExPolygon.xsp

44 lines
1.0 KiB
Plaintext
Raw Normal View History

2013-07-06 18:33:49 +04:00
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "ExPolygon.hpp"
%}
%name{Slic3r::ExPolygon} class ExPolygon {
2013-07-07 18:51:02 +04:00
~ExPolygon();
2013-07-14 15:11:01 +04:00
ExPolygon* clone()
%code{% const char* CLASS = "Slic3r::ExPolygon"; RETVAL = new ExPolygon(*THIS); %};
SV* arrayref()
%code{% RETVAL = THIS->to_SV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
2013-07-11 16:08:11 +04:00
void scale(double factor);
2013-07-11 20:55:51 +04:00
void translate(double x, double y);
2013-07-06 18:33:49 +04:00
%{
ExPolygon*
ExPolygon::new(...)
CODE:
RETVAL = new ExPolygon ();
// ST(0) is class name, ST(1) is contour and others are holes
2013-07-15 22:31:43 +04:00
RETVAL->contour.from_SV_check(ST(1));
2013-07-07 18:51:02 +04:00
RETVAL->holes.resize(items-2);
2013-07-06 18:33:49 +04:00
for (unsigned int i = 2; i < items; i++) {
2013-07-15 22:31:43 +04:00
RETVAL->holes[i-2].from_SV_check(ST(i));
2013-07-06 18:33:49 +04:00
}
OUTPUT:
RETVAL
void
ExPolygon::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
THIS->rotate(angle, &center);
2013-07-06 18:33:49 +04:00
%}
};