2013-11-22 21:38:30 +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/Geometry.hpp"
|
2021-11-16 13:42:25 +00:00
|
|
|
#include "libslic3r/Geometry/ConvexHull.hpp"
|
2019-09-26 15:30:03 +00:00
|
|
|
#include "libslic3r/ShortestPath.hpp"
|
2013-11-22 21:38:30 +00:00
|
|
|
%}
|
|
|
|
|
2013-11-23 20:54:56 +00:00
|
|
|
|
2013-11-22 21:38:30 +00:00
|
|
|
%package{Slic3r::Geometry};
|
|
|
|
|
2018-08-21 19:05:24 +00:00
|
|
|
Pointfs arrange(size_t total_parts, Vec2d* part, coordf_t dist, BoundingBoxf* bb = NULL)
|
2016-11-04 14:03:51 +00:00
|
|
|
%code{%
|
|
|
|
Pointfs points;
|
|
|
|
if (! Slic3r::Geometry::arrange(total_parts, *part, dist, bb, points))
|
2020-06-16 12:39:08 +00:00
|
|
|
CONFESS("%zu parts won't fit in your print area!\n", total_parts);
|
2016-11-04 14:03:51 +00:00
|
|
|
RETVAL = points;
|
|
|
|
%};
|
2015-04-29 17:19:07 +00:00
|
|
|
|
2013-11-22 21:38:30 +00:00
|
|
|
%{
|
|
|
|
|
2014-05-02 16:46:22 +00:00
|
|
|
bool
|
|
|
|
directions_parallel(angle1, angle2)
|
|
|
|
double angle1
|
|
|
|
double angle2
|
|
|
|
CODE:
|
|
|
|
RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
bool
|
|
|
|
directions_parallel_within(angle1, angle2, max_diff)
|
|
|
|
double angle1
|
|
|
|
double angle2
|
|
|
|
double max_diff
|
|
|
|
CODE:
|
|
|
|
RETVAL = Slic3r::Geometry::directions_parallel(angle1, angle2, max_diff);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2015-01-19 17:53:04 +00:00
|
|
|
Clone<Polygon>
|
2013-11-22 21:38:30 +00:00
|
|
|
convex_hull(points)
|
|
|
|
Points points
|
|
|
|
CODE:
|
2015-01-19 17:53:04 +00:00
|
|
|
RETVAL = Slic3r::Geometry::convex_hull(points);
|
2013-11-22 21:38:30 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2013-11-23 20:39:05 +00:00
|
|
|
std::vector<Points::size_type>
|
|
|
|
chained_path(points)
|
|
|
|
Points points
|
|
|
|
CODE:
|
2019-09-26 15:30:03 +00:00
|
|
|
RETVAL = chain_points(points);
|
2013-11-23 20:39:05 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
std::vector<Points::size_type>
|
|
|
|
chained_path_from(points, start_from)
|
|
|
|
Points points
|
|
|
|
Point* start_from
|
|
|
|
CODE:
|
2019-09-26 15:30:03 +00:00
|
|
|
RETVAL = chain_points(points, start_from);
|
2013-11-23 20:39:05 +00:00
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2014-11-15 21:41:22 +00:00
|
|
|
double
|
|
|
|
rad2deg(angle)
|
|
|
|
double angle
|
|
|
|
CODE:
|
|
|
|
RETVAL = Slic3r::Geometry::rad2deg(angle);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
double
|
|
|
|
rad2deg_dir(angle)
|
|
|
|
double angle
|
|
|
|
CODE:
|
|
|
|
RETVAL = Slic3r::Geometry::rad2deg_dir(angle);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
double
|
|
|
|
deg2rad(angle)
|
|
|
|
double angle
|
|
|
|
CODE:
|
|
|
|
RETVAL = Slic3r::Geometry::deg2rad(angle);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2015-01-30 17:33:20 +00:00
|
|
|
Polygons
|
|
|
|
simplify_polygons(polygons, tolerance)
|
|
|
|
Polygons polygons
|
|
|
|
double tolerance
|
|
|
|
CODE:
|
|
|
|
Slic3r::Geometry::simplify_polygons(polygons, tolerance, &RETVAL);
|
|
|
|
OUTPUT:
|
|
|
|
RETVAL
|
|
|
|
|
2015-04-29 17:19:07 +00:00
|
|
|
|
2015-04-16 19:22:04 +00:00
|
|
|
IV
|
|
|
|
_constant()
|
|
|
|
ALIAS:
|
|
|
|
X = X
|
|
|
|
Y = Y
|
|
|
|
Z = Z
|
|
|
|
PROTOTYPE:
|
|
|
|
CODE:
|
|
|
|
RETVAL = ix;
|
|
|
|
OUTPUT: RETVAL
|
|
|
|
|
2013-11-22 21:38:30 +00:00
|
|
|
%}
|
2015-04-16 19:22:04 +00:00
|
|
|
|