2013-07-15 10:14:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/BoundingBox.hpp"
|
|
|
|
#include "libslic3r/ClipperUtils.hpp"
|
|
|
|
#include "libslic3r/Polyline.hpp"
|
2013-07-15 10:14:22 +00:00
|
|
|
%}
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%name{Slic3r::Polyline} class Polyline {
|
2013-07-15 10:14:22 +00:00
|
|
|
~Polyline();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Polyline> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-15 10:14:22 +00:00
|
|
|
SV* arrayref()
|
2013-09-09 20:27:58 +00:00
|
|
|
%code{% RETVAL = THIS->to_AV(); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
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-09-13 13:19:15 +00:00
|
|
|
Lines lines();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Point> first_point();
|
|
|
|
Clone<Point> last_point();
|
2014-05-07 10:02:09 +00:00
|
|
|
Points equally_spaced_points(double distance)
|
|
|
|
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
|
2013-10-27 21:57:25 +00:00
|
|
|
double length();
|
2013-11-06 18:30:45 +00:00
|
|
|
bool is_valid();
|
2013-10-27 21:57:25 +00:00
|
|
|
void clip_end(double distance);
|
2013-11-06 18:30:45 +00:00
|
|
|
void clip_start(double distance);
|
2014-03-15 15:53:20 +00:00
|
|
|
void extend_end(double distance);
|
|
|
|
void extend_start(double distance);
|
2013-11-21 19:25:24 +00:00
|
|
|
void simplify(double tolerance);
|
2014-05-22 10:28:12 +00:00
|
|
|
void split_at(Point* point, Polyline* p1, Polyline* p2)
|
|
|
|
%code{% THIS->split_at(*point, p1, p2); %};
|
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);
|
2014-04-24 11:43:24 +00:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-16 07:49:34 +00:00
|
|
|
|
2013-11-20 10:35:58 +00:00
|
|
|
Polygons
|
|
|
|
Polyline::grow(delta, scale = CLIPPER_OFFSET_SCALE, joinType = ClipperLib::jtSquare, miterLimit = 3)
|
|
|
|
const float delta
|
|
|
|
double scale
|
|
|
|
ClipperLib::JoinType joinType
|
|
|
|
double miterLimit
|
|
|
|
CODE:
|
|
|
|
Polylines polylines;
|
|
|
|
polylines.push_back(*THIS);
|
|
|
|
offset(polylines, RETVAL, delta, scale, joinType, miterLimit);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
%}
|
|
|
|
};
|