%module{Slic3r::XS}; %{ #include #include "libslic3r/ExPolygon.hpp" %} %name{Slic3r::ExPolygon} class ExPolygon { ~ExPolygon(); Clone clone() %code{% RETVAL = THIS; %}; SV* arrayref() %code{% RETVAL = to_AV(THIS); %}; SV* pp() %code{% RETVAL = to_SV_pureperl(THIS); %}; Ref 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, ¢er); THIS->rotate(angle, center); %} };