PrusaSlicer-NonPlainar/xs/xsp/Point.xsp
2014-01-07 12:48:09 +01:00

65 lines
1.6 KiB
Plaintext

%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Point.hpp"
%}
%name{Slic3r::Point} class Point {
Point(long _x = 0, long _y = 0);
~Point();
Point* clone()
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(*THIS); %};
void scale(double factor);
void translate(double x, double y);
SV* arrayref()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
long x()
%code{% RETVAL = THIS->x; %};
long y()
%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);
%{
void
Point::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
THIS->rotate(angle, &center);
bool
Point::coincides_with(point_sv)
SV* point_sv;
CODE:
Point point;
point.from_SV_check(point_sv);
RETVAL = THIS->coincides_with(&point);
OUTPUT:
RETVAL
%}
};
%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; %};
};