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-07 14:51:02 +00:00
|
|
|
~ExPolygon();
|
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-07 14:51:02 +00:00
|
|
|
perl2polygon(ST(1), RETVAL->contour);
|
|
|
|
RETVAL->holes.resize(items-2);
|
2013-07-06 14:33:49 +00:00
|
|
|
for (unsigned int i = 2; i < items; i++) {
|
2013-07-07 14:51:02 +00:00
|
|
|
perl2polygon(ST(i), RETVAL->holes[i-2]);
|
2013-07-06 14:33:49 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
SV*
|
2013-07-07 10:41:54 +00:00
|
|
|
ExPolygon::arrayref()
|
2013-07-06 14:33:49 +00:00
|
|
|
CODE:
|
|
|
|
const unsigned int num_holes = THIS->holes.size();
|
|
|
|
AV* av = newAV();
|
|
|
|
av_fill(av, num_holes); // -1 +1
|
|
|
|
av_store(av, 0, polygon2perl(THIS->contour));
|
|
|
|
for (unsigned int i = 0; i < num_holes; i++) {
|
|
|
|
av_store(av, i+1, polygon2perl(THIS->holes[i]));
|
|
|
|
}
|
|
|
|
RETVAL = (SV*)newRV_noinc((SV*)av);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
%}
|
|
|
|
};
|
|
|
|
|
|
|
|
%package{Slic3r::ExPolygon::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
PROTOTYPES: DISABLE
|
|
|
|
|
|
|
|
std::string
|
|
|
|
hello_world()
|
|
|
|
CODE:
|
|
|
|
RETVAL = "Hello world!";
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
%}
|