-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.go
350 lines (293 loc) · 14.3 KB
/
shell.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
package topo
/*
#include <stdlib.h>
#include "topo_c_api.h"
#cgo CFLAGS: -I ./libs
#cgo linux CXXFLAGS: -I ./libs -std=gnu++14
#cgo darwin,amd64 CXXFLAGS: -I ./libs -std=gnu++14
#cgo darwin,arm64 CXXFLAGS: -I ./libs -std=gnu++14
#cgo windows CXXFLAGS: -I ./libs -std=gnu++14
*/
import "C"
import "runtime"
type Shell struct {
inner *innerShell
}
type innerShell struct {
val C.struct__topo_shell_t
}
func TopoMakeShell() *Shell {
p := &Shell{inner: &innerShell{val: C.topo_make_shell()}}
runtime.SetFinalizer(p.inner, (*innerShell).free)
return p
}
func (s *Shell) Sweep(spine *Wire, profiles []Shape, cornerMode int) int {
cshp := make([]*C.struct__topo_shape_t, len(profiles))
for i := range profiles {
cshp[i] = profiles[i].inner.val
}
return int(C.topo_shell_sweep(s.inner.val, spine.inner.val, &cshp[0], C.int(len(profiles)), C.int(cornerMode)))
}
func (t *Shell) ToShape() *Shape {
sp := &Shape{inner: &innerShape{val: C.topo_shape_share(t.inner.val.shp)}}
runtime.SetFinalizer(sp.inner, (*innerShape).free)
return sp
}
func (t *innerShell) free() {
C.topo_shell_free(t.val)
}
func TopoMakeShellFromSurface(S *GeomSurface, Segment bool) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_surface(S.inner.geom, C.bool(Segment))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSurfaceFromSurfaceParm(S *GeomSurface, UMin, UMax, VMin, VMax float64, Segment bool) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_surface_p(S.inner.geom, C.double(UMin), C.double(UMax), C.double(VMin), C.double(VMax), C.bool(Segment))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromBox(dx, dy, dz float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_box(C.double(dx), C.double(dy), C.double(dz))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromBoxPoint(p Point3, dx, dy, dz float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_box_point(p.val, C.double(dx), C.double(dy), C.double(dz))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromBoxTwoPoint(p1, p2 Point3) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_box_two_point(p1.val, p2.val)}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromBoxAxis2(a Axis2, dx, dy, dz float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_box_axis2(a.val, C.double(dx), C.double(dy), C.double(dz))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromCylinder(R, H float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cylinder(C.double(R), C.double(H))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromCylinderAngle(R, H, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cylinder_angle(C.double(R), C.double(H), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromCylinderAxis2(a Axis2, R, H float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cylinder_axis2(a.val, C.double(R), C.double(H))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromCylinderAxis2Angle(a Axis2, R, H, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cylinder_axis2_angle(a.val, C.double(R), C.double(H), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromCone(R1, R2, H float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cone(C.double(R1), C.double(R2), C.double(H))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromConeAngle(R1, R2, H, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cone_angle(C.double(R1), C.double(R2), C.double(H), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromConeAxis2(a Axis2, R1, R2, H float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cone_axis2(a.val, C.double(R1), C.double(R2), C.double(H))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromConeAxis2Angle(a Axis2, R1, R2, H, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_cone_axis2_angle(a.val, C.double(R1), C.double(R2), C.double(H), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolution(m *GeomCurve) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution(m.inner.geom)}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionAngle(m *GeomCurve, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_angle(m.inner.geom, C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionLimit(m *GeomCurve, VMin, VMax float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_limit(m.inner.geom, C.double(VMin), C.double(VMax))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionLimitAngle(m *GeomCurve, VMin, VMax, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_limit_angle(m.inner.geom, C.double(VMin), C.double(VMax), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionAxis2(a Axis2, m *GeomCurve) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_axis2(a.val, m.inner.geom)}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionAxis2Angle(a Axis2, m *GeomCurve, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_axis2_angle(a.val, m.inner.geom, C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionAxis2Limit(a Axis2, m *GeomCurve, VMin, VMax float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_axis2_limit(a.val, m.inner.geom, C.double(VMin), C.double(VMax))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromRevolutionAxis2LimitAngle(a Axis2, m *GeomCurve, VMin, VMax, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_revolution_axis2_limit_angle(a.val, m.inner.geom, C.double(VMin), C.double(VMax), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpere(R float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere(C.double(R))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereAngle(R float64, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_angle(C.double(R), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereTwoAngle(R float64, Angle1, Angle2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_two_angle(C.double(R), C.double(Angle1), C.double(Angle2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereThreeAngle(R float64, Angle1, Angle2, Angle3 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_three_angle(C.double(R), C.double(Angle1), C.double(Angle2), C.double(Angle3))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereCenterRaduis(Center Point3, R float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_center_raduis(Center.val, C.double(R))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereCenterAngle(Center Point3, R, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_center_angle(Center.val, C.double(R), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereCenterTwoAngle(Center Point3, R, Angle1, Angle2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_center_two_angle(Center.val, C.double(R), C.double(Angle1), C.double(Angle2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereCenterThreeAngle(Center Point3, R, Angle1, Angle2, Angle3 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_center_three_angle(Center.val, C.double(R), C.double(Angle1), C.double(Angle2), C.double(Angle3))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereAxis2(a Axis2, R float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_axis2(a.val, C.double(R))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereAxis2Angle(a Axis2, R, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_axis2_raduis(a.val, C.double(R), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereAxis2TwoAngle(a Axis2, R, Angle1, Angle2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_axis2_two_angle(a.val, C.double(R), C.double(Angle1), C.double(Angle2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromSpereAxis2ThreeAngle(a Axis2, R, Angle1, Angle2, Angle3 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_sphere_axis2_three_angle(a.val, C.double(R), C.double(Angle1), C.double(Angle2), C.double(Angle3))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorus(R1, R2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus(C.double(R1), C.double(R2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusAngle(R1, R2, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_angle(C.double(R1), C.double(R2), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusTwoAngle(R1, R2, Angle1, Angle2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_two_angle(C.double(R1), C.double(R2), C.double(Angle1), C.double(Angle2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusThreeAngle(R1, R2, Angle1, Angle2, Angle3 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_three_angle(C.double(R1), C.double(R2), C.double(Angle1), C.double(Angle2), C.double(Angle3))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusAxis2(a Axis2, R1, R2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_axis2(a.val, C.double(R1), C.double(R2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusAxis2Angle(a Axis2, R1, R2, Angle float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_axis2_angle(a.val, C.double(R1), C.double(R2), C.double(Angle))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusAxis2TwoAngle(a Axis2, R1, R2, Angle1, Angle2 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_axis2_two_angle(a.val, C.double(R1), C.double(R2), C.double(Angle1), C.double(Angle2))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromTorusAxis2ThreeAngle(a Axis2, R1, R2, Angle1, Angle2, Angle3 float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_torus_axis2_three_angle(a.val, C.double(R1), C.double(R2), C.double(Angle1), C.double(Angle2), C.double(Angle3))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromWedge(dx, dy, dz, ltx float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_wedge(C.double(dx), C.double(dy), C.double(dz), C.double(ltx))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromWedgeAxis2(a Axis2, dx, dy, dz, ltx float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_wedge_axis2(a.val, C.double(dx), C.double(dy), C.double(dz), C.double(ltx))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromWedgeLimit(dx, dy, dz, xmin, zmin, xmax, zmax float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_wedge_limit(C.double(dx), C.double(dy), C.double(dz), C.double(xmin), C.double(zmin), C.double(xmax), C.double(zmax))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
func TopoMakeShellFromWedgeAxis2Limit(a Axis2, dx, dy, dz, xmin, zmin, xmax, zmax float64) *Shell {
sh := &Shell{inner: &innerShell{val: C.topo_shell_make_shell_from_wedge_axis2_limit(a.val, C.double(dx), C.double(dy), C.double(dz), C.double(xmin), C.double(zmin), C.double(xmax), C.double(zmax))}}
runtime.SetFinalizer(sh.inner, (*innerShell).free)
return sh
}
type ShellIterator struct {
inner *innerShellIterator
}
type innerShellIterator struct {
val *C.struct__topo_shell_iterator_t
}
func TopoMakeShellIterator(p Shape) *ShellIterator {
wr := &ShellIterator{inner: &innerShellIterator{val: C.topo_shell_iterator_make(p.inner.val)}}
runtime.SetFinalizer(wr.inner, (*innerShellIterator).free)
return wr
}
func (t *innerShellIterator) free() {
C.topo_shell_iterator_free(t.val)
}
func (t *ShellIterator) Next() *Shell {
v := C.topo_shell_iterator_next(t.inner.val)
if v != nil {
var val C.struct__topo_shell_t
val.shp = v
p := &Shell{inner: &innerShell{val: val}}
runtime.SetFinalizer(p.inner, (*innerShell).free)
return p
}
return nil
}