2013-07-15 12:14:22 +02:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-08 00:39:54 +01:00
|
|
|
#include <xsinit.h>
|
2014-08-03 19:42:29 +02:00
|
|
|
#include "libslic3r/BoundingBox.hpp"
|
|
|
|
#include "libslic3r/ClipperUtils.hpp"
|
|
|
|
#include "libslic3r/Polyline.hpp"
|
2013-07-15 12:14:22 +02:00
|
|
|
%}
|
|
|
|
|
2013-07-15 22:57:22 +02:00
|
|
|
%name{Slic3r::Polyline} class Polyline {
|
2013-07-15 12:14:22 +02:00
|
|
|
~Polyline();
|
2014-04-27 19:18:53 +02:00
|
|
|
Clone<Polyline> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-15 12:14:22 +02:00
|
|
|
SV* arrayref()
|
2015-12-08 00:39:54 +01:00
|
|
|
%code{% RETVAL = to_AV(THIS); %};
|
2013-07-15 22:57:22 +02:00
|
|
|
SV* pp()
|
2015-12-08 00:39:54 +01:00
|
|
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
2013-07-16 09:49:34 +02:00
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
2013-07-15 12:14:22 +02:00
|
|
|
void pop_back()
|
|
|
|
%code{% THIS->points.pop_back(); %};
|
|
|
|
void reverse();
|
2013-09-13 15:19:15 +02:00
|
|
|
Lines lines();
|
2014-04-27 19:18:53 +02:00
|
|
|
Clone<Point> first_point();
|
|
|
|
Clone<Point> last_point();
|
2015-01-19 18:53:04 +01:00
|
|
|
Points equally_spaced_points(double distance);
|
2013-10-27 22:57:25 +01:00
|
|
|
double length();
|
2013-11-06 19:30:45 +01:00
|
|
|
bool is_valid();
|
2013-10-27 22:57:25 +01:00
|
|
|
void clip_end(double distance);
|
2013-11-06 19:30:45 +01:00
|
|
|
void clip_start(double distance);
|
2014-03-15 16:53:20 +01:00
|
|
|
void extend_end(double distance);
|
|
|
|
void extend_start(double distance);
|
2013-11-21 20:25:24 +01:00
|
|
|
void simplify(double tolerance);
|
2015-01-06 20:52:36 +01:00
|
|
|
void simplify_by_visibility(ExPolygon* expolygon)
|
|
|
|
%code{% THIS->simplify_by_visibility(*expolygon); %};
|
2014-05-22 12:28:12 +02:00
|
|
|
void split_at(Point* point, Polyline* p1, Polyline* p2)
|
|
|
|
%code{% THIS->split_at(*point, p1, p2); %};
|
2014-11-15 23:06:15 +01:00
|
|
|
bool is_straight();
|
2015-01-19 18:53:04 +01:00
|
|
|
Clone<BoundingBox> bounding_box();
|
2015-01-25 15:21:45 +01:00
|
|
|
void remove_duplicate_points();
|
2013-07-15 12:14:22 +02: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++) {
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
2013-07-15 12:14:22 +02:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
void
|
|
|
|
Polyline::append(...)
|
|
|
|
CODE:
|
|
|
|
for (unsigned int i = 1; i < items; i++) {
|
|
|
|
Point p;
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(ST(i), &p);
|
2013-07-15 12:14:22 +02:00
|
|
|
THIS->points.push_back(p);
|
|
|
|
}
|
|
|
|
|
2013-08-29 01:36:42 +02: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 09:49:34 +02:00
|
|
|
void
|
|
|
|
Polyline::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
2015-12-08 00:39:54 +01:00
|
|
|
from_SV_check(center_sv, ¢er);
|
2014-04-24 13:43:24 +02:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-16 09:49:34 +02:00
|
|
|
|
2013-11-20 11:35:58 +01:00
|
|
|
Polygons
|
2016-11-28 17:33:17 +01:00
|
|
|
Polyline::grow(delta, joinType = ClipperLib::jtSquare, miterLimit = 3)
|
2013-11-20 11:35:58 +01:00
|
|
|
const float delta
|
|
|
|
ClipperLib::JoinType joinType
|
|
|
|
double miterLimit
|
|
|
|
CODE:
|
2016-12-13 19:22:23 +01:00
|
|
|
RETVAL = offset(*THIS, delta, joinType, miterLimit);
|
2013-11-20 11:35:58 +01:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-15 12:14:22 +02:00
|
|
|
%}
|
|
|
|
};
|