Slic3r/xs/xsp/Point.xsp

105 lines
2.9 KiB
Plaintext
Raw Normal View History

2013-07-06 17:26:32 +04:00
%module{Slic3r::XS};
%{
#include <myinit.h>
#include "Point.hpp"
%}
2013-07-15 22:31:43 +04:00
%name{Slic3r::Point} class Point {
2013-07-16 19:13:01 +04:00
Point(long _x = 0, long _y = 0);
2013-07-07 18:51:02 +04:00
~Point();
Clone<Point> clone()
%code{% RETVAL=THIS; %};
2013-07-15 18:04:49 +04:00
void scale(double factor);
void translate(double x, double y);
SV* arrayref()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
2013-07-16 19:13:01 +04:00
SV* pp()
%code{% RETVAL = THIS->to_SV_pureperl(); %};
long x()
2013-07-15 22:31:43 +04:00
%code{% RETVAL = THIS->x; %};
2013-07-16 19:13:01 +04:00
long y()
2013-07-15 22:31:43 +04:00
%code{% RETVAL = THIS->y; %};
int nearest_point_index(Points points);
Point* nearest_point(Points points)
%code{% RETVAL = new Point(); THIS->nearest_point(points, RETVAL); %};
double distance_to(Point* point)
%code{% RETVAL = THIS->distance_to(*point); %};
double distance_to_line(Line* line)
%code{% RETVAL = THIS->distance_to(*line); %};
double ccw(Point* p1, Point* p2)
%code{% RETVAL = THIS->ccw(*p1, *p2); %};
2014-05-21 22:08:21 +04:00
Clone<Point> projection_onto_polygon(Polygon* polygon)
%code{% RETVAL = new Point(THIS->projection_onto(*polygon)); %};
Clone<Point> projection_onto_polyline(Polyline* polyline)
%code{% RETVAL = new Point(THIS->projection_onto(*polyline)); %};
Clone<Point> projection_onto_line(Line* line)
%code{% RETVAL = new Point(THIS->projection_onto(*line)); %};
Clone<Point> negative()
%code{% RETVAL = new Point(THIS->negative()); %};
bool coincides_with_epsilon(Point* point)
%code{% RETVAL = THIS->coincides_with_epsilon(*point); %};
2013-07-15 18:04:49 +04:00
2013-07-06 18:39:22 +04:00
%{
2013-07-15 18:04:49 +04:00
void
Point::rotate(angle, center_sv)
double angle;
SV* center_sv;
CODE:
Point center;
center.from_SV_check(center_sv);
THIS->rotate(angle, center);
2013-07-15 18:04:49 +04:00
bool
Point::coincides_with(point_sv)
SV* point_sv;
2013-07-06 18:39:22 +04:00
CODE:
2013-07-15 18:04:49 +04:00
Point point;
point.from_SV_check(point_sv);
RETVAL = THIS->coincides_with(point);
2013-07-06 18:39:22 +04:00
OUTPUT:
RETVAL
%}
2013-07-15 18:04:49 +04:00
2013-07-06 17:26:32 +04:00
};
2014-01-07 15:48:09 +04:00
%name{Slic3r::Point3} class Point3 {
Point3(long _x = 0, long _y = 0, long _z = 0);
~Point3();
Clone<Point3> clone()
%code{% RETVAL = THIS; %};
long x()
%code{% RETVAL = THIS->x; %};
long y()
%code{% RETVAL = THIS->y; %};
long z()
%code{% RETVAL = THIS->z; %};
};
2014-04-28 02:13:50 +04:00
%name{Slic3r::Pointf} class Pointf {
Pointf(double _x = 0, double _y = 0);
~Pointf();
Clone<Pointf> clone()
%code{% RETVAL = THIS; %};
double x()
%code{% RETVAL = THIS->x; %};
double y()
%code{% RETVAL = THIS->y; %};
void translate(double x, double y);
2014-04-28 02:13:50 +04:00
};
2014-01-07 15:48:09 +04:00
%name{Slic3r::Pointf3} class Pointf3 {
Pointf3(double _x = 0, double _y = 0, double _z = 0);
~Pointf3();
Clone<Pointf3> clone()
%code{% RETVAL = THIS; %};
2014-01-07 15:48:09 +04:00
double x()
%code{% RETVAL = THIS->x; %};
double y()
%code{% RETVAL = THIS->y; %};
double z()
%code{% RETVAL = THIS->z; %};
};