2013-07-06 13:26:32 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "Point.hpp"
|
|
|
|
%}
|
|
|
|
|
2013-07-15 18:31:43 +00:00
|
|
|
%name{Slic3r::Point} class Point {
|
2013-07-16 15:13:01 +00:00
|
|
|
Point(long _x = 0, long _y = 0);
|
2013-07-07 14:51:02 +00:00
|
|
|
~Point();
|
2013-07-15 14:04:49 +00:00
|
|
|
Point* clone()
|
2013-07-15 18:31:43 +00:00
|
|
|
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
|
2013-07-15 14:04:49 +00:00
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
|
|
|
SV* arrayref()
|
2013-07-15 20:57:22 +00:00
|
|
|
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
2013-07-16 15:13:01 +00:00
|
|
|
SV* pp()
|
|
|
|
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
|
|
|
long x()
|
2013-07-15 18:31:43 +00:00
|
|
|
%code{% RETVAL = THIS->x; %};
|
2013-07-16 15:13:01 +00:00
|
|
|
long y()
|
2013-07-15 18:31:43 +00:00
|
|
|
%code{% RETVAL = THIS->y; %};
|
2013-08-26 22:52:20 +00:00
|
|
|
int nearest_point_index(Points points);
|
|
|
|
Point* nearest_point(Points points)
|
|
|
|
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->nearest_point(points))); %};
|
2013-08-28 18:32:25 +00:00
|
|
|
double distance_to(Point* point);
|
2014-01-17 13:22:37 +00:00
|
|
|
%name{distance_to_line} double distance_to(Line* line);
|
2014-01-17 13:49:51 +00:00
|
|
|
double ccw(Point* p1, Point* p2)
|
|
|
|
%code{% RETVAL = THIS->ccw(*p1, *p2); %};
|
2013-07-15 14:04:49 +00:00
|
|
|
|
2013-07-06 14:39:22 +00:00
|
|
|
%{
|
|
|
|
|
2013-07-15 14:04:49 +00:00
|
|
|
void
|
|
|
|
Point::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
2013-07-15 20:57:22 +00:00
|
|
|
center.from_SV_check(center_sv);
|
2013-07-15 14:04:49 +00:00
|
|
|
THIS->rotate(angle, ¢er);
|
|
|
|
|
|
|
|
bool
|
|
|
|
Point::coincides_with(point_sv)
|
|
|
|
SV* point_sv;
|
2013-07-06 14:39:22 +00:00
|
|
|
CODE:
|
2013-07-15 14:04:49 +00:00
|
|
|
Point point;
|
2013-07-15 20:57:22 +00:00
|
|
|
point.from_SV_check(point_sv);
|
2013-07-15 14:04:49 +00:00
|
|
|
RETVAL = THIS->coincides_with(&point);
|
2013-07-06 14:39:22 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
%}
|
2013-07-15 14:04:49 +00:00
|
|
|
|
2013-07-06 13:26:32 +00:00
|
|
|
};
|
2014-01-07 11:48:09 +00:00
|
|
|
|
|
|
|
%name{Slic3r::Pointf3} class Pointf3 {
|
|
|
|
Pointf3(double _x = 0, double _y = 0, double _z = 0);
|
|
|
|
~Pointf3();
|
|
|
|
Pointf3* clone()
|
|
|
|
%code{% const char* CLASS = "Slic3r::Pointf3"; RETVAL = new Pointf3(*THIS); %};
|
|
|
|
double x()
|
|
|
|
%code{% RETVAL = THIS->x; %};
|
|
|
|
double y()
|
|
|
|
%code{% RETVAL = THIS->y; %};
|
|
|
|
double z()
|
|
|
|
%code{% RETVAL = THIS->z; %};
|
|
|
|
};
|