okgeometry-api 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/Arc.js +1 -1
  2. package/dist/Arc.js.map +1 -1
  3. package/dist/Circle.js +1 -1
  4. package/dist/Circle.js.map +1 -1
  5. package/dist/Line.js +1 -1
  6. package/dist/Line.js.map +1 -1
  7. package/dist/Mesh.d.ts +101 -4
  8. package/dist/Mesh.d.ts.map +1 -1
  9. package/dist/Mesh.js +103 -5
  10. package/dist/Mesh.js.map +1 -1
  11. package/dist/NurbsCurve.js +1 -1
  12. package/dist/NurbsCurve.js.map +1 -1
  13. package/dist/NurbsSurface.d.ts.map +1 -1
  14. package/dist/NurbsSurface.js +10 -7
  15. package/dist/NurbsSurface.js.map +1 -1
  16. package/dist/PolyCurve.js +1 -1
  17. package/dist/PolyCurve.js.map +1 -1
  18. package/dist/Polyline.js +1 -1
  19. package/dist/Polyline.js.map +1 -1
  20. package/dist/Ray.js +1 -1
  21. package/dist/Ray.js.map +1 -1
  22. package/dist/engine.d.ts.map +1 -1
  23. package/dist/engine.js +1 -3
  24. package/dist/engine.js.map +1 -1
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/wasm-base64.d.ts +1 -1
  29. package/dist/wasm-base64.d.ts.map +1 -1
  30. package/dist/wasm-base64.js +1 -1
  31. package/dist/wasm-base64.js.map +1 -1
  32. package/package.json +7 -6
  33. package/src/Arc.ts +117 -117
  34. package/src/Circle.ts +153 -153
  35. package/src/Line.ts +144 -144
  36. package/src/Mesh.ts +671 -452
  37. package/src/NurbsCurve.ts +240 -240
  38. package/src/NurbsSurface.ts +249 -245
  39. package/src/PolyCurve.ts +306 -306
  40. package/src/Polyline.ts +153 -153
  41. package/src/Ray.ts +90 -90
  42. package/src/engine.ts +9 -11
  43. package/src/index.ts +6 -0
  44. package/src/wasm-base64.ts +1 -1
  45. package/wasm/README.md +0 -104
  46. package/wasm/okgeometrycore.d.ts +0 -754
  47. package/wasm/okgeometrycore.js +0 -2005
  48. package/wasm/okgeometrycore_bg.d.ts +0 -3
  49. package/wasm/okgeometrycore_bg.js +0 -1686
  50. package/wasm/okgeometrycore_bg.wasm +0 -0
  51. package/wasm/okgeometrycore_bg.wasm.d.ts +0 -100
  52. package/wasm/package.json +0 -19
@@ -1,2005 +0,0 @@
1
- /* @ts-self-types="./okgeometrycore.d.ts" */
2
-
3
- /**
4
- * Get the length of an arc.
5
- * @param {number} radius
6
- * @param {number} start_angle
7
- * @param {number} end_angle
8
- * @returns {number}
9
- */
10
- export function arc_length(radius, start_angle, end_angle) {
11
- const ret = wasm.arc_length(radius, start_angle, end_angle);
12
- return ret;
13
- }
14
-
15
- /**
16
- * Evaluate a point on an arc at parameter t ∈ [0,1].
17
- * Returns [x, y, z].
18
- * @param {number} cx
19
- * @param {number} cy
20
- * @param {number} cz
21
- * @param {number} nx
22
- * @param {number} ny
23
- * @param {number} nz
24
- * @param {number} radius
25
- * @param {number} start_angle
26
- * @param {number} end_angle
27
- * @param {number} t
28
- * @returns {Float64Array}
29
- */
30
- export function arc_point_at(cx, cy, cz, nx, ny, nz, radius, start_angle, end_angle, t) {
31
- const ret = wasm.arc_point_at(cx, cy, cz, nx, ny, nz, radius, start_angle, end_angle, t);
32
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
33
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
34
- return v1;
35
- }
36
-
37
- /**
38
- * Chamfer corners of a polyline by cutting each corner with a straight segment.
39
- * Input: flat coords [x1,y1,z1, ...], distance from corner to cut.
40
- * Output: encoded polycurve segments [segment_count, type, ...data, ...]
41
- * type 0 = Line: [sx,sy,sz, ex,ey,ez]
42
- * @param {Float64Array} coords
43
- * @param {number} distance
44
- * @returns {Float64Array}
45
- */
46
- export function chamfer_polycurve(coords, distance) {
47
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
48
- const len0 = WASM_VECTOR_LEN;
49
- const ret = wasm.chamfer_polycurve(ptr0, len0, distance);
50
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
51
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
52
- return v2;
53
- }
54
-
55
- /**
56
- * Get the circumference of a circle.
57
- * @param {number} radius
58
- * @returns {number}
59
- */
60
- export function circle_length(radius) {
61
- const ret = wasm.circle_length(radius);
62
- return ret;
63
- }
64
-
65
- /**
66
- * Evaluate a point on a circle at parameter t ∈ [0,1].
67
- * Returns [x, y, z].
68
- * @param {number} cx
69
- * @param {number} cy
70
- * @param {number} cz
71
- * @param {number} nx
72
- * @param {number} ny
73
- * @param {number} nz
74
- * @param {number} radius
75
- * @param {number} t
76
- * @returns {Float64Array}
77
- */
78
- export function circle_point_at(cx, cy, cz, nx, ny, nz, radius, t) {
79
- const ret = wasm.circle_point_at(cx, cy, cz, nx, ny, nz, radius, t);
80
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
81
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
82
- return v1;
83
- }
84
-
85
- /**
86
- * Create an arc and return sampled points
87
- * @param {number} cx
88
- * @param {number} cy
89
- * @param {number} cz
90
- * @param {number} nx
91
- * @param {number} ny
92
- * @param {number} nz
93
- * @param {number} radius
94
- * @param {number} start_angle
95
- * @param {number} end_angle
96
- * @param {number} samples
97
- * @returns {Float64Array}
98
- */
99
- export function create_arc(cx, cy, cz, nx, ny, nz, radius, start_angle, end_angle, samples) {
100
- const ret = wasm.create_arc(cx, cy, cz, nx, ny, nz, radius, start_angle, end_angle, samples);
101
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
102
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
103
- return v1;
104
- }
105
-
106
- /**
107
- * Create a circle and return sampled points
108
- * @param {number} cx
109
- * @param {number} cy
110
- * @param {number} cz
111
- * @param {number} nx
112
- * @param {number} ny
113
- * @param {number} nz
114
- * @param {number} radius
115
- * @param {number} samples
116
- * @returns {Float64Array}
117
- */
118
- export function create_circle(cx, cy, cz, nx, ny, nz, radius, samples) {
119
- const ret = wasm.create_circle(cx, cy, cz, nx, ny, nz, radius, samples);
120
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
121
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
122
- return v1;
123
- }
124
-
125
- /**
126
- * Create a line segment and return sampled points
127
- * @param {number} x1
128
- * @param {number} y1
129
- * @param {number} z1
130
- * @param {number} x2
131
- * @param {number} y2
132
- * @param {number} z2
133
- * @param {number} samples
134
- * @returns {Float64Array}
135
- */
136
- export function create_line(x1, y1, z1, x2, y2, z2, samples) {
137
- const ret = wasm.create_line(x1, y1, z1, x2, y2, z2, samples);
138
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
139
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
140
- return v1;
141
- }
142
-
143
- /**
144
- * Create a polyline and return the points
145
- * @param {Float64Array} coords
146
- * @param {number} samples_per_segment
147
- * @returns {Float64Array}
148
- */
149
- export function create_polyline(coords, samples_per_segment) {
150
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
151
- const len0 = WASM_VECTOR_LEN;
152
- const ret = wasm.create_polyline(ptr0, len0, samples_per_segment);
153
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
154
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
155
- return v2;
156
- }
157
-
158
- /**
159
- * Serialize a curve to a list of points for Three.js rendering
160
- * Returns a flat array of coordinates: [x1, y1, z1, x2, y2, z2, ...]
161
- * @param {string} curve_type
162
- * @param {Float64Array} params
163
- * @param {number} samples
164
- * @returns {Float64Array}
165
- */
166
- export function curve_to_points(curve_type, params, samples) {
167
- const ptr0 = passStringToWasm0(curve_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
168
- const len0 = WASM_VECTOR_LEN;
169
- const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
170
- const len1 = WASM_VECTOR_LEN;
171
- const ret = wasm.curve_to_points(ptr0, len0, ptr1, len1, samples);
172
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
173
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
174
- return v3;
175
- }
176
-
177
- /**
178
- * Evaluate a NURBS curve at normalized parameter t in [0,1].
179
- * Returns [x, y, z].
180
- * @param {Float64Array} data
181
- * @param {number} t
182
- * @returns {Float64Array}
183
- */
184
- export function evaluate_nurbs_curve_at(data, t) {
185
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
186
- const len0 = WASM_VECTOR_LEN;
187
- const ret = wasm.evaluate_nurbs_curve_at(ptr0, len0, t);
188
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
189
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
190
- return v2;
191
- }
192
-
193
- /**
194
- * Extrude a circle and return mesh buffers
195
- * @param {number} cx
196
- * @param {number} cy
197
- * @param {number} cz
198
- * @param {number} nx
199
- * @param {number} ny
200
- * @param {number} nz
201
- * @param {number} radius
202
- * @param {number} dx
203
- * @param {number} dy
204
- * @param {number} dz
205
- * @param {number} segments
206
- * @param {boolean} with_caps
207
- * @returns {Float64Array}
208
- */
209
- export function extrude_circle(cx, cy, cz, nx, ny, nz, radius, dx, dy, dz, segments, with_caps) {
210
- const ret = wasm.extrude_circle(cx, cy, cz, nx, ny, nz, radius, dx, dy, dz, segments, with_caps);
211
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
212
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
213
- return v1;
214
- }
215
-
216
- /**
217
- * Extrude a line segment and return mesh buffers
218
- * @param {number} x1
219
- * @param {number} y1
220
- * @param {number} z1
221
- * @param {number} x2
222
- * @param {number} y2
223
- * @param {number} z2
224
- * @param {number} dx
225
- * @param {number} dy
226
- * @param {number} dz
227
- * @param {number} segments
228
- * @returns {Float64Array}
229
- */
230
- export function extrude_line(x1, y1, z1, x2, y2, z2, dx, dy, dz, segments) {
231
- const ret = wasm.extrude_line(x1, y1, z1, x2, y2, z2, dx, dy, dz, segments);
232
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
233
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
234
- return v1;
235
- }
236
-
237
- /**
238
- * Extrude a polyline and return mesh buffers.
239
- * Uses the polyline's actual vertices (no resampling) to preserve sharp corners.
240
- * @param {Float64Array} coords
241
- * @param {number} dx
242
- * @param {number} dy
243
- * @param {number} dz
244
- * @param {number} _segments
245
- * @param {boolean} with_caps
246
- * @returns {Float64Array}
247
- */
248
- export function extrude_polyline(coords, dx, dy, dz, _segments, with_caps) {
249
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ret = wasm.extrude_polyline(ptr0, len0, dx, dy, dz, _segments, with_caps);
252
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
253
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
254
- return v2;
255
- }
256
-
257
- /**
258
- * Fillet corners of a polyline with arcs of a given radius.
259
- * Input: flat coords [x1,y1,z1, ...], radius, plane normal (nx,ny,nz; 0,0,0 for auto).
260
- * Output: encoded polycurve segments [segment_count, type, ...data, type, ...data, ...]
261
- * type 0 = Line: [sx,sy,sz, ex,ey,ez]
262
- * type 1 = Arc: [cx,cy,cz, nx,ny,nz, radius, start_angle, end_angle]
263
- * @param {Float64Array} coords
264
- * @param {number} radius
265
- * @param {number} nx
266
- * @param {number} ny
267
- * @param {number} nz
268
- * @returns {Float64Array}
269
- */
270
- export function fillet_polycurve(coords, radius, nx, ny, nz) {
271
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
272
- const len0 = WASM_VECTOR_LEN;
273
- const ret = wasm.fillet_polycurve(ptr0, len0, radius, nx, ny, nz);
274
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
275
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
276
- return v2;
277
- }
278
-
279
- /**
280
- * Get the length of a line segment.
281
- * @param {number} x1
282
- * @param {number} y1
283
- * @param {number} z1
284
- * @param {number} x2
285
- * @param {number} y2
286
- * @param {number} z2
287
- * @returns {number}
288
- */
289
- export function line_length(x1, y1, z1, x2, y2, z2) {
290
- const ret = wasm.line_length(x1, y1, z1, x2, y2, z2);
291
- return ret;
292
- }
293
-
294
- /**
295
- * Offset a line segment perpendicular to line direction relative to reference normal.
296
- * Returns [startX,startY,startZ,endX,endY,endZ]
297
- * @param {number} x1
298
- * @param {number} y1
299
- * @param {number} z1
300
- * @param {number} x2
301
- * @param {number} y2
302
- * @param {number} z2
303
- * @param {number} distance
304
- * @param {number} nx
305
- * @param {number} ny
306
- * @param {number} nz
307
- * @returns {Float64Array}
308
- */
309
- export function line_offset(x1, y1, z1, x2, y2, z2, distance, nx, ny, nz) {
310
- const ret = wasm.line_offset(x1, y1, z1, x2, y2, z2, distance, nx, ny, nz);
311
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
312
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
313
- return v1;
314
- }
315
-
316
- /**
317
- * Evaluate a point on a line segment at parameter t ∈ [0,1].
318
- * Returns [x, y, z].
319
- * @param {number} x1
320
- * @param {number} y1
321
- * @param {number} z1
322
- * @param {number} x2
323
- * @param {number} y2
324
- * @param {number} z2
325
- * @param {number} t
326
- * @returns {Float64Array}
327
- */
328
- export function line_point_at(x1, y1, z1, x2, y2, z2, t) {
329
- const ret = wasm.line_point_at(x1, y1, z1, x2, y2, z2, t);
330
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
331
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
332
- return v1;
333
- }
334
-
335
- /**
336
- * Get the tangent direction of a line segment. Returns [x, y, z].
337
- * @param {number} x1
338
- * @param {number} y1
339
- * @param {number} z1
340
- * @param {number} x2
341
- * @param {number} y2
342
- * @param {number} z2
343
- * @returns {Float64Array}
344
- */
345
- export function line_tangent(x1, y1, z1, x2, y2, z2) {
346
- const ret = wasm.line_tangent(x1, y1, z1, x2, y2, z2);
347
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
348
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
349
- return v1;
350
- }
351
-
352
- /**
353
- * Loft between multiple circles
354
- *
355
- * # Parameters
356
- * * `circle_data` - Flat array of circle definitions [cx, cy, cz, nx, ny, nz, radius, ...]
357
- * * `segments` - Number of segments to sample along each curve
358
- * * `with_caps` - Whether to create end caps
359
- *
360
- * # Returns
361
- * Mesh buffers for the lofted surface
362
- * @param {Float64Array} circle_data
363
- * @param {number} segments
364
- * @param {boolean} with_caps
365
- * @returns {Float64Array}
366
- */
367
- export function loft_circles(circle_data, segments, with_caps) {
368
- const ptr0 = passArrayF64ToWasm0(circle_data, wasm.__wbindgen_malloc);
369
- const len0 = WASM_VECTOR_LEN;
370
- const ret = wasm.loft_circles(ptr0, len0, segments, with_caps);
371
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
372
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
373
- return v2;
374
- }
375
-
376
- /**
377
- * Loft a NURBS surface through multiple NURBS curves.
378
- * Input: [num_curves, degree_v, curve1_data..., curve2_data..., ...]
379
- * Each curve_data: [degree, num_pts, x,y,z,..., w0,w1,..., k0,k1,...]
380
- * Returns the NurbsSurface data (same format as tessellate input, without u_segs/v_segs).
381
- * @param {Float64Array} data
382
- * @returns {Float64Array}
383
- */
384
- export function loft_nurbs_surface(data) {
385
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
386
- const len0 = WASM_VECTOR_LEN;
387
- const ret = wasm.loft_nurbs_surface(ptr0, len0);
388
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
389
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
390
- return v2;
391
- }
392
-
393
- /**
394
- * Loft between multiple polylines
395
- *
396
- * # Parameters
397
- * * `polyline_data` - Flat array where each polyline is prefixed by its point count:
398
- * [count1, x1, y1, z1, x2, y2, z2, ..., count2, x1, y1, z1, ...]
399
- * * `_segments` - Ignored for polylines (kept for API compat). Points are used directly.
400
- * * `with_caps` - Whether to create end caps (fan triangulation from center)
401
- *
402
- * # Returns
403
- * Mesh buffers for the lofted surface
404
- * @param {Float64Array} polyline_data
405
- * @param {number} _segments
406
- * @param {boolean} with_caps
407
- * @returns {Float64Array}
408
- */
409
- export function loft_polylines(polyline_data, _segments, with_caps) {
410
- const ptr0 = passArrayF64ToWasm0(polyline_data, wasm.__wbindgen_malloc);
411
- const len0 = WASM_VECTOR_LEN;
412
- const ret = wasm.loft_polylines(ptr0, len0, _segments, with_caps);
413
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
414
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
415
- return v2;
416
- }
417
-
418
- /**
419
- * Make multiple NURBS curves compatible (same knot vectors, same CP count).
420
- * Input: [curve_count, curve1_data..., curve2_data..., ...]
421
- * Each curve: [degree, num_cp, cp_xyz..., weights..., knots...]
422
- * Output: same format with unified curves.
423
- * @param {Float64Array} curves_data
424
- * @returns {Float64Array}
425
- */
426
- export function make_nurbs_curves_compatible(curves_data) {
427
- const ptr0 = passArrayF64ToWasm0(curves_data, wasm.__wbindgen_malloc);
428
- const len0 = WASM_VECTOR_LEN;
429
- const ret = wasm.make_nurbs_curves_compatible(ptr0, len0);
430
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
431
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
432
- return v2;
433
- }
434
-
435
- /**
436
- * Apply a 4x4 transformation matrix to a mesh.
437
- * matrix: flat [m00,m01,m02,m03, m10,m11,..., m30,m31,m32,m33] (16 elements, row-major)
438
- * @param {number} vertex_count
439
- * @param {Float64Array} buffer
440
- * @param {Float64Array} matrix
441
- * @returns {Float64Array}
442
- */
443
- export function mesh_apply_matrix(vertex_count, buffer, matrix) {
444
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
445
- const len0 = WASM_VECTOR_LEN;
446
- const ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
447
- const len1 = WASM_VECTOR_LEN;
448
- const ret = wasm.mesh_apply_matrix(vertex_count, ptr0, len0, ptr1, len1);
449
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
450
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
451
- return v3;
452
- }
453
-
454
- /**
455
- * Perform boolean intersection on two meshes
456
- * @param {number} vertex_count_a
457
- * @param {Float64Array} buffer_a
458
- * @param {number} vertex_count_b
459
- * @param {Float64Array} buffer_b
460
- * @returns {Float64Array}
461
- */
462
- export function mesh_boolean_intersection(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
463
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
464
- const len0 = WASM_VECTOR_LEN;
465
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
466
- const len1 = WASM_VECTOR_LEN;
467
- const ret = wasm.mesh_boolean_intersection(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
468
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
469
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
470
- return v3;
471
- }
472
-
473
- /**
474
- * @returns {number}
475
- */
476
- export function mesh_boolean_last_debug_marker() {
477
- const ret = wasm.mesh_boolean_last_debug_marker();
478
- return ret >>> 0;
479
- }
480
-
481
- /**
482
- * @param {number} vertex_count_a
483
- * @param {Float64Array} buffer_a
484
- * @param {number} vertex_count_b
485
- * @param {Float64Array} buffer_b
486
- * @param {string} operation
487
- * @returns {Float64Array}
488
- */
489
- export function mesh_boolean_operation(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
490
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
491
- const len0 = WASM_VECTOR_LEN;
492
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
493
- const len1 = WASM_VECTOR_LEN;
494
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
495
- const len2 = WASM_VECTOR_LEN;
496
- const ret = wasm.mesh_boolean_operation(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
497
- var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
498
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
499
- return v4;
500
- }
501
-
502
- /**
503
- * Debug helper: perform boolean operation and return a textual status,
504
- * including kernel error reason on failure.
505
- * @param {number} vertex_count_a
506
- * @param {Float64Array} buffer_a
507
- * @param {number} vertex_count_b
508
- * @param {Float64Array} buffer_b
509
- * @param {string} operation
510
- * @returns {string}
511
- */
512
- export function mesh_boolean_operation_debug(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
513
- let deferred4_0;
514
- let deferred4_1;
515
- try {
516
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
517
- const len0 = WASM_VECTOR_LEN;
518
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
519
- const len1 = WASM_VECTOR_LEN;
520
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
521
- const len2 = WASM_VECTOR_LEN;
522
- const ret = wasm.mesh_boolean_operation_debug(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
523
- deferred4_0 = ret[0];
524
- deferred4_1 = ret[1];
525
- return getStringFromWasm0(ret[0], ret[1]);
526
- } finally {
527
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
528
- }
529
- }
530
-
531
- /**
532
- * Perform boolean operation and return stage-level profiling data followed by
533
- * the result mesh buffer.
534
- *
535
- * Output format:
536
- * [profile_len(=95), broadphase_ms, segments_ms, split_ms,
537
- * split_touched_faces_a, split_source_faces_a, split_touched_faces_b, split_source_faces_b,
538
- * classify_ms, classify_seed_ms, classify_strict_ms, classify_open_component_ms,
539
- * extract_ms, extract_primary_ms, extract_fallback_ms,
540
- * cleanup_ms, finalize_ms, finalize_cap_ms, finalize_recap_ms, finalize_stitch_ms,
541
- * pair_accepted, pair_rejected, pair_degenerate,
542
- * core_passes, core_total_ms, conservative_runs, conservative_ms, nudge_runs, nudge_ms,
543
- * recompose_runs, recompose_ms, repair_runs, repair_ms,
544
- * repair_loops, repair_loops_capped, repair_loop_vertices, repair_loop_max_vertices,
545
- * arrangement_adj_attempts, arrangement_adj_fast_hits, arrangement_adj_disabled_split_limit,
546
- * arrangement_adj_fallback_no_half_edges, arrangement_adj_fallback_collect_failed,
547
- * arrangement_adj_fallback_non_manifold, arrangement_adj_fallback_loop_mismatch,
548
- * arrangement_adj_fallback_twin_mismatch, arrangement_adj_fallback_invalid_face_index,
549
- * arrangement_adj_non_manifold_edges_total, arrangement_adj_non_manifold_limit_total,
550
- * arrangement_adj_non_manifold_tolerated_attempts,
551
- * arrangement_adj_fallback_non_manifold_excess_total,
552
- * subtraction_ultra_cases, subtraction_ultra_component_fallback_runs,
553
- * subtraction_ultra_open_bounds_total, subtraction_ultra_open_bounds_max,
554
- * subtraction_ultra_best_boundary_total, subtraction_ultra_best_non_manifold_total,
555
- * subtraction_ultra_scoped_faces_total, subtraction_ultra_scoped_faces_max,
556
- * subtraction_ultra_scoped_strict_evals_total, subtraction_ultra_scoped_strict_evals_max,
557
- * finalize_stitch_rebuild_ms, finalize_stitch_recap_ms,
558
- * finalize_stitch_attempts, finalize_stitch_kept,
559
- * finalize_stitch_rebuild_collect_ms, finalize_stitch_rebuild_weld_ms,
560
- * finalize_stitch_rebuild_commit_ms, finalize_stitch_rebuild_faces_in,
561
- * finalize_stitch_rebuild_faces_out,
562
- * whole_partial_attempts, whole_partial_accepts,
563
- * whole_partial_total_ms, whole_partial_split_ms,
564
- * whole_partial_boundary_build_ms,
565
- * whole_partial_split_triangle_fast_faces,
566
- * whole_partial_split_cdt_faces,
567
- * whole_partial_split_cdt_points_total,
568
- * whole_partial_split_cdt_constraints_total,
569
- * whole_partial_split_cdt_segment_constraints_total,
570
- * whole_partial_split_cdt_triangles_total,
571
- * whole_partial_triangle_cdt_single_segment_faces,
572
- * whole_partial_triangle_cdt_two_segment_faces,
573
- * whole_partial_triangle_cdt_three_plus_segment_faces,
574
- * whole_partial_triangle_cdt_all_boundary_segment_faces,
575
- * whole_partial_triangle_cdt_mixed_boundary_segment_faces,
576
- * whole_partial_triangle_cdt_any_interior_segment_faces,
577
- * whole_partial_classify_source_ms, whole_partial_classify_touched_ms,
578
- * whole_partial_extract_ms, whole_partial_extract_untouched_ms,
579
- * whole_partial_extract_interface_ms, whole_partial_extract_touched_ms,
580
- * whole_partial_finalize_ms,
581
- * whole_partial_interface_faces_total,
582
- * whole_partial_interface_faces_emitted,
583
- * whole_partial_interface_boundary_edge_hits,
584
- * whole_partial_interface_raw_edge_fallbacks,
585
- * whole_partial_touched_faces_total,
586
- * whole_partial_touched_faces_emitted,
587
- * whole_partial_touched_patch_attempts,
588
- * whole_partial_touched_patch_direct_regions,
589
- * whole_partial_touched_patch_triangulated_faces,
590
- * whole_partial_touched_fallback_faces,
591
- * whole_partial_touched_lineage_vertices,
592
- * whole_partial_touched_welded_vertices,
593
- * whole_partial_raw_boundary_untouched_edges,
594
- * whole_partial_raw_boundary_interface_edges,
595
- * whole_partial_raw_boundary_touched_edges,
596
- * whole_partial_raw_boundary_mixed_edges,
597
- * whole_partial_raw_non_manifold_untouched_edges,
598
- * whole_partial_raw_non_manifold_interface_edges,
599
- * whole_partial_raw_non_manifold_touched_edges,
600
- * whole_partial_raw_non_manifold_mixed_edges,
601
- * whole_partial_boundary_edges_total,
602
- * whole_partial_non_manifold_edges_total,
603
- * whole_partial_face_ratio_vs_a_total,
604
- * whole_partial_loop_plausible_total,
605
- * mesh_buffer...]
606
- * @param {number} vertex_count_a
607
- * @param {Float64Array} buffer_a
608
- * @param {number} vertex_count_b
609
- * @param {Float64Array} buffer_b
610
- * @param {string} operation
611
- * @returns {Float64Array}
612
- */
613
- export function mesh_boolean_operation_profiled(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
614
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
615
- const len0 = WASM_VECTOR_LEN;
616
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
617
- const len1 = WASM_VECTOR_LEN;
618
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
619
- const len2 = WASM_VECTOR_LEN;
620
- const ret = wasm.mesh_boolean_operation_profiled(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
621
- var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
622
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
623
- return v4;
624
- }
625
-
626
- /**
627
- * Perform boolean subtraction on two meshes (A - B)
628
- * @param {number} vertex_count_a
629
- * @param {Float64Array} buffer_a
630
- * @param {number} vertex_count_b
631
- * @param {Float64Array} buffer_b
632
- * @returns {Float64Array}
633
- */
634
- export function mesh_boolean_subtraction(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
635
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
636
- const len0 = WASM_VECTOR_LEN;
637
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
638
- const len1 = WASM_VECTOR_LEN;
639
- const ret = wasm.mesh_boolean_subtraction(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
640
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
641
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
642
- return v3;
643
- }
644
-
645
- /**
646
- * Perform boolean union on two meshes
647
- * @param {number} vertex_count_a
648
- * @param {Float64Array} buffer_a
649
- * @param {number} vertex_count_b
650
- * @param {Float64Array} buffer_b
651
- * @returns {Float64Array}
652
- */
653
- export function mesh_boolean_union(vertex_count_a, buffer_a, vertex_count_b, buffer_b) {
654
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
655
- const len0 = WASM_VECTOR_LEN;
656
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
657
- const len1 = WASM_VECTOR_LEN;
658
- const ret = wasm.mesh_boolean_union(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1);
659
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
660
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
661
- return v3;
662
- }
663
-
664
- /**
665
- * @param {number} vertex_count_a
666
- * @param {Float64Array} buffer_a
667
- * @param {number} vertex_count_b
668
- * @param {Float64Array} buffer_b
669
- * @param {string} operation
670
- * @returns {Float64Array}
671
- */
672
- export function mesh_boolean_whole_partial_candidate(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
673
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
674
- const len0 = WASM_VECTOR_LEN;
675
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
676
- const len1 = WASM_VECTOR_LEN;
677
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
678
- const len2 = WASM_VECTOR_LEN;
679
- const ret = wasm.mesh_boolean_whole_partial_candidate(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
680
- var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
681
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
682
- return v4;
683
- }
684
-
685
- /**
686
- * @param {number} vertex_count_a
687
- * @param {Float64Array} buffer_a
688
- * @param {number} vertex_count_b
689
- * @param {Float64Array} buffer_b
690
- * @param {string} operation
691
- * @returns {Float64Array}
692
- */
693
- export function mesh_boolean_whole_partial_candidate_debug(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
694
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
695
- const len0 = WASM_VECTOR_LEN;
696
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
697
- const len1 = WASM_VECTOR_LEN;
698
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
699
- const len2 = WASM_VECTOR_LEN;
700
- const ret = wasm.mesh_boolean_whole_partial_candidate_debug(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
701
- var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
702
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
703
- return v4;
704
- }
705
-
706
- /**
707
- * @param {number} vertex_count_a
708
- * @param {Float64Array} buffer_a
709
- * @param {number} vertex_count_b
710
- * @param {Float64Array} buffer_b
711
- * @param {string} operation
712
- * @returns {Float64Array}
713
- */
714
- export function mesh_boolean_whole_partial_candidate_debug_full(vertex_count_a, buffer_a, vertex_count_b, buffer_b, operation) {
715
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
716
- const len0 = WASM_VECTOR_LEN;
717
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
718
- const len1 = WASM_VECTOR_LEN;
719
- const ptr2 = passStringToWasm0(operation, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
720
- const len2 = WASM_VECTOR_LEN;
721
- const ret = wasm.mesh_boolean_whole_partial_candidate_debug_full(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
722
- var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
723
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
724
- return v4;
725
- }
726
-
727
- /**
728
- * Extract boundary (perimeter) edges from a mesh as polylines.
729
- * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
730
- * @param {number} vertex_count
731
- * @param {Float64Array} buffer
732
- * @returns {Float64Array}
733
- */
734
- export function mesh_boundary_polylines(vertex_count, buffer) {
735
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
736
- const len0 = WASM_VECTOR_LEN;
737
- const ret = wasm.mesh_boundary_polylines(vertex_count, ptr0, len0);
738
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
739
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
740
- return v2;
741
- }
742
-
743
- /**
744
- * Coplanar connected face groups.
745
- * Output format:
746
- * [groupCount, triCount, tri..., centroidX,centroidY,centroidZ, normalX,normalY,normalZ, ...]
747
- * @param {number} vertex_count
748
- * @param {Float64Array} buffer
749
- * @returns {Float64Array}
750
- */
751
- export function mesh_build_coplanar_connected_face_groups(vertex_count, buffer) {
752
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
753
- const len0 = WASM_VECTOR_LEN;
754
- const ret = wasm.mesh_build_coplanar_connected_face_groups(vertex_count, ptr0, len0);
755
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
756
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
757
- return v2;
758
- }
759
-
760
- /**
761
- * Chamfer all edges of a primitive mesh (flat bevel)
762
- *
763
- * # Arguments
764
- * * `mesh_type` - "box", "cylinder", or "prism"
765
- * * `params` - Parameters: [width,height,depth] for box, [radius,height,segments] for cylinder/prism
766
- * * `offset` - Chamfer offset distance
767
- *
768
- * # Returns
769
- * Result mesh buffer [vertexCount, vertices..., indices...]
770
- * @param {string} mesh_type
771
- * @param {Float64Array} params
772
- * @param {number} offset
773
- * @returns {Float64Array}
774
- */
775
- export function mesh_chamfer_all_edges(mesh_type, params, offset) {
776
- const ptr0 = passStringToWasm0(mesh_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
777
- const len0 = WASM_VECTOR_LEN;
778
- const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
779
- const len1 = WASM_VECTOR_LEN;
780
- const ret = wasm.mesh_chamfer_all_edges(ptr0, len0, ptr1, len1, offset);
781
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
782
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
783
- return v3;
784
- }
785
-
786
- /**
787
- * Compute planar curve normal from ordered points.
788
- * @param {Float64Array} coords
789
- * @param {boolean} closed
790
- * @returns {Float64Array}
791
- */
792
- export function mesh_compute_planar_curve_normal(coords, closed) {
793
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
794
- const len0 = WASM_VECTOR_LEN;
795
- const ret = wasm.mesh_compute_planar_curve_normal(ptr0, len0, closed);
796
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
797
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
798
- return v2;
799
- }
800
-
801
- /**
802
- * Odd/even mesh containment test.
803
- * @param {number} vertex_count
804
- * @param {Float64Array} buffer
805
- * @param {number} px
806
- * @param {number} py
807
- * @param {number} pz
808
- * @returns {boolean}
809
- */
810
- export function mesh_contains_point(vertex_count, buffer, px, py, pz) {
811
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
812
- const len0 = WASM_VECTOR_LEN;
813
- const ret = wasm.mesh_contains_point(vertex_count, ptr0, len0, px, py, pz);
814
- return ret !== 0;
815
- }
816
-
817
- /**
818
- * Create a box mesh and return buffers
819
- * Returns [vertices..., indices...]
820
- * @param {number} width
821
- * @param {number} height
822
- * @param {number} depth
823
- * @returns {Float64Array}
824
- */
825
- export function mesh_create_box(width, height, depth) {
826
- const ret = wasm.mesh_create_box(width, height, depth);
827
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
828
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
829
- return v1;
830
- }
831
-
832
- /**
833
- * Create a cone mesh and return buffers
834
- * @param {number} radius
835
- * @param {number} height
836
- * @param {number} segments
837
- * @returns {Float64Array}
838
- */
839
- export function mesh_create_cone(radius, height, segments) {
840
- const ret = wasm.mesh_create_cone(radius, height, segments);
841
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
842
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
843
- return v1;
844
- }
845
-
846
- /**
847
- * Create a cylinder mesh and return buffers
848
- * @param {number} radius
849
- * @param {number} height
850
- * @param {number} segments
851
- * @returns {Float64Array}
852
- */
853
- export function mesh_create_cylinder(radius, height, segments) {
854
- const ret = wasm.mesh_create_cylinder(radius, height, segments);
855
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
856
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
857
- return v1;
858
- }
859
-
860
- /**
861
- * Create a prism mesh and return buffers
862
- * @param {number} radius
863
- * @param {number} height
864
- * @param {number} sides
865
- * @returns {Float64Array}
866
- */
867
- export function mesh_create_prism(radius, height, sides) {
868
- const ret = wasm.mesh_create_prism(radius, height, sides);
869
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
870
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
871
- return v1;
872
- }
873
-
874
- /**
875
- * Create a geodesic sphere mesh matching Manifold's sphere topology and return buffers
876
- * @param {number} radius
877
- * @param {number} segments
878
- * @param {number} rings
879
- * @returns {Float64Array}
880
- */
881
- export function mesh_create_sphere(radius, segments, rings) {
882
- const ret = wasm.mesh_create_sphere(radius, segments, rings);
883
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
884
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
885
- return v1;
886
- }
887
-
888
- /**
889
- * Evaluate a point on a mesh surface at parametric coordinates (u, v).
890
- * Maps u ∈ [0,1] and v ∈ [0,1] to the mesh's AABB bounding box,
891
- * then casts a ray perpendicular to the best-fit projection plane.
892
- * Returns [x, y, z] of the intersection point, or [NaN, NaN, NaN] if no hit.
893
- * @param {number} vertex_count
894
- * @param {Float64Array} buffer
895
- * @param {number} u
896
- * @param {number} v
897
- * @returns {Float64Array}
898
- */
899
- export function mesh_evaluate(vertex_count, buffer, u, v) {
900
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
901
- const len0 = WASM_VECTOR_LEN;
902
- const ret = wasm.mesh_evaluate(vertex_count, ptr0, len0, u, v);
903
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
904
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
905
- return v2;
906
- }
907
-
908
- /**
909
- * Export a mesh to OBJ format
910
- * Takes mesh buffers as input (same format as mesh_to_buffers output)
911
- * Returns OBJ string
912
- * @param {number} vertex_count
913
- * @param {Float64Array} buffer
914
- * @returns {string}
915
- */
916
- export function mesh_export_obj(vertex_count, buffer) {
917
- let deferred2_0;
918
- let deferred2_1;
919
- try {
920
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
921
- const len0 = WASM_VECTOR_LEN;
922
- const ret = wasm.mesh_export_obj(vertex_count, ptr0, len0);
923
- deferred2_0 = ret[0];
924
- deferred2_1 = ret[1];
925
- return getStringFromWasm0(ret[0], ret[1]);
926
- } finally {
927
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
928
- }
929
- }
930
-
931
- /**
932
- * Push/pull a planar face set by moving its coplanar connected region.
933
- * @param {number} vertex_count
934
- * @param {Float64Array} buffer
935
- * @param {number} face_index
936
- * @param {number} distance
937
- * @returns {Float64Array}
938
- */
939
- export function mesh_extrude_face(vertex_count, buffer, face_index, distance) {
940
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
941
- const len0 = WASM_VECTOR_LEN;
942
- const ret = wasm.mesh_extrude_face(vertex_count, ptr0, len0, face_index, distance);
943
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
944
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
945
- return v2;
946
- }
947
-
948
- /**
949
- * Extrude planar curve profile by normal * height.
950
- * @param {Float64Array} coords
951
- * @param {number} nx
952
- * @param {number} ny
953
- * @param {number} nz
954
- * @param {number} height
955
- * @param {boolean} closed
956
- * @returns {Float64Array}
957
- */
958
- export function mesh_extrude_planar_curve(coords, nx, ny, nz, height, closed) {
959
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
960
- const len0 = WASM_VECTOR_LEN;
961
- const ret = wasm.mesh_extrude_planar_curve(ptr0, len0, nx, ny, nz, height, closed);
962
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
963
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
964
- return v2;
965
- }
966
-
967
- /**
968
- * Find the best matching coplanar connected face group by normal and optional near-point.
969
- * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
970
- * @param {number} vertex_count
971
- * @param {Float64Array} buffer
972
- * @param {number} nx
973
- * @param {number} ny
974
- * @param {number} nz
975
- * @param {number} near_x
976
- * @param {number} near_y
977
- * @param {number} near_z
978
- * @param {boolean} use_near_point
979
- * @returns {Float64Array}
980
- */
981
- export function mesh_find_face_group_by_normal(vertex_count, buffer, nx, ny, nz, near_x, near_y, near_z, use_near_point) {
982
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
983
- const len0 = WASM_VECTOR_LEN;
984
- const ret = wasm.mesh_find_face_group_by_normal(vertex_count, ptr0, len0, nx, ny, nz, near_x, near_y, near_z, use_near_point);
985
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
986
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
987
- return v2;
988
- }
989
-
990
- /**
991
- * Find the coplanar connected face group containing triangle_index.
992
- * Output format: [centroidX, centroidY, centroidZ, normalX, normalY, normalZ] or [].
993
- * @param {number} vertex_count
994
- * @param {Float64Array} buffer
995
- * @param {number} triangle_index
996
- * @returns {Float64Array}
997
- */
998
- export function mesh_find_face_group_by_triangle_index(vertex_count, buffer, triangle_index) {
999
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1000
- const len0 = WASM_VECTOR_LEN;
1001
- const ret = wasm.mesh_find_face_group_by_triangle_index(vertex_count, ptr0, len0, triangle_index);
1002
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1003
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1004
- return v2;
1005
- }
1006
-
1007
- /**
1008
- * Axis-aligned bounding box as [minX, minY, minZ, maxX, maxY, maxZ].
1009
- * @param {number} vertex_count
1010
- * @param {Float64Array} buffer
1011
- * @returns {Float64Array}
1012
- */
1013
- export function mesh_get_bounds(vertex_count, buffer) {
1014
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1015
- const len0 = WASM_VECTOR_LEN;
1016
- const ret = wasm.mesh_get_bounds(vertex_count, ptr0, len0);
1017
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1018
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1019
- return v2;
1020
- }
1021
-
1022
- /**
1023
- * Coplanar connected face-group centroid containing a given triangle face index.
1024
- * Output format: [x, y, z] or [] when unavailable.
1025
- * @param {number} vertex_count
1026
- * @param {Float64Array} buffer
1027
- * @param {number} face_index
1028
- * @returns {Float64Array}
1029
- */
1030
- export function mesh_get_coplanar_face_group_centroid(vertex_count, buffer, face_index) {
1031
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1032
- const len0 = WASM_VECTOR_LEN;
1033
- const ret = wasm.mesh_get_coplanar_face_group_centroid(vertex_count, ptr0, len0, face_index);
1034
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1035
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1036
- return v2;
1037
- }
1038
-
1039
- /**
1040
- * Edge-connected coplanar triangle indices as [count, i0, i1, ...].
1041
- * @param {number} vertex_count
1042
- * @param {Float64Array} buffer
1043
- * @param {number} face_index
1044
- * @returns {Float64Array}
1045
- */
1046
- export function mesh_get_coplanar_face_indices(vertex_count, buffer, face_index) {
1047
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1048
- const len0 = WASM_VECTOR_LEN;
1049
- const ret = wasm.mesh_get_coplanar_face_indices(vertex_count, ptr0, len0, face_index);
1050
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1051
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1052
- return v2;
1053
- }
1054
-
1055
- /**
1056
- * Coplanar connected face region projected to a plane basis.
1057
- * Output format:
1058
- * [faceCount, faceIndex0, faceIndex1, ..., uMin, uMax, vMin, vMax]
1059
- * @param {number} vertex_count
1060
- * @param {Float64Array} buffer
1061
- * @param {number} face_index
1062
- * @param {number} ox
1063
- * @param {number} oy
1064
- * @param {number} oz
1065
- * @param {number} ux
1066
- * @param {number} uy
1067
- * @param {number} uz
1068
- * @param {number} vx
1069
- * @param {number} vy
1070
- * @param {number} vz
1071
- * @param {number} margin_scale
1072
- * @param {number} min_margin
1073
- * @returns {Float64Array}
1074
- */
1075
- export function mesh_get_coplanar_face_region(vertex_count, buffer, face_index, ox, oy, oz, ux, uy, uz, vx, vy, vz, margin_scale, min_margin) {
1076
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1077
- const len0 = WASM_VECTOR_LEN;
1078
- const ret = wasm.mesh_get_coplanar_face_region(vertex_count, ptr0, len0, face_index, ox, oy, oz, ux, uy, uz, vx, vy, vz, margin_scale, min_margin);
1079
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1080
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1081
- return v2;
1082
- }
1083
-
1084
- /**
1085
- * Unique undirected triangle edges as [edgeCount, v0a, v0b, v1a, v1b, ...].
1086
- * @param {number} vertex_count
1087
- * @param {Float64Array} buffer
1088
- * @returns {Float64Array}
1089
- */
1090
- export function mesh_get_edge_vertex_pairs(vertex_count, buffer) {
1091
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1092
- const len0 = WASM_VECTOR_LEN;
1093
- const ret = wasm.mesh_get_edge_vertex_pairs(vertex_count, ptr0, len0);
1094
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1095
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1096
- return v2;
1097
- }
1098
-
1099
- /**
1100
- * Face area.
1101
- * @param {number} vertex_count
1102
- * @param {Float64Array} buffer
1103
- * @param {number} face_index
1104
- * @returns {number}
1105
- */
1106
- export function mesh_get_face_area(vertex_count, buffer, face_index) {
1107
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1108
- const len0 = WASM_VECTOR_LEN;
1109
- const ret = wasm.mesh_get_face_area(vertex_count, ptr0, len0, face_index);
1110
- return ret;
1111
- }
1112
-
1113
- /**
1114
- * Face centroid as [x, y, z].
1115
- * @param {number} vertex_count
1116
- * @param {Float64Array} buffer
1117
- * @param {number} face_index
1118
- * @returns {Float64Array}
1119
- */
1120
- export function mesh_get_face_centroid(vertex_count, buffer, face_index) {
1121
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1122
- const len0 = WASM_VECTOR_LEN;
1123
- const ret = wasm.mesh_get_face_centroid(vertex_count, ptr0, len0, face_index);
1124
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1125
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1126
- return v2;
1127
- }
1128
-
1129
- /**
1130
- * Face normal as [x, y, z].
1131
- * @param {number} vertex_count
1132
- * @param {Float64Array} buffer
1133
- * @param {number} face_index
1134
- * @returns {Float64Array}
1135
- */
1136
- export function mesh_get_face_normal(vertex_count, buffer, face_index) {
1137
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1138
- const len0 = WASM_VECTOR_LEN;
1139
- const ret = wasm.mesh_get_face_normal(vertex_count, ptr0, len0, face_index);
1140
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1141
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1142
- return v2;
1143
- }
1144
-
1145
- /**
1146
- * Get mesh statistics
1147
- * Returns [vertex_count, face_count, edge_count]
1148
- * @param {number} vertex_count
1149
- * @param {Float64Array} buffer
1150
- * @returns {Float64Array}
1151
- */
1152
- export function mesh_get_stats(vertex_count, buffer) {
1153
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1154
- const len0 = WASM_VECTOR_LEN;
1155
- const ret = wasm.mesh_get_stats(vertex_count, ptr0, len0);
1156
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1157
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1158
- return v2;
1159
- }
1160
-
1161
- /**
1162
- * Import OBJ data and return mesh buffers
1163
- * @param {string} obj_data
1164
- * @returns {Float64Array}
1165
- */
1166
- export function mesh_import_obj(obj_data) {
1167
- const ptr0 = passStringToWasm0(obj_data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1168
- const len0 = WASM_VECTOR_LEN;
1169
- const ret = wasm.mesh_import_obj(ptr0, len0);
1170
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1171
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1172
- return v2;
1173
- }
1174
-
1175
- /**
1176
- * Check if triangulated mesh is a closed volume (no welded boundary edges).
1177
- * @param {number} vertex_count
1178
- * @param {Float64Array} buffer
1179
- * @returns {boolean}
1180
- */
1181
- export function mesh_is_closed_volume(vertex_count, buffer) {
1182
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1183
- const len0 = WASM_VECTOR_LEN;
1184
- const ret = wasm.mesh_is_closed_volume(vertex_count, ptr0, len0);
1185
- return ret !== 0;
1186
- }
1187
-
1188
- /**
1189
- * Merge multiple mesh buffers while preserving per-mesh vertex order and index remapping.
1190
- * Input format: [mesh_count, len1, mesh1..., len2, mesh2..., ...]
1191
- * @param {Float64Array} mesh_data
1192
- * @returns {Float64Array}
1193
- */
1194
- export function mesh_merge(mesh_data) {
1195
- const ptr0 = passArrayF64ToWasm0(mesh_data, wasm.__wbindgen_malloc);
1196
- const len0 = WASM_VECTOR_LEN;
1197
- const ret = wasm.mesh_merge(ptr0, len0);
1198
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1199
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1200
- return v2;
1201
- }
1202
-
1203
- /**
1204
- * Intersect two meshes, returning intersection polyline points.
1205
- * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1206
- * @param {number} va_count
1207
- * @param {Float64Array} buffer_a
1208
- * @param {number} vb_count
1209
- * @param {Float64Array} buffer_b
1210
- * @returns {Float64Array}
1211
- */
1212
- export function mesh_mesh_intersect(va_count, buffer_a, vb_count, buffer_b) {
1213
- const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
1214
- const len0 = WASM_VECTOR_LEN;
1215
- const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
1216
- const len1 = WASM_VECTOR_LEN;
1217
- const ret = wasm.mesh_mesh_intersect(va_count, ptr0, len0, vb_count, ptr1, len1);
1218
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1219
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1220
- return v3;
1221
- }
1222
-
1223
- /**
1224
- * Create a planar patch mesh from boundary points using CDT.
1225
- * Correctly handles concave polygons (unlike fan triangulation).
1226
- * Input: flat coordinate array [x1,y1,z1, x2,y2,z2, ...]
1227
- * Output: mesh buffer [vertexCount, x1,y1,z1,..., i0,i1,i2, ...]
1228
- * @param {Float64Array} coords
1229
- * @returns {Float64Array}
1230
- */
1231
- export function mesh_patch_from_points(coords) {
1232
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1233
- const len0 = WASM_VECTOR_LEN;
1234
- const ret = wasm.mesh_patch_from_points(ptr0, len0);
1235
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1236
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1237
- return v2;
1238
- }
1239
-
1240
- /**
1241
- * Intersect a mesh with a plane, returning polyline points.
1242
- * Input: vertex_count, mesh_buffer..., nx, ny, nz, d
1243
- * Returns: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1244
- * @param {number} vertex_count
1245
- * @param {Float64Array} buffer
1246
- * @param {number} nx
1247
- * @param {number} ny
1248
- * @param {number} nz
1249
- * @param {number} d
1250
- * @returns {Float64Array}
1251
- */
1252
- export function mesh_plane_intersect(vertex_count, buffer, nx, ny, nz, d) {
1253
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1254
- const len0 = WASM_VECTOR_LEN;
1255
- const ret = wasm.mesh_plane_intersect(vertex_count, ptr0, len0, nx, ny, nz, d);
1256
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1257
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1258
- return v2;
1259
- }
1260
-
1261
- /**
1262
- * Shift closed boolean cutter curve and adjust height.
1263
- * Returns [height, epsilon, pointCount, x,y,z,...]
1264
- * @param {Float64Array} coords
1265
- * @param {boolean} closed
1266
- * @param {number} nx
1267
- * @param {number} ny
1268
- * @param {number} nz
1269
- * @param {number} height
1270
- * @returns {Float64Array}
1271
- */
1272
- export function mesh_prepare_boolean_cutter_curve(coords, closed, nx, ny, nz, height) {
1273
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1274
- const len0 = WASM_VECTOR_LEN;
1275
- const ret = wasm.mesh_prepare_boolean_cutter_curve(ptr0, len0, closed, nx, ny, nz, height);
1276
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1277
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1278
- return v2;
1279
- }
1280
-
1281
- /**
1282
- * Raycast against mesh and return closest hit.
1283
- * Output: [] when no hit, otherwise [pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance]
1284
- * @param {number} vertex_count
1285
- * @param {Float64Array} buffer
1286
- * @param {number} ox
1287
- * @param {number} oy
1288
- * @param {number} oz
1289
- * @param {number} dx
1290
- * @param {number} dy
1291
- * @param {number} dz
1292
- * @param {number} max_distance
1293
- * @returns {Float64Array}
1294
- */
1295
- export function mesh_raycast(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
1296
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1297
- const len0 = WASM_VECTOR_LEN;
1298
- const ret = wasm.mesh_raycast(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1299
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1300
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1301
- return v2;
1302
- }
1303
-
1304
- /**
1305
- * Raycast against mesh and return all hits sorted by distance.
1306
- * Output: [hitCount, (point, normal, faceIndex, distance)*]
1307
- * @param {number} vertex_count
1308
- * @param {Float64Array} buffer
1309
- * @param {number} ox
1310
- * @param {number} oy
1311
- * @param {number} oz
1312
- * @param {number} dx
1313
- * @param {number} dy
1314
- * @param {number} dz
1315
- * @param {number} max_distance
1316
- * @returns {Float64Array}
1317
- */
1318
- export function mesh_raycast_all(vertex_count, buffer, ox, oy, oz, dx, dy, dz, max_distance) {
1319
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1320
- const len0 = WASM_VECTOR_LEN;
1321
- const ret = wasm.mesh_raycast_all(vertex_count, ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1322
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1323
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1324
- return v2;
1325
- }
1326
-
1327
- /**
1328
- * Raycast against many meshes packed as:
1329
- * [meshCount, meshLen0, meshRaw0..., meshLen1, meshRaw1..., ...]
1330
- * Output: [hitCount, meshIndex, pointX,pointY,pointZ, normalX,normalY,normalZ, faceIndex, distance, ...]
1331
- * @param {Float64Array} mesh_data
1332
- * @param {number} ox
1333
- * @param {number} oy
1334
- * @param {number} oz
1335
- * @param {number} dx
1336
- * @param {number} dy
1337
- * @param {number} dz
1338
- * @param {number} max_distance
1339
- * @returns {Float64Array}
1340
- */
1341
- export function mesh_raycast_many(mesh_data, ox, oy, oz, dx, dy, dz, max_distance) {
1342
- const ptr0 = passArrayF64ToWasm0(mesh_data, wasm.__wbindgen_malloc);
1343
- const len0 = WASM_VECTOR_LEN;
1344
- const ret = wasm.mesh_raycast_many(ptr0, len0, ox, oy, oz, dx, dy, dz, max_distance);
1345
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1346
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1347
- return v2;
1348
- }
1349
-
1350
- /**
1351
- * Rotate a mesh around an arbitrary axis and return new buffers
1352
- * Axis is defined by (ax, ay, az), angle in radians
1353
- * @param {number} vertex_count
1354
- * @param {Float64Array} buffer
1355
- * @param {number} ax
1356
- * @param {number} ay
1357
- * @param {number} az
1358
- * @param {number} angle
1359
- * @returns {Float64Array}
1360
- */
1361
- export function mesh_rotate(vertex_count, buffer, ax, ay, az, angle) {
1362
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1363
- const len0 = WASM_VECTOR_LEN;
1364
- const ret = wasm.mesh_rotate(vertex_count, ptr0, len0, ax, ay, az, angle);
1365
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1366
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1367
- return v2;
1368
- }
1369
-
1370
- /**
1371
- * Scale a mesh non-uniformly and return new buffers
1372
- * @param {number} vertex_count
1373
- * @param {Float64Array} buffer
1374
- * @param {number} sx
1375
- * @param {number} sy
1376
- * @param {number} sz
1377
- * @returns {Float64Array}
1378
- */
1379
- export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
1380
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1381
- const len0 = WASM_VECTOR_LEN;
1382
- const ret = wasm.mesh_scale(vertex_count, ptr0, len0, sx, sy, sz);
1383
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1384
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1385
- return v2;
1386
- }
1387
-
1388
- /**
1389
- * Return welded-edge topology metrics for a triangulated mesh buffer:
1390
- * `[boundary_edges, non_manifold_edges]`.
1391
- * @param {number} vertex_count
1392
- * @param {Float64Array} buffer
1393
- * @returns {Float64Array}
1394
- */
1395
- export function mesh_topology_metrics(vertex_count, buffer) {
1396
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1397
- const len0 = WASM_VECTOR_LEN;
1398
- const ret = wasm.mesh_topology_metrics(vertex_count, ptr0, len0);
1399
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1400
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1401
- return v2;
1402
- }
1403
-
1404
- /**
1405
- * Translate a mesh by an offset vector and return new buffers
1406
- * @param {number} vertex_count
1407
- * @param {Float64Array} buffer
1408
- * @param {number} dx
1409
- * @param {number} dy
1410
- * @param {number} dz
1411
- * @returns {Float64Array}
1412
- */
1413
- export function mesh_translate(vertex_count, buffer, dx, dy, dz) {
1414
- const ptr0 = passArrayF64ToWasm0(buffer, wasm.__wbindgen_malloc);
1415
- const len0 = WASM_VECTOR_LEN;
1416
- const ret = wasm.mesh_translate(vertex_count, ptr0, len0, dx, dy, dz);
1417
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1418
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1419
- return v2;
1420
- }
1421
-
1422
- /**
1423
- * Intersect two NURBS curves.
1424
- * Returns: [num_points, x,y,z, ...]
1425
- * @param {Float64Array} data_a
1426
- * @param {Float64Array} data_b
1427
- * @returns {Float64Array}
1428
- */
1429
- export function nurbs_curve_curve_intersect(data_a, data_b) {
1430
- const ptr0 = passArrayF64ToWasm0(data_a, wasm.__wbindgen_malloc);
1431
- const len0 = WASM_VECTOR_LEN;
1432
- const ptr1 = passArrayF64ToWasm0(data_b, wasm.__wbindgen_malloc);
1433
- const len1 = WASM_VECTOR_LEN;
1434
- const ret = wasm.nurbs_curve_curve_intersect(ptr0, len0, ptr1, len1);
1435
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1436
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1437
- return v3;
1438
- }
1439
-
1440
- /**
1441
- * Intersect a NURBS curve with a plane.
1442
- * Input: same curve format as sample_nurbs_curve + plane normal (nx,ny,nz) and d.
1443
- * Returns: [num_points, x,y,z, x,y,z, ...]
1444
- * @param {Float64Array} data
1445
- * @param {number} nx
1446
- * @param {number} ny
1447
- * @param {number} nz
1448
- * @param {number} d
1449
- * @returns {Float64Array}
1450
- */
1451
- export function nurbs_curve_plane_intersect(data, nx, ny, nz, d) {
1452
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
1453
- const len0 = WASM_VECTOR_LEN;
1454
- const ret = wasm.nurbs_curve_plane_intersect(ptr0, len0, nx, ny, nz, d);
1455
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1456
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1457
- return v2;
1458
- }
1459
-
1460
- /**
1461
- * Evaluate a NURBS surface at (u, v) parameters.
1462
- * Input format: same as tessellate but last 2 values are u, v instead of u_segs, v_segs
1463
- * Returns [x, y, z]
1464
- * @param {Float64Array} data
1465
- * @param {number} u
1466
- * @param {number} v
1467
- * @returns {Float64Array}
1468
- */
1469
- export function nurbs_surface_evaluate(data, u, v) {
1470
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
1471
- const len0 = WASM_VECTOR_LEN;
1472
- const ret = wasm.nurbs_surface_evaluate(ptr0, len0, u, v);
1473
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1474
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1475
- return v2;
1476
- }
1477
-
1478
- /**
1479
- * Intersect a NURBS surface with a plane.
1480
- * Input: same surface format as tessellate_nurbs_surface, then plane (nx,ny,nz,d) appended.
1481
- * Returns polyline buffer: [num_polylines, n1, x,y,z,..., n2, x,y,z,...]
1482
- * @param {Float64Array} surface_data
1483
- * @param {number} nx
1484
- * @param {number} ny
1485
- * @param {number} nz
1486
- * @param {number} d
1487
- * @param {number} tess
1488
- * @returns {Float64Array}
1489
- */
1490
- export function nurbs_surface_plane_intersect(surface_data, nx, ny, nz, d, tess) {
1491
- const ptr0 = passArrayF64ToWasm0(surface_data, wasm.__wbindgen_malloc);
1492
- const len0 = WASM_VECTOR_LEN;
1493
- const ret = wasm.nurbs_surface_plane_intersect(ptr0, len0, nx, ny, nz, d, tess);
1494
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1495
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1496
- return v2;
1497
- }
1498
-
1499
- /**
1500
- * Intersect two NURBS surfaces.
1501
- * Returns polyline buffer.
1502
- * @param {Float64Array} data_a
1503
- * @param {Float64Array} data_b
1504
- * @param {number} tess
1505
- * @returns {Float64Array}
1506
- */
1507
- export function nurbs_surface_surface_intersect(data_a, data_b, tess) {
1508
- const ptr0 = passArrayF64ToWasm0(data_a, wasm.__wbindgen_malloc);
1509
- const len0 = WASM_VECTOR_LEN;
1510
- const ptr1 = passArrayF64ToWasm0(data_b, wasm.__wbindgen_malloc);
1511
- const len1 = WASM_VECTOR_LEN;
1512
- const ret = wasm.nurbs_surface_surface_intersect(ptr0, len0, ptr1, len1, tess);
1513
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1514
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1515
- return v3;
1516
- }
1517
-
1518
- /**
1519
- * Offset a polyline by a distance in a given plane.
1520
- * If nx=ny=nz=0, the plane normal is auto-detected.
1521
- * Returns flat [x1,y1,z1, x2,y2,z2, ...] of the offset polyline.
1522
- * @param {Float64Array} coords
1523
- * @param {number} distance
1524
- * @param {number} nx
1525
- * @param {number} ny
1526
- * @param {number} nz
1527
- * @returns {Float64Array}
1528
- */
1529
- export function offset_polyline_curve(coords, distance, nx, ny, nz) {
1530
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1531
- const len0 = WASM_VECTOR_LEN;
1532
- const ret = wasm.offset_polyline_curve(ptr0, len0, distance, nx, ny, nz);
1533
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1534
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1535
- return v2;
1536
- }
1537
-
1538
- /**
1539
- * Convert a polycurve (Line/Arc segments) to an exact NURBS curve.
1540
- * Input format: [segment_count, type1, ...data1..., type2, ...data2..., ...]
1541
- * type 0 = Line (6 floats: start_xyz, end_xyz)
1542
- * type 1 = Arc (9 floats: center_xyz, normal_xyz, radius, start_angle, end_angle)
1543
- * Output format: [degree, num_cp, cp_x1,y1,z1,..., w1,w2,..., k1,k2,...]
1544
- * @param {Float64Array} segment_data
1545
- * @returns {Float64Array}
1546
- */
1547
- export function polycurve_to_nurbs(segment_data) {
1548
- const ptr0 = passArrayF64ToWasm0(segment_data, wasm.__wbindgen_malloc);
1549
- const len0 = WASM_VECTOR_LEN;
1550
- const ret = wasm.polycurve_to_nurbs(ptr0, len0);
1551
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1552
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1553
- return v2;
1554
- }
1555
-
1556
- /**
1557
- * Get the total length of a polyline.
1558
- * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
1559
- * @param {Float64Array} coords
1560
- * @returns {number}
1561
- */
1562
- export function polyline_length(coords) {
1563
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1564
- const len0 = WASM_VECTOR_LEN;
1565
- const ret = wasm.polyline_length(ptr0, len0);
1566
- return ret;
1567
- }
1568
-
1569
- /**
1570
- * Evaluate a point on a polyline at parameter t ∈ [0,1].
1571
- * Input: flat coords [x1,y1,z1, x2,y2,z2, ...]
1572
- * Returns [x, y, z].
1573
- * @param {Float64Array} coords
1574
- * @param {number} t
1575
- * @returns {Float64Array}
1576
- */
1577
- export function polyline_point_at(coords, t) {
1578
- const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1579
- const len0 = WASM_VECTOR_LEN;
1580
- const ret = wasm.polyline_point_at(ptr0, len0, t);
1581
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1582
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1583
- return v2;
1584
- }
1585
-
1586
- /**
1587
- * Find the closest point on a ray to a given point.
1588
- * Returns [x, y, z] of the closest point on the ray.
1589
- * @param {number} ox
1590
- * @param {number} oy
1591
- * @param {number} oz
1592
- * @param {number} dx
1593
- * @param {number} dy
1594
- * @param {number} dz
1595
- * @param {number} px
1596
- * @param {number} py
1597
- * @param {number} pz
1598
- * @returns {Float64Array}
1599
- */
1600
- export function ray_closest_point(ox, oy, oz, dx, dy, dz, px, py, pz) {
1601
- const ret = wasm.ray_closest_point(ox, oy, oz, dx, dy, dz, px, py, pz);
1602
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1603
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1604
- return v1;
1605
- }
1606
-
1607
- /**
1608
- * Find the parameter t for the closest point on a ray to a given point.
1609
- * The closest point is at: origin + t * direction
1610
- * Note: t can be negative if the closest point is "behind" the ray origin.
1611
- * @param {number} ox
1612
- * @param {number} oy
1613
- * @param {number} oz
1614
- * @param {number} dx
1615
- * @param {number} dy
1616
- * @param {number} dz
1617
- * @param {number} px
1618
- * @param {number} py
1619
- * @param {number} pz
1620
- * @returns {number}
1621
- */
1622
- export function ray_closest_point_parameter(ox, oy, oz, dx, dy, dz, px, py, pz) {
1623
- const ret = wasm.ray_closest_point_parameter(ox, oy, oz, dx, dy, dz, px, py, pz);
1624
- return ret;
1625
- }
1626
-
1627
- /**
1628
- * Compute the distance from a ray to a point.
1629
- * Ray is defined by origin (ox, oy, oz) and direction (dx, dy, dz).
1630
- * Direction should be normalized for accurate distance.
1631
- * Returns the perpendicular distance from the ray to the point.
1632
- * @param {number} ox
1633
- * @param {number} oy
1634
- * @param {number} oz
1635
- * @param {number} dx
1636
- * @param {number} dy
1637
- * @param {number} dz
1638
- * @param {number} px
1639
- * @param {number} py
1640
- * @param {number} pz
1641
- * @returns {number}
1642
- */
1643
- export function ray_distance_to_point(ox, oy, oz, dx, dy, dz, px, py, pz) {
1644
- const ret = wasm.ray_distance_to_point(ox, oy, oz, dx, dy, dz, px, py, pz);
1645
- return ret;
1646
- }
1647
-
1648
- /**
1649
- * Get a point along the ray at parameter t.
1650
- * Returns [x, y, z] = origin + t * direction
1651
- * @param {number} ox
1652
- * @param {number} oy
1653
- * @param {number} oz
1654
- * @param {number} dx
1655
- * @param {number} dy
1656
- * @param {number} dz
1657
- * @param {number} t
1658
- * @returns {Float64Array}
1659
- */
1660
- export function ray_point_at(ox, oy, oz, dx, dy, dz, t) {
1661
- const ret = wasm.ray_point_at(ox, oy, oz, dx, dy, dz, t);
1662
- var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1663
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1664
- return v1;
1665
- }
1666
-
1667
- /**
1668
- * Sample a NURBS curve.
1669
- * Input: degree, then flat control points [x,y,z,...], then flat weights, then flat knots
1670
- * Format: [degree, num_pts, x0,y0,z0, ..., w0,w1,..., k0,k1,...]
1671
- * @param {Float64Array} data
1672
- * @param {number} samples
1673
- * @returns {Float64Array}
1674
- */
1675
- export function sample_nurbs_curve(data, samples) {
1676
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
1677
- const len0 = WASM_VECTOR_LEN;
1678
- const ret = wasm.sample_nurbs_curve(ptr0, len0, samples);
1679
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1680
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1681
- return v2;
1682
- }
1683
-
1684
- /**
1685
- * Sweep a profile curve along a path curve using exact curve evaluation.
1686
- * profile_data/path_data: encoded curve (see decode_curve)
1687
- * Returns mesh buffers.
1688
- * @param {Float64Array} profile_data
1689
- * @param {Float64Array} path_data
1690
- * @param {number} profile_segments
1691
- * @param {number} path_segments
1692
- * @param {boolean} with_caps
1693
- * @returns {Float64Array}
1694
- */
1695
- export function sweep_curves(profile_data, path_data, profile_segments, path_segments, with_caps) {
1696
- const ptr0 = passArrayF64ToWasm0(profile_data, wasm.__wbindgen_malloc);
1697
- const len0 = WASM_VECTOR_LEN;
1698
- const ptr1 = passArrayF64ToWasm0(path_data, wasm.__wbindgen_malloc);
1699
- const len1 = WASM_VECTOR_LEN;
1700
- const ret = wasm.sweep_curves(ptr0, len0, ptr1, len1, profile_segments, path_segments, with_caps);
1701
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1702
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1703
- return v3;
1704
- }
1705
-
1706
- /**
1707
- * Sweep a profile polyline along a path polyline.
1708
- * profile_coords: flat [x,y,z,...] for profile curve
1709
- * path_coords: flat [x,y,z,...] for path curve
1710
- * with_caps: whether to close the ends
1711
- * Returns mesh buffers.
1712
- * @param {Float64Array} profile_coords
1713
- * @param {Float64Array} path_coords
1714
- * @param {boolean} with_caps
1715
- * @returns {Float64Array}
1716
- */
1717
- export function sweep_polylines(profile_coords, path_coords, with_caps) {
1718
- const ptr0 = passArrayF64ToWasm0(profile_coords, wasm.__wbindgen_malloc);
1719
- const len0 = WASM_VECTOR_LEN;
1720
- const ptr1 = passArrayF64ToWasm0(path_coords, wasm.__wbindgen_malloc);
1721
- const len1 = WASM_VECTOR_LEN;
1722
- const ret = wasm.sweep_polylines(ptr0, len0, ptr1, len1, with_caps);
1723
- var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1724
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1725
- return v3;
1726
- }
1727
-
1728
- /**
1729
- * Tessellate a NURBS surface to a mesh buffer.
1730
- * Input format: [degree_u, degree_v, num_u, num_v, ...control_points(flat)..., ...weights(flat)..., ...knots_u..., ...knots_v..., u_segs, v_segs]
1731
- * @param {Float64Array} data
1732
- * @returns {Float64Array}
1733
- */
1734
- export function tessellate_nurbs_surface(data) {
1735
- const ptr0 = passArrayF64ToWasm0(data, wasm.__wbindgen_malloc);
1736
- const len0 = WASM_VECTOR_LEN;
1737
- const ret = wasm.tessellate_nurbs_surface(ptr0, len0);
1738
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1739
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1740
- return v2;
1741
- }
1742
-
1743
- /**
1744
- * Simple test function to verify WASM is working
1745
- * @returns {string}
1746
- */
1747
- export function test_wasm() {
1748
- let deferred1_0;
1749
- let deferred1_1;
1750
- try {
1751
- const ret = wasm.test_wasm();
1752
- deferred1_0 = ret[0];
1753
- deferred1_1 = ret[1];
1754
- return getStringFromWasm0(ret[0], ret[1]);
1755
- } finally {
1756
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1757
- }
1758
- }
1759
-
1760
- /**
1761
- * Get version info
1762
- * @returns {string}
1763
- */
1764
- export function version() {
1765
- let deferred1_0;
1766
- let deferred1_1;
1767
- try {
1768
- const ret = wasm.version();
1769
- deferred1_0 = ret[0];
1770
- deferred1_1 = ret[1];
1771
- return getStringFromWasm0(ret[0], ret[1]);
1772
- } finally {
1773
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1774
- }
1775
- }
1776
-
1777
- function __wbg_get_imports() {
1778
- const import0 = {
1779
- __proto__: null,
1780
- __wbg___okgeometry_boolean_should_cancel_5ddaf5d663ad58f8: function() {
1781
- const ret = globalThis.__okgeometry_boolean_should_cancel();
1782
- return ret;
1783
- },
1784
- __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
1785
- throw new Error(getStringFromWasm0(arg0, arg1));
1786
- },
1787
- __wbg_error_9a7fe3f932034cde: function(arg0) {
1788
- console.error(arg0);
1789
- },
1790
- __wbg_now_a3af9a2f4bbaa4d1: function() {
1791
- const ret = Date.now();
1792
- return ret;
1793
- },
1794
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1795
- // Cast intrinsic for `Ref(String) -> Externref`.
1796
- const ret = getStringFromWasm0(arg0, arg1);
1797
- return ret;
1798
- },
1799
- __wbindgen_init_externref_table: function() {
1800
- const table = wasm.__wbindgen_externrefs;
1801
- const offset = table.grow(4);
1802
- table.set(0, undefined);
1803
- table.set(offset + 0, undefined);
1804
- table.set(offset + 1, null);
1805
- table.set(offset + 2, true);
1806
- table.set(offset + 3, false);
1807
- },
1808
- };
1809
- return {
1810
- __proto__: null,
1811
- "./okgeometrycore_bg.js": import0,
1812
- };
1813
- }
1814
-
1815
- function getArrayF64FromWasm0(ptr, len) {
1816
- ptr = ptr >>> 0;
1817
- return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1818
- }
1819
-
1820
- let cachedFloat64ArrayMemory0 = null;
1821
- function getFloat64ArrayMemory0() {
1822
- if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1823
- cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1824
- }
1825
- return cachedFloat64ArrayMemory0;
1826
- }
1827
-
1828
- function getStringFromWasm0(ptr, len) {
1829
- ptr = ptr >>> 0;
1830
- return decodeText(ptr, len);
1831
- }
1832
-
1833
- let cachedUint8ArrayMemory0 = null;
1834
- function getUint8ArrayMemory0() {
1835
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1836
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1837
- }
1838
- return cachedUint8ArrayMemory0;
1839
- }
1840
-
1841
- function passArrayF64ToWasm0(arg, malloc) {
1842
- const ptr = malloc(arg.length * 8, 8) >>> 0;
1843
- getFloat64ArrayMemory0().set(arg, ptr / 8);
1844
- WASM_VECTOR_LEN = arg.length;
1845
- return ptr;
1846
- }
1847
-
1848
- function passStringToWasm0(arg, malloc, realloc) {
1849
- if (realloc === undefined) {
1850
- const buf = cachedTextEncoder.encode(arg);
1851
- const ptr = malloc(buf.length, 1) >>> 0;
1852
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1853
- WASM_VECTOR_LEN = buf.length;
1854
- return ptr;
1855
- }
1856
-
1857
- let len = arg.length;
1858
- let ptr = malloc(len, 1) >>> 0;
1859
-
1860
- const mem = getUint8ArrayMemory0();
1861
-
1862
- let offset = 0;
1863
-
1864
- for (; offset < len; offset++) {
1865
- const code = arg.charCodeAt(offset);
1866
- if (code > 0x7F) break;
1867
- mem[ptr + offset] = code;
1868
- }
1869
- if (offset !== len) {
1870
- if (offset !== 0) {
1871
- arg = arg.slice(offset);
1872
- }
1873
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1874
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1875
- const ret = cachedTextEncoder.encodeInto(arg, view);
1876
-
1877
- offset += ret.written;
1878
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1879
- }
1880
-
1881
- WASM_VECTOR_LEN = offset;
1882
- return ptr;
1883
- }
1884
-
1885
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1886
- cachedTextDecoder.decode();
1887
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
1888
- let numBytesDecoded = 0;
1889
- function decodeText(ptr, len) {
1890
- numBytesDecoded += len;
1891
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1892
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1893
- cachedTextDecoder.decode();
1894
- numBytesDecoded = len;
1895
- }
1896
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1897
- }
1898
-
1899
- const cachedTextEncoder = new TextEncoder();
1900
-
1901
- if (!('encodeInto' in cachedTextEncoder)) {
1902
- cachedTextEncoder.encodeInto = function (arg, view) {
1903
- const buf = cachedTextEncoder.encode(arg);
1904
- view.set(buf);
1905
- return {
1906
- read: arg.length,
1907
- written: buf.length
1908
- };
1909
- };
1910
- }
1911
-
1912
- let WASM_VECTOR_LEN = 0;
1913
-
1914
- let wasmModule, wasm;
1915
- function __wbg_finalize_init(instance, module) {
1916
- wasm = instance.exports;
1917
- wasmModule = module;
1918
- cachedFloat64ArrayMemory0 = null;
1919
- cachedUint8ArrayMemory0 = null;
1920
- wasm.__wbindgen_start();
1921
- return wasm;
1922
- }
1923
-
1924
- async function __wbg_load(module, imports) {
1925
- if (typeof Response === 'function' && module instanceof Response) {
1926
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1927
- try {
1928
- return await WebAssembly.instantiateStreaming(module, imports);
1929
- } catch (e) {
1930
- const validResponse = module.ok && expectedResponseType(module.type);
1931
-
1932
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1933
- console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
1934
-
1935
- } else { throw e; }
1936
- }
1937
- }
1938
-
1939
- const bytes = await module.arrayBuffer();
1940
- return await WebAssembly.instantiate(bytes, imports);
1941
- } else {
1942
- const instance = await WebAssembly.instantiate(module, imports);
1943
-
1944
- if (instance instanceof WebAssembly.Instance) {
1945
- return { instance, module };
1946
- } else {
1947
- return instance;
1948
- }
1949
- }
1950
-
1951
- function expectedResponseType(type) {
1952
- switch (type) {
1953
- case 'basic': case 'cors': case 'default': return true;
1954
- }
1955
- return false;
1956
- }
1957
- }
1958
-
1959
- function initSync(module) {
1960
- if (wasm !== undefined) return wasm;
1961
-
1962
-
1963
- if (module !== undefined) {
1964
- if (Object.getPrototypeOf(module) === Object.prototype) {
1965
- ({module} = module)
1966
- } else {
1967
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1968
- }
1969
- }
1970
-
1971
- const imports = __wbg_get_imports();
1972
- if (!(module instanceof WebAssembly.Module)) {
1973
- module = new WebAssembly.Module(module);
1974
- }
1975
- const instance = new WebAssembly.Instance(module, imports);
1976
- return __wbg_finalize_init(instance, module);
1977
- }
1978
-
1979
- async function __wbg_init(module_or_path) {
1980
- if (wasm !== undefined) return wasm;
1981
-
1982
-
1983
- if (module_or_path !== undefined) {
1984
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1985
- ({module_or_path} = module_or_path)
1986
- } else {
1987
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1988
- }
1989
- }
1990
-
1991
- if (module_or_path === undefined) {
1992
- module_or_path = new URL('okgeometrycore_bg.wasm', import.meta.url);
1993
- }
1994
- const imports = __wbg_get_imports();
1995
-
1996
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1997
- module_or_path = fetch(module_or_path);
1998
- }
1999
-
2000
- const { instance, module } = await __wbg_load(await module_or_path, imports);
2001
-
2002
- return __wbg_finalize_init(instance, module);
2003
- }
2004
-
2005
- export { initSync, __wbg_init as default };