Files
OrcaSlicer-bambulab/xs/xsp/ExPolygonCollection.xsp
T

82 lines
2.3 KiB
Plaintext
Raw Normal View History

2013-07-14 00:38:01 +02:00
%module{Slic3r::XS};
%{
2015-12-08 00:39:54 +01:00
#include <xsinit.h>
2014-08-03 19:42:29 +02:00
#include "libslic3r/ExPolygonCollection.hpp"
2013-07-14 00:38:01 +02:00
%}
%name{Slic3r::ExPolygon::Collection} class ExPolygonCollection {
~ExPolygonCollection();
2014-04-27 19:18:53 +02:00
Clone<ExPolygonCollection> clone()
%code{% RETVAL = THIS; %};
void clear()
%code{% THIS->expolygons.clear(); %};
2013-07-14 00:38:01 +02:00
void scale(double factor);
void translate(double x, double y);
void rotate(double angle, Point* center)
%code{% THIS->rotate(angle, *center); %};
int count()
%code{% RETVAL = THIS->expolygons.size(); %};
bool contains_point(Point* point)
%code{% RETVAL = THIS->contains(*point); %};
bool contains_line(Line* line)
%code{% RETVAL = THIS->contains(*line); %};
bool contains_polyline(Polyline* polyline)
%code{% RETVAL = THIS->contains(*polyline); %};
void simplify(double tolerance);
Polygons polygons()
%code{% RETVAL = (Polygons)*THIS; %};
Clone<Polygon> convex_hull();
2013-07-14 00:38:01 +02:00
%{
ExPolygonCollection*
ExPolygonCollection::new(...)
CODE:
RETVAL = new ExPolygonCollection ();
// ST(0) is class name, others are expolygons
RETVAL->expolygons.resize(items-1);
for (unsigned int i = 1; i < items; i++) {
// Note: a COPY of the input is stored
2015-12-08 00:39:54 +01:00
from_SV_check(ST(i), &RETVAL->expolygons[i-1]);
2013-07-14 00:38:01 +02:00
}
OUTPUT:
RETVAL
SV*
ExPolygonCollection::arrayref()
CODE:
AV* av = newAV();
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
2013-08-08 02:10:34 +02:00
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
av_store(av, i++, perl_to_SV_ref(*it));
2013-07-15 20:31:43 +02:00
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
SV*
ExPolygonCollection::pp()
2013-07-15 20:31:43 +02:00
CODE:
AV* av = newAV();
av_fill(av, THIS->expolygons.size()-1);
int i = 0;
2013-08-08 02:10:34 +02:00
for (ExPolygons::iterator it = THIS->expolygons.begin(); it != THIS->expolygons.end(); ++it) {
2015-12-08 00:39:54 +01:00
av_store(av, i++, to_SV_pureperl(&*it));
2013-07-14 00:38:01 +02:00
}
RETVAL = newRV_noinc((SV*)av);
OUTPUT:
RETVAL
void
ExPolygonCollection::append(...)
CODE:
for (unsigned int i = 1; i < items; i++) {
2013-08-08 02:10:34 +02:00
ExPolygon expolygon;
2015-12-08 00:39:54 +01:00
from_SV_check(ST(i), &expolygon);
THIS->expolygons.push_back(expolygon);
}
2013-07-14 00:38:01 +02:00
%}
};