2013-07-06 14:33:49 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "ExPolygon.hpp"
|
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::ExPolygon::XS} class ExPolygon {
|
2013-07-14 11:11:01 +00:00
|
|
|
ExPolygon* clone()
|
2013-07-15 18:31:43 +00:00
|
|
|
%code{% const char* CLASS = "Slic3r::ExPolygon::XS"; RETVAL = new ExPolygon(*THIS); RETVAL->in_collection = false; %};
|
2013-07-13 22:38:01 +00:00
|
|
|
SV* arrayref()
|
2013-07-15 18:31:43 +00:00
|
|
|
%code{% RETVAL = THIS->to_SV(true, false); %};
|
|
|
|
SV* arrayref_pp()
|
|
|
|
%code{% RETVAL = THIS->to_SV(true, true); %};
|
2013-07-11 12:08:11 +00:00
|
|
|
void scale(double factor);
|
2013-07-11 16:55:51 +00:00
|
|
|
void translate(double x, double y);
|
2013-07-06 14:33:49 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
ExPolygon*
|
|
|
|
ExPolygon::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new ExPolygon ();
|
|
|
|
// ST(0) is class name, ST(1) is contour and others are holes
|
2013-07-15 18:31:43 +00:00
|
|
|
RETVAL->contour.from_SV_check(ST(1));
|
2013-07-07 14:51:02 +00:00
|
|
|
RETVAL->holes.resize(items-2);
|
2013-07-06 14:33:49 +00:00
|
|
|
for (unsigned int i = 2; i < items; i++) {
|
2013-07-15 18:31:43 +00:00
|
|
|
RETVAL->holes[i-2].from_SV_check(ST(i));
|
2013-07-06 14:33:49 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-15 18:31:43 +00:00
|
|
|
void
|
|
|
|
ExPolygon::DESTROY()
|
|
|
|
CODE:
|
|
|
|
if (!THIS->in_collection) {
|
|
|
|
delete THIS;
|
|
|
|
THIS = NULL;
|
|
|
|
}
|
|
|
|
|
2013-07-14 14:03:06 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2013-07-06 14:33:49 +00:00
|
|
|
%}
|
|
|
|
};
|
|
|
|
|
|
|
|
%package{Slic3r::ExPolygon::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
PROTOTYPES: DISABLE
|
|
|
|
|
|
|
|
std::string
|
|
|
|
hello_world()
|
|
|
|
CODE:
|
|
|
|
RETVAL = "Hello world!";
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
%}
|