2013-07-15 10:14:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "Polyline.hpp"
|
|
|
|
%}
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%name{Slic3r::Polyline} class Polyline {
|
2013-07-15 10:14:22 +00:00
|
|
|
~Polyline();
|
|
|
|
Polyline* clone()
|
2013-07-15 20:57:22 +00:00
|
|
|
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = new Polyline(*THIS); %};
|
2013-07-15 10:14:22 +00:00
|
|
|
SV* arrayref()
|
2013-07-15 20:57:22 +00:00
|
|
|
%code{% RETVAL = THIS->to_SV(); %};
|
|
|
|
SV* pp()
|
|
|
|
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
2013-07-16 07:49:34 +00:00
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
2013-07-15 10:14:22 +00:00
|
|
|
void pop_back()
|
|
|
|
%code{% THIS->points.pop_back(); %};
|
|
|
|
void reverse();
|
2013-07-15 21:12:13 +00:00
|
|
|
Lines lines();
|
2013-08-26 22:52:20 +00:00
|
|
|
Point* first_point()
|
|
|
|
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->first_point())); %};
|
2013-08-28 23:36:42 +00:00
|
|
|
Point* last_point()
|
|
|
|
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->last_point())); %};
|
2013-07-15 10:14:22 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
Polyline*
|
|
|
|
Polyline::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new Polyline ();
|
|
|
|
// ST(0) is class name, ST(1) is first point
|
|
|
|
RETVAL->points.resize(items-1);
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
2013-07-15 20:57:22 +00:00
|
|
|
RETVAL->points[i-1].from_SV_check( ST(i) );
|
2013-07-15 10:14:22 +00:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
void
|
|
|
|
Polyline::append(...)
|
|
|
|
CODE:
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
Point p;
|
2013-07-16 15:13:01 +00:00
|
|
|
p.from_SV_check( ST(i) );
|
2013-07-15 10:14:22 +00:00
|
|
|
THIS->points.push_back(p);
|
|
|
|
}
|
|
|
|
|
2013-08-28 23:36:42 +00:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2013-07-16 07:49:34 +00:00
|
|
|
void
|
|
|
|
Polyline::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
|
|
|
center.from_SV_check(center_sv);
|
|
|
|
THIS->rotate(angle, ¢er);
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
%}
|
|
|
|
};
|