2013-07-06 16:33:49 +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/ExPolygon.hpp"
|
2013-07-06 16:33:49 +02:00
|
|
|
%}
|
|
|
|
|
2013-07-15 22:57:22 +02:00
|
|
|
%name{Slic3r::ExPolygon} class ExPolygon {
|
2013-07-07 16:51:02 +02:00
|
|
|
~ExPolygon();
|
2014-04-27 19:18:53 +02:00
|
|
|
Clone<ExPolygon> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-14 00:38:01 +02:00
|
|
|
SV* arrayref()
|
2015-12-08 00:39:54 +01:00
|
|
|
%code{% RETVAL = to_AV(THIS); %};
|
2013-07-15 22:57:22 +02:00
|
|
|
SV* pp()
|
2015-12-08 00:39:54 +01:00
|
|
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
2014-04-27 19:18:53 +02:00
|
|
|
Ref<Polygon> contour()
|
|
|
|
%code{% RETVAL = &(THIS->contour); %};
|
2013-09-02 20:22:20 +02:00
|
|
|
Polygons* holes()
|
|
|
|
%code{% RETVAL = &(THIS->holes); %};
|
2013-07-11 14:08:11 +02:00
|
|
|
void scale(double factor);
|
2013-07-11 18:55:51 +02:00
|
|
|
void translate(double x, double y);
|
2013-08-26 22:50:26 +02:00
|
|
|
double area();
|
2013-08-26 23:27:51 +02:00
|
|
|
bool is_valid();
|
2014-04-24 16:40:10 +02:00
|
|
|
bool contains_line(Line* line)
|
2014-11-23 20:14:13 +01:00
|
|
|
%code{% RETVAL = THIS->contains(*line); %};
|
2014-05-13 20:06:01 +02:00
|
|
|
bool contains_polyline(Polyline* polyline)
|
2014-11-23 20:14:13 +01:00
|
|
|
%code{% RETVAL = THIS->contains(*polyline); %};
|
2014-04-24 16:40:10 +02:00
|
|
|
bool contains_point(Point* point)
|
2014-11-23 20:14:13 +01:00
|
|
|
%code{% RETVAL = THIS->contains(*point); %};
|
2013-11-22 02:16:10 +01:00
|
|
|
ExPolygons simplify(double tolerance);
|
|
|
|
Polygons simplify_p(double tolerance);
|
2014-03-09 17:46:02 +01:00
|
|
|
Polylines medial_axis(double max_width, double min_width)
|
|
|
|
%code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
|
2014-04-24 13:43:24 +02:00
|
|
|
Polygons get_trapezoids(double angle)
|
|
|
|
%code{% THIS->get_trapezoids(&RETVAL, angle); %};
|
2014-04-28 20:14:20 +02:00
|
|
|
Polygons get_trapezoids2(double angle)
|
|
|
|
%code{% THIS->get_trapezoids2(&RETVAL, angle); %};
|
2014-04-24 17:06:16 +02:00
|
|
|
Polygons triangulate()
|
|
|
|
%code{% THIS->triangulate(&RETVAL); %};
|
2014-05-01 10:37:38 +02:00
|
|
|
Polygons triangulate_pp()
|
|
|
|
%code{% THIS->triangulate_pp(&RETVAL); %};
|
2013-07-06 16:33:49 +02:00
|
|
|
%{
|
|
|
|
|
|
|
|
ExPolygon*
|
|
|
|
ExPolygon::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new ExPolygon ();
|
|
|
|
// ST(0) is class name, ST(1) is contour and others are holes
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(ST(1), &RETVAL->contour);
|
2013-07-07 16:51:02 +02:00
|
|
|
RETVAL->holes.resize(items-2);
|
2013-07-06 16:33:49 +02:00
|
|
|
for (unsigned int i = 2; i < items; i++) {
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(ST(i), &RETVAL->holes[i-2]);
|
2013-07-06 16:33:49 +02:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-14 16:03:06 +02:00
|
|
|
void
|
|
|
|
ExPolygon::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
2013-07-15 22:57:22 +02:00
|
|
|
Point center;
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(center_sv, ¢er);
|
2014-04-24 13:43:24 +02:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-14 16:03:06 +02:00
|
|
|
|
2013-07-06 16:33:49 +02:00
|
|
|
%}
|
|
|
|
};
|