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