PrusaSlicer-NonPlainar/xs/xsp/ExPolygon.xsp

67 lines
1.9 KiB
Plaintext

%module{Slic3r::XS};
%{
#include <myinit.h>
#include "ExPolygon.hpp"
#include "perlglue.hpp"
%}
%name{Slic3r::ExPolygon} class ExPolygon {
~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); %};
void scale(double factor);
void translate(double x, double y);
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); %};
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); %};
Polygons get_trapezoids2(double angle)
%code{% THIS->get_trapezoids2(&RETVAL, angle); %};
Polygons triangulate()
%code{% THIS->triangulate(&RETVAL); %};
Polygons triangulate2()
%code{% THIS->triangulate2(&RETVAL); %};
%{
ExPolygon*
ExPolygon::new(...)
CODE:
RETVAL = new ExPolygon ();
// ST(0) is class name, ST(1) is contour and others are holes
RETVAL->contour.from_SV_check(ST(1));
RETVAL->holes.resize(items-2);
for (unsigned int i = 2; i < items; i++) {
RETVAL->holes[i-2].from_SV_check(ST(i));
}
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);
%}
};