okgeometry-api 1.1.7 → 1.1.9

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