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