2013-07-15 10:14:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "Polygon.hpp"
|
|
|
|
%}
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%name{Slic3r::Polygon} class Polygon {
|
2013-07-15 10:14:22 +00:00
|
|
|
~Polygon();
|
|
|
|
Polygon* clone()
|
2013-07-15 20:57:22 +00:00
|
|
|
%code{% const char* CLASS = "Slic3r::Polygon"; RETVAL = new Polygon(*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(); %};
|
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
2013-07-16 15:13:01 +00:00
|
|
|
void reverse();
|
2013-07-15 21:28:23 +00:00
|
|
|
Lines lines();
|
2013-08-26 20:39:35 +00:00
|
|
|
Polyline* split_at(Point* point)
|
|
|
|
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at(point); %};
|
2013-07-15 21:38:06 +00:00
|
|
|
Polyline* split_at_index(int index)
|
|
|
|
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at_index(index); %};
|
|
|
|
Polyline* split_at_first_point()
|
|
|
|
%code{% const char* CLASS = "Slic3r::Polyline"; RETVAL = THIS->split_at_first_point(); %};
|
2013-11-11 19:59:58 +00:00
|
|
|
Points equally_spaced_points(double distance);
|
2013-10-27 21:57:25 +00:00
|
|
|
double length();
|
2013-08-26 20:44:40 +00:00
|
|
|
double area();
|
2013-07-16 19:04:14 +00:00
|
|
|
bool is_counter_clockwise();
|
2013-08-26 23:26:44 +00:00
|
|
|
bool is_clockwise();
|
2013-07-16 19:09:29 +00:00
|
|
|
bool make_counter_clockwise();
|
|
|
|
bool make_clockwise();
|
2013-08-26 21:27:51 +00:00
|
|
|
bool is_valid();
|
2013-08-26 22:52:20 +00:00
|
|
|
Point* first_point()
|
2013-09-03 17:26:58 +00:00
|
|
|
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = THIS->first_point(); %};
|
2013-07-15 10:14:22 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
Polygon*
|
|
|
|
Polygon::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new Polygon ();
|
|
|
|
// 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
|
|
|
|
|
2013-07-16 07:49:34 +00:00
|
|
|
void
|
|
|
|
Polygon::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
|
|
|
%}
|
|
|
|
};
|