PrusaSlicer-NonPlainar/xs/xsp/ExPolygon.xsp
Vojtech Bubnik 2e55898d78 Removal of not numerically robust libraries "poly2tree" and "polypartition".
Adjustment of GUI/3DBed.cpp,hpp to use the more stable triangulation algoritm
derived from SGI glut.
Fix of an extremely slow bridging calculation, caused by an extremely
slow bridged area detection function, of which the results were never used.
Fixes "slicing fails or takes too long #5974"
2021-02-09 18:36:28 +01:00

60 lines
1.6 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);
Polylines medial_axis(double max_width, double min_width)
%code{% THIS->medial_axis(max_width, min_width, &RETVAL); %};
%{
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);
%}
};