2013-07-15 14:14:22 +04:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
2014-05-26 19:13:24 +04:00
|
|
|
#include "BoundingBox.hpp"
|
2013-07-15 14:14:22 +04:00
|
|
|
#include "Polygon.hpp"
|
2014-05-25 01:55:13 +04:00
|
|
|
#include "BoundingBox.hpp"
|
2013-07-15 14:14:22 +04:00
|
|
|
%}
|
|
|
|
|
2013-07-16 00:57:22 +04:00
|
|
|
%name{Slic3r::Polygon} class Polygon {
|
2013-07-15 14:14:22 +04:00
|
|
|
~Polygon();
|
2014-04-27 21:18:53 +04:00
|
|
|
Clone<Polygon> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-15 14:14:22 +04:00
|
|
|
SV* arrayref()
|
2013-09-10 00:27:58 +04:00
|
|
|
%code{% RETVAL = THIS->to_AV(); %};
|
2013-07-16 00:57:22 +04:00
|
|
|
SV* pp()
|
|
|
|
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
2013-07-16 19:13:01 +04:00
|
|
|
void reverse();
|
2013-07-16 01:28:23 +04:00
|
|
|
Lines lines();
|
2014-05-22 14:28:12 +04:00
|
|
|
Polyline* split_at_vertex(Point* point)
|
|
|
|
%code{% RETVAL = new Polyline(); THIS->split_at_vertex(*point, RETVAL); %};
|
2013-07-16 01:38:06 +04:00
|
|
|
Polyline* split_at_index(int index)
|
2014-05-07 14:02:09 +04:00
|
|
|
%code{% RETVAL = new Polyline(); THIS->split_at_index(index, RETVAL); %};
|
2013-07-16 01:38:06 +04:00
|
|
|
Polyline* split_at_first_point()
|
2014-05-07 14:02:09 +04:00
|
|
|
%code{% RETVAL = new Polyline(); THIS->split_at_first_point(RETVAL); %};
|
|
|
|
Points equally_spaced_points(double distance)
|
|
|
|
%code{% THIS->equally_spaced_points(distance, &RETVAL); %};
|
2013-10-28 01:57:25 +04:00
|
|
|
double length();
|
2013-08-27 00:44:40 +04:00
|
|
|
double area();
|
2013-07-16 23:04:14 +04:00
|
|
|
bool is_counter_clockwise();
|
2013-08-27 03:26:44 +04:00
|
|
|
bool is_clockwise();
|
2013-07-16 23:09:29 +04:00
|
|
|
bool make_counter_clockwise();
|
|
|
|
bool make_clockwise();
|
2013-08-27 01:27:51 +04:00
|
|
|
bool is_valid();
|
2014-04-27 21:18:53 +04:00
|
|
|
Clone<Point> first_point();
|
2014-04-24 18:40:10 +04:00
|
|
|
bool contains_point(Point* point)
|
|
|
|
%code{% RETVAL = THIS->contains_point(*point); %};
|
2013-11-22 19:19:15 +04:00
|
|
|
Polygons simplify(double tolerance);
|
2014-04-24 18:59:36 +04:00
|
|
|
Polygons triangulate_convex()
|
|
|
|
%code{% THIS->triangulate_convex(&RETVAL); %};
|
2014-05-22 21:34:49 +04:00
|
|
|
Clone<Point> centroid();
|
|
|
|
BoundingBox* bounding_box()
|
|
|
|
%code{%
|
|
|
|
RETVAL = new BoundingBox();
|
|
|
|
THIS->bounding_box(RETVAL);
|
|
|
|
%};
|
2013-07-15 14:14:22 +04: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-16 00:57:22 +04:00
|
|
|
RETVAL->points[i-1].from_SV_check( ST(i) );
|
2013-07-15 14:14:22 +04:00
|
|
|
}
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-16 11:49:34 +04:00
|
|
|
void
|
|
|
|
Polygon::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
|
|
|
center.from_SV_check(center_sv);
|
2014-04-24 15:43:24 +04:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-16 11:49:34 +04:00
|
|
|
|
2013-07-15 14:14:22 +04:00
|
|
|
%}
|
|
|
|
};
|