Optimizations for better usage of XS code

This commit is contained in:
Alessandro Ranellucci 2013-08-29 01:36:42 +02:00
parent 9254ff9704
commit 5d6fd7f4d9
22 changed files with 68 additions and 42 deletions

View file

@ -18,6 +18,8 @@
%code{% RETVAL = THIS->polyline.lines(); %};
Point* first_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->first_point())); %};
Point* last_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->last_point())); %};
%{
ExtrusionPath*

View file

@ -21,6 +21,8 @@
void scale(double factor);
void translate(double x, double y);
double length();
Point* midpoint()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->midpoint(); %};
%{
Line*

View file

@ -21,6 +21,8 @@
Lines lines();
Point* first_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->first_point())); %};
Point* last_point()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->last_point())); %};
%{
Polyline*
@ -44,6 +46,14 @@ Polyline::append(...)
THIS->points.push_back(p);
}
void
Polyline::append_polyline(polyline)
Polyline* polyline;
CODE:
for (Points::const_iterator it = polyline->points.begin(); it != polyline->points.end(); ++it) {
THIS->points.push_back((*it));
}
void
Polyline::rotate(angle, center_sv)
double angle;