2013-07-15 20:57:22 +00:00
|
|
|
%module{Slic3r::XS};
|
|
|
|
|
|
|
|
%{
|
2015-12-07 23:39:54 +00:00
|
|
|
#include <xsinit.h>
|
2014-08-03 17:42:29 +00:00
|
|
|
#include "libslic3r/Line.hpp"
|
|
|
|
#include "libslic3r/Polyline.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()
|
2015-12-07 23:39:54 +00:00
|
|
|
%code{% RETVAL = to_AV(THIS); %};
|
2013-07-15 20:57:22 +00:00
|
|
|
SV* pp()
|
2015-12-07 23:39:54 +00:00
|
|
|
%code{% RETVAL = to_SV_pureperl(THIS); %};
|
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_();
|
2014-08-03 13:03:11 +00:00
|
|
|
double orientation();
|
2014-03-04 22:33:13 +00:00
|
|
|
double direction();
|
2014-05-02 11:26:59 +00:00
|
|
|
bool parallel_to(double angle);
|
|
|
|
bool parallel_to_line(Line* line)
|
|
|
|
%code{% RETVAL = THIS->parallel_to(*line); %};
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<Point> midpoint();
|
2015-01-16 15:25:39 +00:00
|
|
|
Clone<Point> intersection_infinite(Line* other)
|
|
|
|
%code{%
|
|
|
|
Point p;
|
|
|
|
bool res = THIS->intersection_infinite(*other, &p);
|
|
|
|
if (!res) CONFESS("Intersection failed");
|
|
|
|
RETVAL = p;
|
|
|
|
%};
|
Removed Point::scale(),translate(),coincides_with(),distance_to(),
distance_to_squared(),perp_distance_to(),negative(),vector_to(),
translate(), distance_to() etc,
replaced with the Eigen equivalents.
2018-08-17 12:14:24 +00:00
|
|
|
Polyline* as_polyline()
|
|
|
|
%code{% RETVAL = new Polyline(THIS->a, THIS->b); %};
|
2014-12-15 14:19:42 +00:00
|
|
|
Clone<Point> normal();
|
2015-01-15 19:06:30 +00:00
|
|
|
Clone<Point> vector();
|
2016-05-20 04:24:05 +00:00
|
|
|
double ccw(Point* point)
|
2022-03-31 10:20:46 +00:00
|
|
|
%code{% RETVAL = cross2((THIS->a - *point).cast<double>(), (THIS->b - THIS->a).cast<double>()); %};
|
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
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(ST(1), &RETVAL->a);
|
|
|
|
from_SV_check(ST(2), &RETVAL->b);
|
2013-07-15 20:57:22 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
2013-07-16 15:13:01 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Line::rotate(angle, center_sv)
|
|
|
|
double angle;
|
|
|
|
SV* center_sv;
|
|
|
|
CODE:
|
|
|
|
Point center;
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(center_sv, ¢er);
|
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;
|
2015-12-07 23:39:54 +00:00
|
|
|
from_SV_check(line_sv, &line);
|
2018-08-17 16:27:07 +00:00
|
|
|
RETVAL = (*THIS) == line;
|
2013-11-06 18:38:10 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-07-15 20:57:22 +00:00
|
|
|
%}
|
|
|
|
};
|
2014-12-16 00:12:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
%name{Slic3r::Linef3} class Linef3 {
|
2018-08-21 15:43:05 +00:00
|
|
|
Linef3(Vec3d* a, Vec3d* b)
|
2014-12-16 00:12:37 +00:00
|
|
|
%code{% RETVAL = new Linef3(*a, *b); %};
|
|
|
|
~Linef3();
|
|
|
|
Clone<Linef3> clone()
|
|
|
|
%code{% RETVAL = THIS; %};
|
2018-08-21 15:43:05 +00:00
|
|
|
Ref<Vec3d> a()
|
2014-12-16 00:12:37 +00:00
|
|
|
%code{% RETVAL = &THIS->a; %};
|
2018-08-21 15:43:05 +00:00
|
|
|
Ref<Vec3d> b()
|
2014-12-16 00:12:37 +00:00
|
|
|
%code{% RETVAL = &THIS->b; %};
|
2018-08-21 15:43:05 +00:00
|
|
|
Clone<Vec3d> intersect_plane(double z);
|
2015-01-15 19:06:30 +00:00
|
|
|
void scale(double factor);
|
2014-12-16 00:12:37 +00:00
|
|
|
};
|