PrusaSlicer-NonPlainar/xs/xsp/ExPolygon.xsp
Vojtech Bubnik d4b8d4d0f3 Further Perl unit test porting to C++ and Perl interface reduction:
Ported cooling, gap fill, thin walls and polyline unit tests.
2022-05-05 17:57:57 +02:00

58 lines
1.5 KiB
Plaintext

%module{Slic3r::XS};
%{
#include <xsinit.h>
#include "libslic3r/ExPolygon.hpp"
%}
%name{Slic3r::ExPolygon} class ExPolygon {
~ExPolygon();
Clone<ExPolygon> clone()
%code{% RETVAL = THIS; %};
SV* arrayref()
%code{% RETVAL = to_AV(THIS); %};
SV* pp()
%code{% RETVAL = to_SV_pureperl(THIS); %};
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); %};
bool contains_polyline(Polyline* polyline)
%code{% RETVAL = THIS->contains(*polyline); %};
bool contains_point(Point* point)
%code{% RETVAL = THIS->contains(*point); %};
ExPolygons simplify(double tolerance);
Polygons simplify_p(double tolerance);
%{
ExPolygon*
ExPolygon::new(...)
CODE:
RETVAL = new ExPolygon ();
// ST(0) is class name, ST(1) is contour and others are holes
from_SV_check(ST(1), &RETVAL->contour);
RETVAL->holes.resize(items-2);
for (unsigned int i = 2; i < items; i++) {
from_SV_check(ST(i), &RETVAL->holes[i-2]);
}
OUTPUT:
RETVAL
void
ExPolygon::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
from_SV_check(center_sv, &center);
THIS->rotate(angle, center);
%}
};