1%module{Slic3r::XS};
2
3%{
4#include <xsinit.h>
5#include "clipper.hpp"
6#include "libslic3r/ClipperUtils.hpp"
7%}
8
9%package{Slic3r::Geometry::Clipper};
10
11%{
12
13IV
14_constant()
15  ALIAS:
16    JT_MITER        = jtMiter
17    JT_ROUND        = jtRound
18    JT_SQUARE       = jtSquare
19  CODE:
20    RETVAL = ix;
21  OUTPUT: RETVAL
22
23Polygons
24offset(polygons, delta, joinType = ClipperLib::jtMiter, miterLimit = 3)
25    Polygons                polygons
26    const float             delta
27    ClipperLib::JoinType    joinType
28    double                  miterLimit
29    CODE:
30        RETVAL = offset(polygons, delta, joinType, miterLimit);
31    OUTPUT:
32        RETVAL
33
34ExPolygons
35offset_ex(polygons, delta, joinType = ClipperLib::jtMiter, miterLimit = 3)
36    Polygons                polygons
37    const float             delta
38    ClipperLib::JoinType    joinType
39    double                  miterLimit
40    CODE:
41        RETVAL = offset_ex(polygons, delta, joinType, miterLimit);
42    OUTPUT:
43        RETVAL
44
45Polygons
46offset2(polygons, delta1, delta2, joinType = ClipperLib::jtMiter, miterLimit = 3)
47    Polygons                polygons
48    const float             delta1
49    const float             delta2
50    ClipperLib::JoinType    joinType
51    double                  miterLimit
52    CODE:
53        RETVAL = offset2(polygons, delta1, delta2, joinType, miterLimit);
54    OUTPUT:
55        RETVAL
56
57ExPolygons
58offset2_ex(polygons, delta1, delta2, joinType = ClipperLib::jtMiter, miterLimit = 3)
59    Polygons                polygons
60    const float             delta1
61    const float             delta2
62    ClipperLib::JoinType    joinType
63    double                  miterLimit
64    CODE:
65        RETVAL = offset2_ex(polygons, delta1, delta2, joinType, miterLimit);
66    OUTPUT:
67        RETVAL
68
69Polygons
70diff(subject, clip, safety_offset = false)
71    Polygons    subject
72    Polygons    clip
73    bool        safety_offset
74    CODE:
75        RETVAL = diff(subject, clip, safety_offset);
76    OUTPUT:
77        RETVAL
78
79ExPolygons
80diff_ex(subject, clip, safety_offset = false)
81    Polygons    subject
82    Polygons    clip
83    bool        safety_offset
84    CODE:
85        RETVAL = diff_ex(subject, clip, safety_offset);
86    OUTPUT:
87        RETVAL
88
89Polylines
90diff_pl(subject, clip)
91    Polylines   subject
92    Polygons    clip
93    CODE:
94        RETVAL = diff_pl(subject, clip);
95    OUTPUT:
96        RETVAL
97
98Polygons
99intersection(subject, clip, safety_offset = false)
100    Polygons                    subject
101    Polygons                    clip
102    bool                        safety_offset
103    CODE:
104        RETVAL = intersection(subject, clip, safety_offset);
105    OUTPUT:
106        RETVAL
107
108ExPolygons
109intersection_ex(subject, clip, safety_offset = false)
110    Polygons                    subject
111    Polygons                    clip
112    bool                        safety_offset
113    CODE:
114        RETVAL = intersection_ex(subject, clip, safety_offset);
115    OUTPUT:
116        RETVAL
117
118Polylines
119intersection_pl(subject, clip)
120    Polylines                   subject
121    Polygons                    clip
122    CODE:
123        RETVAL = intersection_pl(subject, clip);
124    OUTPUT:
125        RETVAL
126
127Polygons
128union(subject, safety_offset = false)
129    Polygons    subject
130    bool        safety_offset
131    CODE:
132        RETVAL = union_(subject, safety_offset);
133    OUTPUT:
134        RETVAL
135
136ExPolygons
137union_ex(subject, safety_offset = false)
138    Polygons                    subject
139    bool                        safety_offset
140    CODE:
141        RETVAL = union_ex(subject, safety_offset);
142    OUTPUT:
143        RETVAL
144
145%}
146