2013-07-15 10:14:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-07 23:39:54 +00:00
|
|
|
#include <xsinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/BoundingBox.hpp"
|
|
|
|
#include "libslic3r/Polygon.hpp"
|
|
|
|
#include "libslic3r/BoundingBox.hpp"
|
2013-07-15 10:14:22 +00:00
|
|
|
%}
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%name{Slic3r::Polygon} class Polygon {
|
2013-07-15 10:14:22 +00:00
|
|
|
~Polygon();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Polygon> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-15 10:14:22 +00:00
|
|
|
SV* arrayref()
|
2015-12-07 23:39:54 +00:00
|
|
|
%code{% RETVAL = to_AV(THIS); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
SV* pp()
|
2015-12-07 23:39:54 +00:00
|
|
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
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();
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<Polyline> split_at_vertex(Point* point)
|
|
|
|
%code{% RETVAL = THIS->split_at_vertex(*point); %};
|
|
|
|
Clone<Polyline> split_at_index(int index);
|
|
|
|
Clone<Polyline> split_at_first_point();
|
|
|
|
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();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Point> first_point();
|
2014-04-24 14:40:10 +00:00
|
|
|
bool contains_point(Point* point)
|
2014-11-23 19:14:13 +00:00
|
|
|
%code{% RETVAL = THIS->contains(*point); %};
|
2013-11-22 15:19:15 +00:00
|
|
|
Polygons simplify(double tolerance);
|
2014-04-24 14:59:36 +00:00
|
|
|
Polygons triangulate_convex()
|
|
|
|
%code{% THIS->triangulate_convex(&RETVAL); %};
|
2014-05-22 17:34:49 +00:00
|
|
|
Clone<Point> centroid();
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<BoundingBox> bounding_box();
|
2014-11-15 22:06:15 +00:00
|
|
|
std::string wkt();
|
2015-01-19 17:53:04 +00:00
|
|
|
Points concave_points(double angle);
|
|
|
|
Points convex_points(double angle);
|
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++) {
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(ST(i), &RETVAL->points[i-1]);
|
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;
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(center_sv, ¢er);
|
2014-04-24 11:43:24 +00:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-16 07:49:34 +00:00
|
|
|
|
2013-07-15 10:14:22 +00:00
|
|
|
%}
|
|
|
|
};
|