PrusaSlicer-NonPlainar/xs/xsp/Point.xsp

52 lines
1.2 KiB
Text
Raw Normal View History

2013-07-06 15:26:32 +02:00
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Point.hpp"
%}
2013-07-15 20:31:43 +02:00
%name{Slic3r::Point} class Point {
2013-07-16 17:13:01 +02:00
Point(long _x = 0, long _y = 0);
2013-07-07 16:51:02 +02:00
~Point();
2013-07-15 16:04:49 +02:00
Point* clone()
2013-07-15 20:31:43 +02:00
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
2013-07-15 16:04:49 +02:00
void scale(double factor);
void translate(double x, double y);
SV* arrayref()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
2013-07-16 17:13:01 +02:00
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
long x()
2013-07-15 20:31:43 +02:00
%code{% RETVAL = THIS->x; %};
2013-07-16 17:13:01 +02:00
long y()
2013-07-15 20:31:43 +02:00
%code{% RETVAL = THIS->y; %};
int nearest_point_index(Points points);
Point* nearest_point(Points points)
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*(THIS->nearest_point(points))); %};
double distance_to(Point* point);
2013-07-15 16:04:49 +02:00
2013-07-06 16:39:22 +02:00
%{
2013-07-15 16:04:49 +02:00
void
Point::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
2013-07-15 16:04:49 +02:00
THIS->rotate(angle, &center);
bool
Point::coincides_with(point_sv)
SV* point_sv;
2013-07-06 16:39:22 +02:00
CODE:
2013-07-15 16:04:49 +02:00
Point point;
point.from_SV_check(point_sv);
2013-07-15 16:04:49 +02:00
RETVAL = THIS->coincides_with(&point);
2013-07-06 16:39:22 +02:00
OUTPUT:
RETVAL
%}
2013-07-15 16:04:49 +02:00
2013-07-06 15:26:32 +02:00
};