2013-07-15 20:57:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
|
|
|
#include <myinit.h>
|
|
|
|
#include "Line.hpp"
|
2014-05-02 09:51:07 +00:00
|
|
|
#include "Polyline.hpp"
|
2014-04-27 17:18:53 +00:00
|
|
|
#include "perlglue.hpp"
|
2013-07-15 20:57:22 +00:00
|
|
|
%}
|
|
|
|
|
|
|
|
%name{Slic3r::Line} class Line {
|
|
|
|
~Line();
|
2014-04-27 17:18:53 +00:00
|
|
|
Clone<Line> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2013-07-15 20:57:22 +00:00
|
|
|
SV* arrayref()
|
2013-09-09 20:27:58 +00:00
|
|
|
%code{% RETVAL = THIS->to_AV(); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
SV* pp()
|
|
|
|
%code{% RETVAL = THIS->to_SV_pureperl(); %};
|
2014-04-27 17:18:53 +00:00
|
|
|
Ref<Point> a()
|
|
|
|
%code{% RETVAL=&THIS->a; %};
|
|
|
|
Ref<Point> b()
|
|
|
|
%code{% RETVAL=&THIS->b; %};
|
2013-07-15 20:57:22 +00:00
|
|
|
void reverse();
|
2013-07-16 15:13:01 +00:00
|
|
|
void scale(double factor);
|
|
|
|
void translate(double x, double y);
|
2013-08-28 18:32:25 +00:00
|
|
|
double length();
|
2014-03-04 22:33:13 +00:00
|
|
|
double atan2_();
|
|
|
|
double direction();
|
2014-04-27 17:18:53 +00:00
|
|
|
Point* midpoint();
|
|
|
|
Clone<Point> point_at(double distance);
|
2013-11-21 13:15:38 +00:00
|
|
|
Polyline* as_polyline()
|
2014-04-27 17:18:53 +00:00
|
|
|
%code{% RETVAL = new Polyline(*THIS); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
%{
|
|
|
|
|
|
|
|
Line*
|
|
|
|
Line::new(...)
|
|
|
|
CODE:
|
|
|
|
RETVAL = new Line ();
|
|
|
|
// ST(0) is class name, ST(1) and ST(2) are endpoints
|
|
|
|
RETVAL->a.from_SV_check( ST(1) );
|
|
|
|
RETVAL->b.from_SV_check( ST(2) );
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
2013-07-16 15:13:01 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Line::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
|
|
|
center.from_SV_check(center_sv);
|
2014-04-24 11:43:24 +00:00
|
|
|
THIS->rotate(angle, center);
|
2013-07-15 20:57:22 +00:00
|
|
|
|
2013-11-06 18:38:10 +00:00
|
|
|
bool
|
|
|
|
Line::coincides_with(line_sv)
|
|
|
|
SV* line_sv;
|
|
|
|
CODE:
|
|
|
|
Line line;
|
|
|
|
line.from_SV_check(line_sv);
|
2014-04-24 14:40:10 +00:00
|
|
|
RETVAL = THIS->coincides_with(line);
|
2013-11-06 18:38:10 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%}
|
|
|
|
};
|