695c92fb00
inside ClipperUtils are now using bit shifts instead of multiplication by doubles, which makes the scaling precise. Removed the scale parameter from all offset functions. Modified the safety offset to calculate offset per polygon instead of over all polygons at once. The old way was not safe and very slow, sometimes this meant a kiss of death for supports for example.
204 lines
4.8 KiB
Plaintext
204 lines
4.8 KiB
Plaintext
%module{Slic3r::XS};
|
|
|
|
%{
|
|
#include <xsinit.h>
|
|
#include "clipper.hpp"
|
|
#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 = ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta
|
|
ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
offset(polygons, &RETVAL, delta, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
offset_ex(polygons, delta, joinType = ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta
|
|
ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
offset(polygons, &RETVAL, delta, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
offset2(polygons, delta1, delta2, joinType = ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta1
|
|
const float delta2
|
|
ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
offset2(polygons, &RETVAL, delta1, delta2, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
offset2_ex(polygons, delta1, delta2, joinType = ClipperLib::jtMiter, miterLimit = 3)
|
|
Polygons polygons
|
|
const float delta1
|
|
const float delta2
|
|
ClipperLib::JoinType joinType
|
|
double miterLimit
|
|
CODE:
|
|
offset2(polygons, &RETVAL, delta1, delta2, joinType, miterLimit);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
diff(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
diff(subject, clip, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
diff_ex(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
diff(subject, clip, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polylines
|
|
diff_pl(subject, clip)
|
|
Polylines subject
|
|
Polygons clip
|
|
CODE:
|
|
diff(subject, clip, &RETVAL);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polylines
|
|
diff_ppl(subject, clip)
|
|
Polygons subject
|
|
Polygons clip
|
|
CODE:
|
|
diff(subject, clip, &RETVAL);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
intersection(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
intersection(subject, clip, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
intersection_ex(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
intersection(subject, clip, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polylines
|
|
intersection_pl(subject, clip)
|
|
Polylines subject
|
|
Polygons clip
|
|
CODE:
|
|
intersection(subject, clip, &RETVAL);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polylines
|
|
intersection_ppl(subject, clip)
|
|
Polygons subject
|
|
Polygons clip
|
|
CODE:
|
|
intersection(subject, clip, &RETVAL);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
xor_ex(subject, clip, safety_offset = false)
|
|
Polygons subject
|
|
Polygons clip
|
|
bool safety_offset
|
|
CODE:
|
|
xor_(subject, clip, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
union(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
union_(subject, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
ExPolygons
|
|
union_ex(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
union_(subject, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
SV*
|
|
union_pt(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
// perform operation
|
|
ClipperLib::PolyTree polytree;
|
|
union_pt(subject, &polytree, safety_offset);
|
|
|
|
RETVAL = polynode_children_2_perl(polytree);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
union_pt_chained(subject, safety_offset = false)
|
|
Polygons subject
|
|
bool safety_offset
|
|
CODE:
|
|
union_pt_chained(subject, &RETVAL, safety_offset);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
Polygons
|
|
simplify_polygons(subject)
|
|
Polygons subject
|
|
CODE:
|
|
simplify_polygons(subject, &RETVAL);
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
%}
|