PrusaSlicer-NonPlainar/xs/xsp/ExPolygon.xsp

65 lines
1.8 KiB
Plaintext
Raw Normal View History

2013-07-06 14:33:49 +00:00
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "ExPolygon.hpp"
#include "perlglue.hpp"
2013-07-06 14:33:49 +00:00
%}
%name{Slic3r::ExPolygon} class ExPolygon {
2013-07-07 14:51:02 +00:00
~ExPolygon();
Clone<ExPolygon> clone()
%code{% RETVAL = THIS; %};
SV* arrayref()
%code{% RETVAL = THIS->to_AV(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
Ref<Polygon> contour()
%code{% RETVAL = &(THIS->contour); %};
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();
bool is_valid();
bool contains_line(Line* line)
%code{% RETVAL = THIS->contains_line(*line); %};
bool contains_point(Point* point)
%code{% RETVAL = THIS->contains_point(*point); %};
2013-11-22 01:16:10 +00:00
ExPolygons simplify(double tolerance);
Polygons simplify_p(double tolerance);
Polylines medial_axis(double max_width, double min_width)
%code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
Polygons get_trapezoids(double angle)
%code{% THIS->get_trapezoids(&RETVAL, angle); %};
2014-04-24 15:06:16 +00:00
Polygons triangulate()
%code{% THIS->triangulate(&RETVAL); %};
2014-04-25 10:40:21 +00:00
Polygons triangulate2()
%code{% THIS->triangulate2(&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
2013-07-15 18:31:43 +00:00
RETVAL->contour.from_SV_check(ST(1));
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++) {
2013-07-15 18:31:43 +00:00
RETVAL->holes[i-2].from_SV_check(ST(i));
2013-07-06 14:33:49 +00:00
}
OUTPUT:
RETVAL
void
ExPolygon::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
THIS->rotate(angle, center);
2013-07-06 14:33:49 +00:00
%}
};