3687bc28d5
ported some ClipperLib polyline clipping tests to C++.
113 lines
2.8 KiB
Plaintext
113 lines
2.8 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <xsinit.h>
|
|
#include "libslic3r/ClipperUtils.hpp"
|
|
%}
|
|
|
|
%package{Slic3r::Geometry::Clipper};
|
|
|
|
%{
|
|
|
|
IV
|
|
_constant()
|
|
ALIAS:
|
|
JT_MITER = jtMiter
|
|
JT_ROUND = jtRound
|
|
JT_SQUARE = jtSquare
|
|
CODE:
|
|
RETVAL = ix;
|
|
OUTPUT: RETVAL
|
|
|
|
Polygons
|
|
offset(polygons, delta, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta
|
|
Slic3r::ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
RETVAL = offset(polygons, delta, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
offset2_ex(polygons, delta1, delta2, joinType = Slic3r::ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta1
|
|
const float delta2
|
|
Slic3r::ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
RETVAL = offset2_ex(union_ex(polygons), delta1, delta2, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
diff(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = diff(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
diff_ex(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = diff_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polylines
|
|
diff_pl(subject, clip)
|
|
Polylines subject
|
|
Polygons clip
|
|
CODE:
|
|
RETVAL = diff_pl(subject, clip);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
intersection(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = intersection(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
intersection_ex(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = intersection_ex(subject, clip, safety_offset ? ApplySafetyOffset::Yes : ApplySafetyOffset::No);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
union(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = safety_offset ? union_safety_offset(subject) : union_(subject);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
union_ex(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
RETVAL = safety_offset ? union_safety_offset_ex(subject) : union_ex(subject);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
%}
|