62 lines
1.4 KiB
Plaintext
62 lines
1.4 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <myinit.h>
|
|
#include "ExPolygon.hpp"
|
|
%}
|
|
|
|
%name{Slic3r::ExPolygon::XS} class ExPolygon {
|
|
~ExPolygon();
|
|
ExPolygon* clone()
|
|
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); %};
|
|
SV* arrayref()
|
|
%code{% RETVAL = expolygon2perl(*THIS); %};
|
|
void scale(double factor);
|
|
void translate(double x, double y);
|
|
%{
|
|
|
|
ExPolygon*
|
|
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->holes.resize(items-2);
|
|
for (unsigned int i = 2; i < items; i++) {
|
|
perl2polygon(ST(i), RETVAL->holes[i-2]);
|
|
}
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
ExPolygon::rotate(angle, center_sv)
|
|
double angle;
|
|
SV* center_sv;
|
|
CODE:
|
|
Point* center;
|
|
if (sv_isobject(center_sv) && (SvTYPE(SvRV(center_sv)) == SVt_PVMG)) {
|
|
center = (Point*)SvIV((SV*)SvRV( center_sv ));
|
|
THIS->rotate(angle, center);
|
|
} else {
|
|
center = new Point;
|
|
perl2point(center_sv, *center);
|
|
THIS->rotate(angle, center);
|
|
delete center;
|
|
}
|
|
|
|
%}
|
|
};
|
|
|
|
%package{Slic3r::ExPolygon::XS};
|
|
|
|
%{
|
|
PROTOTYPES: DISABLE
|
|
|
|
std::string
|
|
hello_world()
|
|
CODE:
|
|
RETVAL = "Hello world!";
|
|
OUTPUT:
|
|
RETVAL
|
|
%}
|