brepkit-wasm 4.9.0 → 4.11.0

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.
@@ -23,13 +23,14 @@ class BrepKernel {
23
23
  *
24
24
  * Returns a new face handle (`u32`).
25
25
  * @param {number} face
26
- * @param {Uint32Array} hole_wire_handles
26
+ * @param {Uint32Array | number[]} hole_wire_handles
27
27
  * @returns {number}
28
28
  */
29
29
  addHolesToFace(face, hole_wire_handles) {
30
+ const val2 = +face;
30
31
  const ptr0 = passArray32ToWasm0(hole_wire_handles, wasm.__wbindgen_malloc);
31
32
  const len0 = WASM_VECTOR_LEN;
32
- const ret = wasm.brepkernel_addHolesToFace(this.__wbg_ptr, face, ptr0, len0);
33
+ const ret = wasm.brepkernel_addHolesToFace(this.__wbg_ptr, val2, ptr0, len0);
33
34
  if (ret[2]) {
34
35
  throw takeFromExternrefTable0(ret[1]);
35
36
  }
@@ -56,7 +57,7 @@ class BrepKernel {
56
57
  * Approximate a curve through points using LSPIA (progressive iteration).
57
58
  *
58
59
  * Returns an edge handle.
59
- * @param {Float64Array} coords
60
+ * @param {Float64Array | number[]} coords
60
61
  * @param {number} degree
61
62
  * @param {number} num_control_points
62
63
  * @param {number} tolerance
@@ -64,9 +65,13 @@ class BrepKernel {
64
65
  * @returns {number}
65
66
  */
66
67
  approximateCurveLspia(coords, degree, num_control_points, tolerance, max_iterations) {
68
+ const val2 = +degree;
69
+ const val3 = +num_control_points;
70
+ const val4 = +tolerance;
71
+ const val5 = +max_iterations;
67
72
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
68
73
  const len0 = WASM_VECTOR_LEN;
69
- const ret = wasm.brepkernel_approximateCurveLspia(this.__wbg_ptr, ptr0, len0, degree, num_control_points, tolerance, max_iterations);
74
+ const ret = wasm.brepkernel_approximateCurveLspia(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5);
70
75
  if (ret[2]) {
71
76
  throw takeFromExternrefTable0(ret[1]);
72
77
  }
@@ -76,15 +81,17 @@ class BrepKernel {
76
81
  * Approximate a curve through points (least-squares).
77
82
  *
78
83
  * Returns an edge handle.
79
- * @param {Float64Array} coords
84
+ * @param {Float64Array | number[]} coords
80
85
  * @param {number} degree
81
86
  * @param {number} num_control_points
82
87
  * @returns {number}
83
88
  */
84
89
  approximateCurve(coords, degree, num_control_points) {
90
+ const val2 = +degree;
91
+ const val3 = +num_control_points;
85
92
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
86
93
  const len0 = WASM_VECTOR_LEN;
87
- const ret = wasm.brepkernel_approximateCurve(this.__wbg_ptr, ptr0, len0, degree, num_control_points);
94
+ const ret = wasm.brepkernel_approximateCurve(this.__wbg_ptr, ptr0, len0, val2, val3);
88
95
  if (ret[2]) {
89
96
  throw takeFromExternrefTable0(ret[1]);
90
97
  }
@@ -94,7 +101,7 @@ class BrepKernel {
94
101
  * Approximate a grid of points into a NURBS surface using LSPIA.
95
102
  *
96
103
  * Returns a face handle.
97
- * @param {Float64Array} coords
104
+ * @param {Float64Array | number[]} coords
98
105
  * @param {number} rows
99
106
  * @param {number} cols
100
107
  * @param {number} degree_u
@@ -106,9 +113,17 @@ class BrepKernel {
106
113
  * @returns {number}
107
114
  */
108
115
  approximateSurfaceLspia(coords, rows, cols, degree_u, degree_v, num_cps_u, num_cps_v, tolerance, max_iterations) {
116
+ const val2 = +rows;
117
+ const val3 = +cols;
118
+ const val4 = +degree_u;
119
+ const val5 = +degree_v;
120
+ const val6 = +num_cps_u;
121
+ const val7 = +num_cps_v;
122
+ const val8 = +tolerance;
123
+ const val9 = +max_iterations;
109
124
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
110
125
  const len0 = WASM_VECTOR_LEN;
111
- const ret = wasm.brepkernel_approximateSurfaceLspia(this.__wbg_ptr, ptr0, len0, rows, cols, degree_u, degree_v, num_cps_u, num_cps_v, tolerance, max_iterations);
126
+ const ret = wasm.brepkernel_approximateSurfaceLspia(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5, val6, val7, val8, val9);
112
127
  if (ret[2]) {
113
128
  throw takeFromExternrefTable0(ret[1]);
114
129
  }
@@ -122,15 +137,25 @@ class BrepKernel {
122
137
  * @param {number} parent
123
138
  * @param {string} name
124
139
  * @param {number} solid
125
- * @param {Float64Array} matrix
140
+ * @param {Float64Array | number[]} matrix
126
141
  * @returns {number}
127
142
  */
128
143
  assemblyAddChild(assembly, parent, name, solid, matrix) {
129
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
130
- const len0 = WASM_VECTOR_LEN;
131
- const ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
132
- const len1 = WASM_VECTOR_LEN;
133
- const ret = wasm.brepkernel_assemblyAddChild(this.__wbg_ptr, assembly, parent, ptr0, len0, solid, ptr1, len1);
144
+ const val3 = +assembly;
145
+ const val4 = +parent;
146
+ const val5 = +solid;
147
+ let ptr0, len0, ptr1, len1;
148
+ try {
149
+ ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
150
+ len0 = WASM_VECTOR_LEN;
151
+ ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
152
+ len1 = WASM_VECTOR_LEN;
153
+ } catch (e) {
154
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
155
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
156
+ throw e;
157
+ }
158
+ const ret = wasm.brepkernel_assemblyAddChild(this.__wbg_ptr, val3, val4, ptr0, len0, val5, ptr1, len1);
134
159
  if (ret[2]) {
135
160
  throw takeFromExternrefTable0(ret[1]);
136
161
  }
@@ -143,15 +168,24 @@ class BrepKernel {
143
168
  * @param {number} assembly
144
169
  * @param {string} name
145
170
  * @param {number} solid
146
- * @param {Float64Array} matrix
171
+ * @param {Float64Array | number[]} matrix
147
172
  * @returns {number}
148
173
  */
149
174
  assemblyAddRoot(assembly, name, solid, matrix) {
150
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
151
- const len0 = WASM_VECTOR_LEN;
152
- const ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
153
- const len1 = WASM_VECTOR_LEN;
154
- const ret = wasm.brepkernel_assemblyAddRoot(this.__wbg_ptr, assembly, ptr0, len0, solid, ptr1, len1);
175
+ const val3 = +assembly;
176
+ const val4 = +solid;
177
+ let ptr0, len0, ptr1, len1;
178
+ try {
179
+ ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
180
+ len0 = WASM_VECTOR_LEN;
181
+ ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
182
+ len1 = WASM_VECTOR_LEN;
183
+ } catch (e) {
184
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
185
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
186
+ throw e;
187
+ }
188
+ const ret = wasm.brepkernel_assemblyAddRoot(this.__wbg_ptr, val3, ptr0, len0, val4, ptr1, len1);
155
189
  if (ret[2]) {
156
190
  throw takeFromExternrefTable0(ret[1]);
157
191
  }
@@ -218,6 +252,49 @@ class BrepKernel {
218
252
  const ret = wasm.brepkernel_assemblyNew(this.__wbg_ptr, ptr0, len0);
219
253
  return ret >>> 0;
220
254
  }
255
+ /**
256
+ * Bridge two edge chains with a surface G1 or G2 continuous to the face
257
+ * beside each.
258
+ *
259
+ * Each chain lists its edges in running order, each stored either way.
260
+ * `options` is JSON: `{ "continuity": "g1" | "g2", "weights"?: [a, b] }`.
261
+ * Returns a face handle.
262
+ *
263
+ * # Errors
264
+ *
265
+ * Returns an error if a handle or the options are invalid, a weight is not
266
+ * positive, a chain breaks or leaves its face, or one chain is closed and
267
+ * the other open.
268
+ * @param {Uint32Array | number[]} chain_a
269
+ * @param {number} face_a
270
+ * @param {Uint32Array | number[]} chain_b
271
+ * @param {number} face_b
272
+ * @param {string} options
273
+ * @returns {number}
274
+ */
275
+ blendSurface(chain_a, face_a, chain_b, face_b, options) {
276
+ const val4 = +face_a;
277
+ const val5 = +face_b;
278
+ let ptr0, len0, ptr1, len1, ptr2, len2;
279
+ try {
280
+ ptr0 = passArray32ToWasm0(chain_a, wasm.__wbindgen_malloc);
281
+ len0 = WASM_VECTOR_LEN;
282
+ ptr1 = passArray32ToWasm0(chain_b, wasm.__wbindgen_malloc);
283
+ len1 = WASM_VECTOR_LEN;
284
+ ptr2 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
285
+ len2 = WASM_VECTOR_LEN;
286
+ } catch (e) {
287
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
288
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
289
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
290
+ throw e;
291
+ }
292
+ const ret = wasm.brepkernel_blendSurface(this.__wbg_ptr, ptr0, len0, val4, ptr1, len1, val5, ptr2, len2);
293
+ if (ret[2]) {
294
+ throw takeFromExternrefTable0(ret[1]);
295
+ }
296
+ return ret[0] >>> 0;
297
+ }
221
298
  /**
222
299
  * Compute the axis-aligned bounding box of a solid.
223
300
  *
@@ -265,20 +342,21 @@ class BrepKernel {
265
342
  * `coords` is a flat array `[x,y, x,y, ...]`.
266
343
  * `distance` is the chamfer distance from each corner.
267
344
  * Returns a flat array of the chamfered polygon coordinates.
268
- * @param {Float64Array} coords
345
+ * @param {Float64Array | number[]} coords
269
346
  * @param {number} distance
270
347
  * @returns {Float64Array}
271
348
  */
272
349
  chamfer2d(coords, distance) {
350
+ const val2 = +distance;
273
351
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
274
352
  const len0 = WASM_VECTOR_LEN;
275
- const ret = wasm.brepkernel_chamfer2d(this.__wbg_ptr, ptr0, len0, distance);
353
+ const ret = wasm.brepkernel_chamfer2d(this.__wbg_ptr, ptr0, len0, val2);
276
354
  if (ret[3]) {
277
355
  throw takeFromExternrefTable0(ret[2]);
278
356
  }
279
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
357
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
280
358
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
281
- return v2;
359
+ return v3;
282
360
  }
283
361
  /**
284
362
  * Chamfer edges with distance and angle using the v2 blend engine.
@@ -290,15 +368,18 @@ class BrepKernel {
290
368
  * Returns an error if the solid or edge handles are invalid, the blend
291
369
  * computation fails, or any edge could not be blended.
292
370
  * @param {number} solid
293
- * @param {Uint32Array} edge_handles
371
+ * @param {Uint32Array | number[]} edge_handles
294
372
  * @param {number} distance
295
373
  * @param {number} angle
296
374
  * @returns {number}
297
375
  */
298
376
  chamferDistanceAngle(solid, edge_handles, distance, angle) {
377
+ const val2 = +solid;
378
+ const val3 = +distance;
379
+ const val4 = +angle;
299
380
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
300
381
  const len0 = WASM_VECTOR_LEN;
301
- const ret = wasm.brepkernel_chamferDistanceAngle(this.__wbg_ptr, solid, ptr0, len0, distance, angle);
382
+ const ret = wasm.brepkernel_chamferDistanceAngle(this.__wbg_ptr, val2, ptr0, len0, val3, val4);
302
383
  if (ret[2]) {
303
384
  throw takeFromExternrefTable0(ret[1]);
304
385
  }
@@ -314,15 +395,18 @@ class BrepKernel {
314
395
  * Returns an error if the solid or edge handles are invalid, the blend
315
396
  * computation fails, or any edge could not be blended.
316
397
  * @param {number} solid
317
- * @param {Uint32Array} edge_handles
398
+ * @param {Uint32Array | number[]} edge_handles
318
399
  * @param {number} d1
319
400
  * @param {number} d2
320
401
  * @returns {number}
321
402
  */
322
403
  chamferV2(solid, edge_handles, d1, d2) {
404
+ const val2 = +solid;
405
+ const val3 = +d1;
406
+ const val4 = +d2;
323
407
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
324
408
  const len0 = WASM_VECTOR_LEN;
325
- const ret = wasm.brepkernel_chamferV2(this.__wbg_ptr, solid, ptr0, len0, d1, d2);
409
+ const ret = wasm.brepkernel_chamferV2(this.__wbg_ptr, val2, ptr0, len0, val3, val4);
326
410
  if (ret[2]) {
327
411
  throw takeFromExternrefTable0(ret[1]);
328
412
  }
@@ -337,14 +421,16 @@ class BrepKernel {
337
421
  *
338
422
  * Returns an error if distance is non-positive or edges are invalid.
339
423
  * @param {number} solid
340
- * @param {Uint32Array} edge_handles
424
+ * @param {Uint32Array | number[]} edge_handles
341
425
  * @param {number} distance
342
426
  * @returns {number}
343
427
  */
344
428
  chamfer(solid, edge_handles, distance) {
429
+ const val2 = +solid;
430
+ const val3 = +distance;
345
431
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
346
432
  const len0 = WASM_VECTOR_LEN;
347
- const ret = wasm.brepkernel_chamfer(this.__wbg_ptr, solid, ptr0, len0, distance);
433
+ const ret = wasm.brepkernel_chamfer(this.__wbg_ptr, val2, ptr0, len0, val3);
348
434
  if (ret[2]) {
349
435
  throw takeFromExternrefTable0(ret[1]);
350
436
  }
@@ -489,15 +575,22 @@ class BrepKernel {
489
575
  * Both polygons are flat arrays `[x,y, x,y, ...]`.
490
576
  * Returns a flat array of common segment endpoints `[x1,y1, x2,y2, ...]`,
491
577
  * or an empty array if no common segments exist.
492
- * @param {Float64Array} coords_a
493
- * @param {Float64Array} coords_b
578
+ * @param {Float64Array | number[]} coords_a
579
+ * @param {Float64Array | number[]} coords_b
494
580
  * @returns {Float64Array}
495
581
  */
496
582
  commonSegment2d(coords_a, coords_b) {
497
- const ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
498
- const len0 = WASM_VECTOR_LEN;
499
- const ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
500
- const len1 = WASM_VECTOR_LEN;
583
+ let ptr0, len0, ptr1, len1;
584
+ try {
585
+ ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
586
+ len0 = WASM_VECTOR_LEN;
587
+ ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
588
+ len1 = WASM_VECTOR_LEN;
589
+ } catch (e) {
590
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
591
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
592
+ throw e;
593
+ }
501
594
  const ret = wasm.brepkernel_commonSegment2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
502
595
  if (ret[3]) {
503
596
  throw takeFromExternrefTable0(ret[2]);
@@ -515,15 +608,22 @@ class BrepKernel {
515
608
  * # Errors
516
609
  *
517
610
  * Returns an error if either matrix doesn't have 16 elements.
518
- * @param {Float64Array} matrix_a
519
- * @param {Float64Array} matrix_b
611
+ * @param {Float64Array | number[]} matrix_a
612
+ * @param {Float64Array | number[]} matrix_b
520
613
  * @returns {Float64Array}
521
614
  */
522
615
  composeTransforms(matrix_a, matrix_b) {
523
- const ptr0 = passArrayF64ToWasm0(matrix_a, wasm.__wbindgen_malloc);
524
- const len0 = WASM_VECTOR_LEN;
525
- const ptr1 = passArrayF64ToWasm0(matrix_b, wasm.__wbindgen_malloc);
526
- const len1 = WASM_VECTOR_LEN;
616
+ let ptr0, len0, ptr1, len1;
617
+ try {
618
+ ptr0 = passArrayF64ToWasm0(matrix_a, wasm.__wbindgen_malloc);
619
+ len0 = WASM_VECTOR_LEN;
620
+ ptr1 = passArrayF64ToWasm0(matrix_b, wasm.__wbindgen_malloc);
621
+ len1 = WASM_VECTOR_LEN;
622
+ } catch (e) {
623
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
624
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
625
+ throw e;
626
+ }
527
627
  const ret = wasm.brepkernel_composeTransforms(this.__wbg_ptr, ptr0, len0, ptr1, len1);
528
628
  if (ret[3]) {
529
629
  throw takeFromExternrefTable0(ret[2]);
@@ -545,13 +645,14 @@ class BrepKernel {
545
645
  *
546
646
  * Returns an error if any handle is invalid or the operation fails.
547
647
  * @param {number} target
548
- * @param {Uint32Array} tool_ids
648
+ * @param {Uint32Array | number[]} tool_ids
549
649
  * @returns {number}
550
650
  */
551
651
  compoundCut(target, tool_ids) {
652
+ const val2 = +target;
552
653
  const ptr0 = passArray32ToWasm0(tool_ids, wasm.__wbindgen_malloc);
553
654
  const len0 = WASM_VECTOR_LEN;
554
- const ret = wasm.brepkernel_compoundCut(this.__wbg_ptr, target, ptr0, len0);
655
+ const ret = wasm.brepkernel_compoundCut(this.__wbg_ptr, val2, ptr0, len0);
555
656
  if (ret[2]) {
556
657
  throw takeFromExternrefTable0(ret[1]);
557
658
  }
@@ -614,7 +715,7 @@ class BrepKernel {
614
715
  * # Errors
615
716
  *
616
717
  * Returns an error if fewer than 4 non-coplanar points are provided.
617
- * @param {Float64Array} coords
718
+ * @param {Float64Array | number[]} coords
618
719
  * @returns {number}
619
720
  */
620
721
  convexHull(coords) {
@@ -637,13 +738,14 @@ class BrepKernel {
637
738
  * Returns an error if the solid handle is invalid, the matrix doesn't
638
739
  * have 16 elements, or the matrix is singular.
639
740
  * @param {number} solid
640
- * @param {Float64Array} matrix
741
+ * @param {Float64Array | number[]} matrix
641
742
  * @returns {number}
642
743
  */
643
744
  copyAndTransformSolid(solid, matrix) {
745
+ const val2 = +solid;
644
746
  const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
645
747
  const len0 = WASM_VECTOR_LEN;
646
- const ret = wasm.brepkernel_copyAndTransformSolid(this.__wbg_ptr, solid, ptr0, len0);
748
+ const ret = wasm.brepkernel_copyAndTransformSolid(this.__wbg_ptr, val2, ptr0, len0);
647
749
  if (ret[2]) {
648
750
  throw takeFromExternrefTable0(ret[1]);
649
751
  }
@@ -829,13 +931,14 @@ class BrepKernel {
829
931
  * `face_handles` is an array of face handles to remove.
830
932
  * Returns a new solid handle.
831
933
  * @param {number} solid
832
- * @param {Uint32Array} face_handles
934
+ * @param {Uint32Array | number[]} face_handles
833
935
  * @returns {number}
834
936
  */
835
937
  defeature(solid, face_handles) {
938
+ const val2 = +solid;
836
939
  const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
837
940
  const len0 = WASM_VECTOR_LEN;
838
- const ret = wasm.brepkernel_defeature(this.__wbg_ptr, solid, ptr0, len0);
941
+ const ret = wasm.brepkernel_defeature(this.__wbg_ptr, val2, ptr0, len0);
839
942
  if (ret[2]) {
840
943
  throw takeFromExternrefTable0(ret[1]);
841
944
  }
@@ -847,7 +950,7 @@ class BrepKernel {
847
950
  * # Errors
848
951
  *
849
952
  * Returns an error if the buffer is malformed or reconstruction fails.
850
- * @param {Uint8Array} data
953
+ * @param {Uint8Array | number[]} data
851
954
  * @returns {number}
852
955
  */
853
956
  deserializeSolid(data) {
@@ -941,7 +1044,7 @@ class BrepKernel {
941
1044
  *
942
1045
  * Returns an error if angle is zero or faces are invalid.
943
1046
  * @param {number} solid
944
- * @param {Uint32Array} face_handles
1047
+ * @param {Uint32Array | number[]} face_handles
945
1048
  * @param {number} pull_x
946
1049
  * @param {number} pull_y
947
1050
  * @param {number} pull_z
@@ -952,9 +1055,17 @@ class BrepKernel {
952
1055
  * @returns {number}
953
1056
  */
954
1057
  draft(solid, face_handles, pull_x, pull_y, pull_z, neutral_x, neutral_y, neutral_z, angle_degrees) {
1058
+ const val2 = +solid;
1059
+ const val3 = +pull_x;
1060
+ const val4 = +pull_y;
1061
+ const val5 = +pull_z;
1062
+ const val6 = +neutral_x;
1063
+ const val7 = +neutral_y;
1064
+ const val8 = +neutral_z;
1065
+ const val9 = +angle_degrees;
955
1066
  const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
956
1067
  const len0 = WASM_VECTOR_LEN;
957
- const ret = wasm.brepkernel_draft(this.__wbg_ptr, solid, ptr0, len0, pull_x, pull_y, pull_z, neutral_x, neutral_y, neutral_z, angle_degrees);
1068
+ const ret = wasm.brepkernel_draft(this.__wbg_ptr, val2, ptr0, len0, val3, val4, val5, val6, val7, val8, val9);
958
1069
  if (ret[2]) {
959
1070
  throw takeFromExternrefTable0(ret[1]);
960
1071
  }
@@ -1164,7 +1275,7 @@ class BrepKernel {
1164
1275
  * # Errors
1165
1276
  *
1166
1277
  * Returns an error if a solid handle is invalid or export fails.
1167
- * @param {Uint32Array} solids
1278
+ * @param {Uint32Array | number[]} solids
1168
1279
  * @returns {Uint8Array}
1169
1280
  */
1170
1281
  exportIgesSolids(solids) {
@@ -1393,21 +1504,48 @@ class BrepKernel {
1393
1504
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1394
1505
  return v1;
1395
1506
  }
1507
+ /**
1508
+ * Smooth a surface, staying within `tolerance` of it, with its boundary
1509
+ * held. A surface with no bumps to remove comes back unchanged.
1510
+ *
1511
+ * Returns a new face handle.
1512
+ *
1513
+ * # Errors
1514
+ *
1515
+ * Returns an error if the handle is invalid or `tolerance` is not positive.
1516
+ * @param {number} face
1517
+ * @param {number} tolerance
1518
+ * @returns {number}
1519
+ */
1520
+ fairSurface(face, tolerance) {
1521
+ const ret = wasm.brepkernel_fairSurface(this.__wbg_ptr, face, tolerance);
1522
+ if (ret[2]) {
1523
+ throw takeFromExternrefTable0(ret[1]);
1524
+ }
1525
+ return ret[0] >>> 0;
1526
+ }
1396
1527
  /**
1397
1528
  * Fill a 4-sided boundary with a Coons patch surface.
1398
1529
  *
1399
1530
  * `boundary_coords` is flat `[x,y,z, ...]` for all 4 curves concatenated.
1400
1531
  * `curve_lengths` is `[n0, n1, n2, n3]` — number of points per curve.
1401
1532
  * Returns a face handle.
1402
- * @param {Float64Array} boundary_coords
1403
- * @param {Uint32Array} curve_lengths
1533
+ * @param {Float64Array | number[]} boundary_coords
1534
+ * @param {Uint32Array | number[]} curve_lengths
1404
1535
  * @returns {number}
1405
1536
  */
1406
1537
  fillCoonsPatch(boundary_coords, curve_lengths) {
1407
- const ptr0 = passArrayF64ToWasm0(boundary_coords, wasm.__wbindgen_malloc);
1408
- const len0 = WASM_VECTOR_LEN;
1409
- const ptr1 = passArray32ToWasm0(curve_lengths, wasm.__wbindgen_malloc);
1410
- const len1 = WASM_VECTOR_LEN;
1538
+ let ptr0, len0, ptr1, len1;
1539
+ try {
1540
+ ptr0 = passArrayF64ToWasm0(boundary_coords, wasm.__wbindgen_malloc);
1541
+ len0 = WASM_VECTOR_LEN;
1542
+ ptr1 = passArray32ToWasm0(curve_lengths, wasm.__wbindgen_malloc);
1543
+ len1 = WASM_VECTOR_LEN;
1544
+ } catch (e) {
1545
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
1546
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
1547
+ throw e;
1548
+ }
1411
1549
  const ret = wasm.brepkernel_fillCoonsPatch(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1412
1550
  if (ret[2]) {
1413
1551
  throw takeFromExternrefTable0(ret[1]);
@@ -1420,20 +1558,60 @@ class BrepKernel {
1420
1558
  * `coords` is a flat array `[x,y, x,y, ...]`.
1421
1559
  * `radius` is the fillet radius.
1422
1560
  * Returns a flat array of the filleted polygon coordinates.
1423
- * @param {Float64Array} coords
1561
+ * @param {Float64Array | number[]} coords
1424
1562
  * @param {number} radius
1425
1563
  * @returns {Float64Array}
1426
1564
  */
1427
1565
  fillet2d(coords, radius) {
1566
+ const val2 = +radius;
1428
1567
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
1429
1568
  const len0 = WASM_VECTOR_LEN;
1430
- const ret = wasm.brepkernel_fillet2d(this.__wbg_ptr, ptr0, len0, radius);
1569
+ const ret = wasm.brepkernel_fillet2d(this.__wbg_ptr, ptr0, len0, val2);
1431
1570
  if (ret[3]) {
1432
1571
  throw takeFromExternrefTable0(ret[2]);
1433
1572
  }
1434
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1573
+ var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1435
1574
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1436
- return v2;
1575
+ return v3;
1576
+ }
1577
+ /**
1578
+ * Fillet edges with options at corners where three of them meet: how far
1579
+ * back along each edge its round stops, and what closes the hole that
1580
+ * leaves. `corners_json` is an array of
1581
+ * `{"vertex": h, "setbacks": [{"edge": h, "distance": d}, ...], "corner": "rolling" | "g2"}`,
1582
+ * with `setbacks` and `corner` optional: no set-backs and `"g2"` stops each
1583
+ * round one radius past where a ball would.
1584
+ *
1585
+ * # Errors
1586
+ *
1587
+ * Returns an error if a handle is invalid, the JSON is malformed, the blend
1588
+ * computation fails, or a corner is not three straight rounds between flat
1589
+ * faces with set-backs past the ball and short of each edge's far end.
1590
+ * @param {number} solid
1591
+ * @param {Uint32Array | number[]} edge_handles
1592
+ * @param {number} radius
1593
+ * @param {string} corners_json
1594
+ * @returns {number}
1595
+ */
1596
+ filletV2Corners(solid, edge_handles, radius, corners_json) {
1597
+ const val3 = +solid;
1598
+ const val4 = +radius;
1599
+ let ptr0, len0, ptr1, len1;
1600
+ try {
1601
+ ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
1602
+ len0 = WASM_VECTOR_LEN;
1603
+ ptr1 = passStringToWasm0(corners_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1604
+ len1 = WASM_VECTOR_LEN;
1605
+ } catch (e) {
1606
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
1607
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
1608
+ throw e;
1609
+ }
1610
+ const ret = wasm.brepkernel_filletV2Corners(this.__wbg_ptr, val3, ptr0, len0, val4, ptr1, len1);
1611
+ if (ret[2]) {
1612
+ throw takeFromExternrefTable0(ret[1]);
1613
+ }
1614
+ return ret[0] >>> 0;
1437
1615
  }
1438
1616
  /**
1439
1617
  * Fillet edges using the v2 walking-based blend engine.
@@ -1445,14 +1623,16 @@ class BrepKernel {
1445
1623
  * Returns an error if the solid or edge handles are invalid, the blend
1446
1624
  * computation fails, or any edge could not be blended.
1447
1625
  * @param {number} solid
1448
- * @param {Uint32Array} edge_handles
1626
+ * @param {Uint32Array | number[]} edge_handles
1449
1627
  * @param {number} radius
1450
1628
  * @returns {number}
1451
1629
  */
1452
1630
  filletV2(solid, edge_handles, radius) {
1631
+ const val2 = +solid;
1632
+ const val3 = +radius;
1453
1633
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
1454
1634
  const len0 = WASM_VECTOR_LEN;
1455
- const ret = wasm.brepkernel_filletV2(this.__wbg_ptr, solid, ptr0, len0, radius);
1635
+ const ret = wasm.brepkernel_filletV2(this.__wbg_ptr, val2, ptr0, len0, val3);
1456
1636
  if (ret[2]) {
1457
1637
  throw takeFromExternrefTable0(ret[1]);
1458
1638
  }
@@ -1472,9 +1652,10 @@ class BrepKernel {
1472
1652
  * @returns {number}
1473
1653
  */
1474
1654
  filletVariable(solid, json) {
1655
+ const val2 = +solid;
1475
1656
  const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1476
1657
  const len0 = WASM_VECTOR_LEN;
1477
- const ret = wasm.brepkernel_filletVariable(this.__wbg_ptr, solid, ptr0, len0);
1658
+ const ret = wasm.brepkernel_filletVariable(this.__wbg_ptr, val2, ptr0, len0);
1478
1659
  if (ret[2]) {
1479
1660
  throw takeFromExternrefTable0(ret[1]);
1480
1661
  }
@@ -1494,14 +1675,16 @@ class BrepKernel {
1494
1675
  * Returns an error if a handle is invalid, the radius is non-positive, or
1495
1676
  * the fillet fails.
1496
1677
  * @param {number} solid
1497
- * @param {Uint32Array} edge_handles
1678
+ * @param {Uint32Array | number[]} edge_handles
1498
1679
  * @param {number} radius
1499
1680
  * @returns {any}
1500
1681
  */
1501
1682
  filletWithEvolution(solid, edge_handles, radius) {
1683
+ const val2 = +solid;
1684
+ const val3 = +radius;
1502
1685
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
1503
1686
  const len0 = WASM_VECTOR_LEN;
1504
- const ret = wasm.brepkernel_filletWithEvolution(this.__wbg_ptr, solid, ptr0, len0, radius);
1687
+ const ret = wasm.brepkernel_filletWithEvolution(this.__wbg_ptr, val2, ptr0, len0, val3);
1505
1688
  if (ret[2]) {
1506
1689
  throw takeFromExternrefTable0(ret[1]);
1507
1690
  }
@@ -1517,14 +1700,16 @@ class BrepKernel {
1517
1700
  * Returns an error if radius is non-positive, edges are invalid, or no
1518
1701
  * fillet engine can produce a valid changed solid.
1519
1702
  * @param {number} solid
1520
- * @param {Uint32Array} edge_handles
1703
+ * @param {Uint32Array | number[]} edge_handles
1521
1704
  * @param {number} radius
1522
1705
  * @returns {number}
1523
1706
  */
1524
1707
  fillet(solid, edge_handles, radius) {
1708
+ const val2 = +solid;
1709
+ const val3 = +radius;
1525
1710
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
1526
1711
  const len0 = WASM_VECTOR_LEN;
1527
- const ret = wasm.brepkernel_fillet(this.__wbg_ptr, solid, ptr0, len0, radius);
1712
+ const ret = wasm.brepkernel_fillet(this.__wbg_ptr, val2, ptr0, len0, val3);
1528
1713
  if (ret[2]) {
1529
1714
  throw takeFromExternrefTable0(ret[1]);
1530
1715
  }
@@ -1582,7 +1767,7 @@ class BrepKernel {
1582
1767
  *
1583
1768
  * Returns an error if any solid handle is invalid, the list is empty,
1584
1769
  * or a boolean operation produces an empty or non-manifold result.
1585
- * @param {Uint32Array} solid_handles
1770
+ * @param {Uint32Array | number[]} solid_handles
1586
1771
  * @returns {number}
1587
1772
  */
1588
1773
  fuseAll(solid_handles) {
@@ -2263,29 +2448,43 @@ class BrepKernel {
2263
2448
  * profile, or a degenerate path.
2264
2449
  * @param {number} face
2265
2450
  * @param {number} spine_degree
2266
- * @param {Float64Array} spine_knots
2267
- * @param {Float64Array} spine_control_points
2268
- * @param {Float64Array} spine_weights
2451
+ * @param {Float64Array | number[]} spine_knots
2452
+ * @param {Float64Array | number[]} spine_control_points
2453
+ * @param {Float64Array | number[]} spine_weights
2269
2454
  * @param {number} aux_degree
2270
- * @param {Float64Array} aux_knots
2271
- * @param {Float64Array} aux_control_points
2272
- * @param {Float64Array} aux_weights
2455
+ * @param {Float64Array | number[]} aux_knots
2456
+ * @param {Float64Array | number[]} aux_control_points
2457
+ * @param {Float64Array | number[]} aux_weights
2273
2458
  * @returns {number}
2274
2459
  */
2275
2460
  guidedSweep(face, spine_degree, spine_knots, spine_control_points, spine_weights, aux_degree, aux_knots, aux_control_points, aux_weights) {
2276
- const ptr0 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
2277
- const len0 = WASM_VECTOR_LEN;
2278
- const ptr1 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
2279
- const len1 = WASM_VECTOR_LEN;
2280
- const ptr2 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
2281
- const len2 = WASM_VECTOR_LEN;
2282
- const ptr3 = passArrayF64ToWasm0(aux_knots, wasm.__wbindgen_malloc);
2283
- const len3 = WASM_VECTOR_LEN;
2284
- const ptr4 = passArrayF64ToWasm0(aux_control_points, wasm.__wbindgen_malloc);
2285
- const len4 = WASM_VECTOR_LEN;
2286
- const ptr5 = passArrayF64ToWasm0(aux_weights, wasm.__wbindgen_malloc);
2287
- const len5 = WASM_VECTOR_LEN;
2288
- const ret = wasm.brepkernel_guidedSweep(this.__wbg_ptr, face, spine_degree, ptr0, len0, ptr1, len1, ptr2, len2, aux_degree, ptr3, len3, ptr4, len4, ptr5, len5);
2461
+ const val7 = +face;
2462
+ const val8 = +spine_degree;
2463
+ const val9 = +aux_degree;
2464
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5;
2465
+ try {
2466
+ ptr0 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
2467
+ len0 = WASM_VECTOR_LEN;
2468
+ ptr1 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
2469
+ len1 = WASM_VECTOR_LEN;
2470
+ ptr2 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
2471
+ len2 = WASM_VECTOR_LEN;
2472
+ ptr3 = passArrayF64ToWasm0(aux_knots, wasm.__wbindgen_malloc);
2473
+ len3 = WASM_VECTOR_LEN;
2474
+ ptr4 = passArrayF64ToWasm0(aux_control_points, wasm.__wbindgen_malloc);
2475
+ len4 = WASM_VECTOR_LEN;
2476
+ ptr5 = passArrayF64ToWasm0(aux_weights, wasm.__wbindgen_malloc);
2477
+ len5 = WASM_VECTOR_LEN;
2478
+ } catch (e) {
2479
+ if (ptr5) { wasm.__wbindgen_free(ptr5, len5 * 8, 8); }
2480
+ if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 8, 8); }
2481
+ if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 8, 8); }
2482
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
2483
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
2484
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
2485
+ throw e;
2486
+ }
2487
+ const ret = wasm.brepkernel_guidedSweep(this.__wbg_ptr, val7, val8, ptr0, len0, ptr1, len1, ptr2, len2, val9, ptr3, len3, ptr4, len4, ptr5, len5);
2289
2488
  if (ret[2]) {
2290
2489
  throw takeFromExternrefTable0(ret[1]);
2291
2490
  }
@@ -2341,7 +2540,7 @@ class BrepKernel {
2341
2540
  * # Errors
2342
2541
  *
2343
2542
  * Returns an error if the 3MF data is malformed.
2344
- * @param {Uint8Array} data
2543
+ * @param {Uint8Array | number[]} data
2345
2544
  * @returns {Uint32Array}
2346
2545
  */
2347
2546
  import3mf(data) {
@@ -2361,7 +2560,7 @@ class BrepKernel {
2361
2560
  * # Errors
2362
2561
  *
2363
2562
  * Returns an error if the file is malformed or mesh import fails.
2364
- * @param {Uint8Array} data
2563
+ * @param {Uint8Array | number[]} data
2365
2564
  * @returns {number}
2366
2565
  */
2367
2566
  importGlb(data) {
@@ -2379,7 +2578,7 @@ class BrepKernel {
2379
2578
  * # Errors
2380
2579
  *
2381
2580
  * Returns an error if the IGES data is malformed.
2382
- * @param {Uint8Array} data
2581
+ * @param {Uint8Array | number[]} data
2383
2582
  * @returns {Uint32Array}
2384
2583
  */
2385
2584
  importIges(data) {
@@ -2403,15 +2602,22 @@ class BrepKernel {
2403
2602
  * # Errors
2404
2603
  *
2405
2604
  * Returns an error if the arrays are malformed or mesh import fails.
2406
- * @param {Float64Array} positions
2407
- * @param {Uint32Array} indices
2605
+ * @param {Float64Array | number[]} positions
2606
+ * @param {Uint32Array | number[]} indices
2408
2607
  * @returns {number}
2409
2608
  */
2410
2609
  importIndexedMesh(positions, indices) {
2411
- const ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
2412
- const len0 = WASM_VECTOR_LEN;
2413
- const ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
2414
- const len1 = WASM_VECTOR_LEN;
2610
+ let ptr0, len0, ptr1, len1;
2611
+ try {
2612
+ ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
2613
+ len0 = WASM_VECTOR_LEN;
2614
+ ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
2615
+ len1 = WASM_VECTOR_LEN;
2616
+ } catch (e) {
2617
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
2618
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
2619
+ throw e;
2620
+ }
2415
2621
  const ret = wasm.brepkernel_importIndexedMesh(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2416
2622
  if (ret[2]) {
2417
2623
  throw takeFromExternrefTable0(ret[1]);
@@ -2424,7 +2630,7 @@ class BrepKernel {
2424
2630
  * # Errors
2425
2631
  *
2426
2632
  * Returns an error if the file is malformed or mesh import fails.
2427
- * @param {Uint8Array} data
2633
+ * @param {Uint8Array | number[]} data
2428
2634
  * @returns {number}
2429
2635
  */
2430
2636
  importObj(data) {
@@ -2444,7 +2650,7 @@ class BrepKernel {
2444
2650
  * # Errors
2445
2651
  *
2446
2652
  * Returns an error if the STEP data is malformed.
2447
- * @param {Uint8Array} data
2653
+ * @param {Uint8Array | number[]} data
2448
2654
  * @returns {Uint32Array}
2449
2655
  */
2450
2656
  importStep(data) {
@@ -2467,7 +2673,7 @@ class BrepKernel {
2467
2673
  * # Errors
2468
2674
  *
2469
2675
  * Returns an error if the STL data is malformed or empty.
2470
- * @param {Uint8Array} data
2676
+ * @param {Uint8Array | number[]} data
2471
2677
  * @returns {number}
2472
2678
  */
2473
2679
  importStl(data) {
@@ -2491,16 +2697,24 @@ class BrepKernel {
2491
2697
  * along its marks, or the result would not be a valid solid of the same
2492
2698
  * volume.
2493
2699
  * @param {number} solid
2494
- * @param {Uint32Array} face_handles
2495
- * @param {Uint32Array} edge_handles
2700
+ * @param {Uint32Array | number[]} face_handles
2701
+ * @param {Uint32Array | number[]} edge_handles
2496
2702
  * @returns {number}
2497
2703
  */
2498
2704
  imprintFaces(solid, face_handles, edge_handles) {
2499
- const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
2500
- const len0 = WASM_VECTOR_LEN;
2501
- const ptr1 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
2502
- const len1 = WASM_VECTOR_LEN;
2503
- const ret = wasm.brepkernel_imprintFaces(this.__wbg_ptr, solid, ptr0, len0, ptr1, len1);
2705
+ const val3 = +solid;
2706
+ let ptr0, len0, ptr1, len1;
2707
+ try {
2708
+ ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
2709
+ len0 = WASM_VECTOR_LEN;
2710
+ ptr1 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
2711
+ len1 = WASM_VECTOR_LEN;
2712
+ } catch (e) {
2713
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
2714
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
2715
+ throw e;
2716
+ }
2717
+ const ret = wasm.brepkernel_imprintFaces(this.__wbg_ptr, val3, ptr0, len0, ptr1, len1);
2504
2718
  if (ret[2]) {
2505
2719
  throw takeFromExternrefTable0(ret[1]);
2506
2720
  }
@@ -2511,14 +2725,15 @@ class BrepKernel {
2511
2725
  *
2512
2726
  * Uses chord-length parameterization with the given degree.
2513
2727
  * Returns an edge handle (`u32`).
2514
- * @param {Float64Array} coords
2728
+ * @param {Float64Array | number[]} coords
2515
2729
  * @param {number} degree
2516
2730
  * @returns {number}
2517
2731
  */
2518
2732
  interpolatePoints(coords, degree) {
2733
+ const val2 = +degree;
2519
2734
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
2520
2735
  const len0 = WASM_VECTOR_LEN;
2521
- const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0, degree);
2736
+ const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0, val2);
2522
2737
  if (ret[2]) {
2523
2738
  throw takeFromExternrefTable0(ret[1]);
2524
2739
  }
@@ -2529,7 +2744,7 @@ class BrepKernel {
2529
2744
  *
2530
2745
  * `coords` is a flat array `[x,y,z, ...]` of `rows * cols` points.
2531
2746
  * Returns a face handle.
2532
- * @param {Float64Array} coords
2747
+ * @param {Float64Array | number[]} coords
2533
2748
  * @param {number} rows
2534
2749
  * @param {number} cols
2535
2750
  * @param {number} degree_u
@@ -2537,9 +2752,13 @@ class BrepKernel {
2537
2752
  * @returns {number}
2538
2753
  */
2539
2754
  interpolateSurface(coords, rows, cols, degree_u, degree_v) {
2755
+ const val2 = +rows;
2756
+ const val3 = +cols;
2757
+ const val4 = +degree_u;
2758
+ const val5 = +degree_v;
2540
2759
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
2541
2760
  const len0 = WASM_VECTOR_LEN;
2542
- const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0, rows, cols, degree_u, degree_v);
2761
+ const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5);
2543
2762
  if (ret[2]) {
2544
2763
  throw takeFromExternrefTable0(ret[1]);
2545
2764
  }
@@ -2553,15 +2772,22 @@ class BrepKernel {
2553
2772
  * or an empty array if they don't intersect.
2554
2773
  *
2555
2774
  * Uses the Sutherland-Hodgman algorithm (convex clipper).
2556
- * @param {Float64Array} coords_a
2557
- * @param {Float64Array} coords_b
2775
+ * @param {Float64Array | number[]} coords_a
2776
+ * @param {Float64Array | number[]} coords_b
2558
2777
  * @returns {Float64Array}
2559
2778
  */
2560
2779
  intersectPolygons2d(coords_a, coords_b) {
2561
- const ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
2562
- const len0 = WASM_VECTOR_LEN;
2563
- const ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
2564
- const len1 = WASM_VECTOR_LEN;
2780
+ let ptr0, len0, ptr1, len1;
2781
+ try {
2782
+ ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
2783
+ len0 = WASM_VECTOR_LEN;
2784
+ ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
2785
+ len1 = WASM_VECTOR_LEN;
2786
+ } catch (e) {
2787
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
2788
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
2789
+ throw e;
2790
+ }
2565
2791
  const ret = wasm.brepkernel_intersectPolygons2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2566
2792
  if (ret[3]) {
2567
2793
  throw takeFromExternrefTable0(ret[2]);
@@ -2666,7 +2892,7 @@ class BrepKernel {
2666
2892
  *
2667
2893
  * Returns an edge handle (`u32`).
2668
2894
  * @param {number} curve_type
2669
- * @param {Float64Array} curve_params
2895
+ * @param {Float64Array | number[]} curve_params
2670
2896
  * @param {number} origin_x
2671
2897
  * @param {number} origin_y
2672
2898
  * @param {number} origin_z
@@ -2681,9 +2907,21 @@ class BrepKernel {
2681
2907
  * @returns {number}
2682
2908
  */
2683
2909
  liftCurve2dToPlane(curve_type, curve_params, origin_x, origin_y, origin_z, x_axis_x, x_axis_y, x_axis_z, normal_x, normal_y, normal_z, t_start, t_end) {
2910
+ const val2 = +curve_type;
2911
+ const val3 = +origin_x;
2912
+ const val4 = +origin_y;
2913
+ const val5 = +origin_z;
2914
+ const val6 = +x_axis_x;
2915
+ const val7 = +x_axis_y;
2916
+ const val8 = +x_axis_z;
2917
+ const val9 = +normal_x;
2918
+ const val10 = +normal_y;
2919
+ const val11 = +normal_z;
2920
+ const val12 = +t_start;
2921
+ const val13 = +t_end;
2684
2922
  const ptr0 = passArrayF64ToWasm0(curve_params, wasm.__wbindgen_malloc);
2685
2923
  const len0 = WASM_VECTOR_LEN;
2686
- const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr, curve_type, ptr0, len0, origin_x, origin_y, origin_z, x_axis_x, x_axis_y, x_axis_z, normal_x, normal_y, normal_z, t_start, t_end);
2924
+ const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr, val2, ptr0, len0, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12, val13);
2687
2925
  if (ret[2]) {
2688
2926
  throw takeFromExternrefTable0(ret[1]);
2689
2927
  }
@@ -2725,7 +2963,7 @@ class BrepKernel {
2725
2963
  *
2726
2964
  * Returns an error if fewer than 2 profiles are given, profiles have
2727
2965
  * different vertex counts, or surface fitting fails.
2728
- * @param {Uint32Array} faces
2966
+ * @param {Uint32Array | number[]} faces
2729
2967
  * @returns {number}
2730
2968
  */
2731
2969
  loftSmooth(faces) {
@@ -2747,7 +2985,7 @@ class BrepKernel {
2747
2985
  * Returns an error if a handle is invalid, fewer than two wires are given,
2748
2986
  * their edge counts differ, a wire is closed, meets itself or breaks, two
2749
2987
  * wires touch where they would be joined, or two lines cross or fold over.
2750
- * @param {Uint32Array} wires
2988
+ * @param {Uint32Array | number[]} wires
2751
2989
  * @returns {number}
2752
2990
  */
2753
2991
  loftWires(wires) {
@@ -2769,15 +3007,34 @@ class BrepKernel {
2769
3007
  * - `solid: bool` — true (default) returns a solid handle; false returns
2770
3008
  * a shell handle holding the loft's faces without the caps on its end
2771
3009
  * profiles
2772
- * @param {Uint32Array} faces
3010
+ * - `rails: number[]`: edge handles of guide rails, each through a vertex
3011
+ * of every profile
3012
+ * - `railWires: number[]`: wire handles of guide rails, the same
3013
+ * - `start`, `end`: how the surface leaves the first or last profile, as
3014
+ * `"free"` (default), `"normal"`, `{ kind: "normal", weight }` or
3015
+ * `{ kind: "tangent", face, weight }`, `face` the handle of a face the
3016
+ * profile lies on and `weight` scaling the derivative from its natural
3017
+ * size (default 1, negative for the profile's other side)
3018
+ *
3019
+ * Rails and conditions build a surface no ruled loft can, and close their
3020
+ * ends on the profiles: with them, `ruled` defaults to false, and an
3021
+ * explicit `ruled: true`, a `startPoint` or an `endPoint` is refused.
3022
+ * @param {Uint32Array | number[]} faces
2773
3023
  * @param {string} options
2774
3024
  * @returns {number}
2775
3025
  */
2776
3026
  loftWithOptions(faces, options) {
2777
- const ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
2778
- const len0 = WASM_VECTOR_LEN;
2779
- const ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2780
- const len1 = WASM_VECTOR_LEN;
3027
+ let ptr0, len0, ptr1, len1;
3028
+ try {
3029
+ ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
3030
+ len0 = WASM_VECTOR_LEN;
3031
+ ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3032
+ len1 = WASM_VECTOR_LEN;
3033
+ } catch (e) {
3034
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
3035
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
3036
+ throw e;
3037
+ }
2781
3038
  const ret = wasm.brepkernel_loftWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1);
2782
3039
  if (ret[2]) {
2783
3040
  throw takeFromExternrefTable0(ret[1]);
@@ -2793,7 +3050,7 @@ class BrepKernel {
2793
3050
  *
2794
3051
  * Returns an error if fewer than 2 faces or profiles have
2795
3052
  * different vertex counts.
2796
- * @param {Uint32Array} faces
3053
+ * @param {Uint32Array | number[]} faces
2797
3054
  * @returns {number}
2798
3055
  */
2799
3056
  loft(faces) {
@@ -2963,7 +3220,7 @@ class BrepKernel {
2963
3220
  * Create a compound from multiple solid handles.
2964
3221
  *
2965
3222
  * Returns a compound handle (stored as `u32`).
2966
- * @param {Uint32Array} solid_handles
3223
+ * @param {Uint32Array | number[]} solid_handles
2967
3224
  * @returns {number}
2968
3225
  */
2969
3226
  makeCompound(solid_handles) {
@@ -3199,19 +3456,34 @@ class BrepKernel {
3199
3456
  * @param {number} end_y
3200
3457
  * @param {number} end_z
3201
3458
  * @param {number} degree
3202
- * @param {Float64Array} knots
3203
- * @param {Float64Array} control_points
3204
- * @param {Float64Array} weights
3459
+ * @param {Float64Array | number[]} knots
3460
+ * @param {Float64Array | number[]} control_points
3461
+ * @param {Float64Array | number[]} weights
3205
3462
  * @returns {number}
3206
3463
  */
3207
3464
  makeNurbsEdge(start_x, start_y, start_z, end_x, end_y, end_z, degree, knots, control_points, weights) {
3208
- const ptr0 = passArrayF64ToWasm0(knots, wasm.__wbindgen_malloc);
3209
- const len0 = WASM_VECTOR_LEN;
3210
- const ptr1 = passArrayF64ToWasm0(control_points, wasm.__wbindgen_malloc);
3211
- const len1 = WASM_VECTOR_LEN;
3212
- const ptr2 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
3213
- const len2 = WASM_VECTOR_LEN;
3214
- const ret = wasm.brepkernel_makeNurbsEdge(this.__wbg_ptr, start_x, start_y, start_z, end_x, end_y, end_z, degree, ptr0, len0, ptr1, len1, ptr2, len2);
3465
+ const val4 = +start_x;
3466
+ const val5 = +start_y;
3467
+ const val6 = +start_z;
3468
+ const val7 = +end_x;
3469
+ const val8 = +end_y;
3470
+ const val9 = +end_z;
3471
+ const val10 = +degree;
3472
+ let ptr0, len0, ptr1, len1, ptr2, len2;
3473
+ try {
3474
+ ptr0 = passArrayF64ToWasm0(knots, wasm.__wbindgen_malloc);
3475
+ len0 = WASM_VECTOR_LEN;
3476
+ ptr1 = passArrayF64ToWasm0(control_points, wasm.__wbindgen_malloc);
3477
+ len1 = WASM_VECTOR_LEN;
3478
+ ptr2 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
3479
+ len2 = WASM_VECTOR_LEN;
3480
+ } catch (e) {
3481
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
3482
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
3483
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
3484
+ throw e;
3485
+ }
3486
+ const ret = wasm.brepkernel_makeNurbsEdge(this.__wbg_ptr, val4, val5, val6, val7, val8, val9, val10, ptr0, len0, ptr1, len1, ptr2, len2);
3215
3487
  if (ret[2]) {
3216
3488
  throw takeFromExternrefTable0(ret[1]);
3217
3489
  }
@@ -3239,7 +3511,7 @@ class BrepKernel {
3239
3511
  * Create a closed polygon wire from flat coordinates.
3240
3512
  *
3241
3513
  * Returns a wire handle.
3242
- * @param {Float64Array} coords
3514
+ * @param {Float64Array | number[]} coords
3243
3515
  * @returns {number}
3244
3516
  */
3245
3517
  makePolygonWire(coords) {
@@ -3261,7 +3533,7 @@ class BrepKernel {
3261
3533
  *
3262
3534
  * Returns an error if `coords` length is not a multiple of 3,
3263
3535
  * fewer than 3 points are provided, or the face normal is degenerate.
3264
- * @param {Float64Array} coords
3536
+ * @param {Float64Array | number[]} coords
3265
3537
  * @returns {number}
3266
3538
  */
3267
3539
  makePolygon(coords) {
@@ -3313,7 +3585,7 @@ class BrepKernel {
3313
3585
  *
3314
3586
  * Alias for `sewFaces` with a default tolerance. This is the equivalent
3315
3587
  * of sewing faces into a closed shell and building a solid.
3316
- * @param {Uint32Array} face_handles
3588
+ * @param {Uint32Array | number[]} face_handles
3317
3589
  * @returns {number}
3318
3590
  */
3319
3591
  makeSolid(face_handles) {
@@ -3410,14 +3682,46 @@ class BrepKernel {
3410
3682
  * Create a closed wire from an ordered array of edge handles.
3411
3683
  *
3412
3684
  * Returns a wire handle (`u32`).
3413
- * @param {Uint32Array} edge_handles
3685
+ * @param {Uint32Array | number[]} edge_handles
3414
3686
  * @param {boolean} closed
3415
3687
  * @returns {number}
3416
3688
  */
3417
3689
  makeWire(edge_handles, closed) {
3690
+ const val2 = +closed;
3418
3691
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
3419
3692
  const len0 = WASM_VECTOR_LEN;
3420
- const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0, closed);
3693
+ const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0, val2);
3694
+ if (ret[2]) {
3695
+ throw takeFromExternrefTable0(ret[1]);
3696
+ }
3697
+ return ret[0] >>> 0;
3698
+ }
3699
+ /**
3700
+ * Move one surface's edge on to another's at G0, G1 or G2, keeping the
3701
+ * rest of the surface as close as the move allows.
3702
+ *
3703
+ * `options` is JSON: `{ "continuity": "g0" | "g1" | "g2", "targetFace"?: face }`.
3704
+ * `targetFace` names the face a solid's edge is matched to, since it
3705
+ * bounds two. Returns a new face handle.
3706
+ *
3707
+ * # Errors
3708
+ *
3709
+ * Returns an error if a handle or the options are invalid, `edge` is not on
3710
+ * the face's outer boundary, or the target bounds no face or several when
3711
+ * a surface is needed and none is named.
3712
+ * @param {number} face
3713
+ * @param {number} edge
3714
+ * @param {number} target_edge
3715
+ * @param {string} options
3716
+ * @returns {number}
3717
+ */
3718
+ matchSurface(face, edge, target_edge, options) {
3719
+ const val2 = +face;
3720
+ const val3 = +edge;
3721
+ const val4 = +target_edge;
3722
+ const ptr0 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3723
+ const len0 = WASM_VECTOR_LEN;
3724
+ const ret = wasm.brepkernel_matchSurface(this.__wbg_ptr, val2, val3, val4, ptr0, len0);
3421
3725
  if (ret[2]) {
3422
3726
  throw takeFromExternrefTable0(ret[1]);
3423
3727
  }
@@ -3479,26 +3783,37 @@ class BrepKernel {
3479
3783
  * Perform a mesh boolean on raw triangle data.
3480
3784
  *
3481
3785
  * Returns a `JsMesh` with the result.
3482
- * @param {Float64Array} positions_a
3483
- * @param {Uint32Array} indices_a
3484
- * @param {Float64Array} positions_b
3485
- * @param {Uint32Array} indices_b
3786
+ * @param {Float64Array | number[]} positions_a
3787
+ * @param {Uint32Array | number[]} indices_a
3788
+ * @param {Float64Array | number[]} positions_b
3789
+ * @param {Uint32Array | number[]} indices_b
3486
3790
  * @param {string} op
3487
3791
  * @param {number} tolerance
3488
3792
  * @returns {JsMesh}
3489
3793
  */
3490
3794
  meshBoolean(positions_a, indices_a, positions_b, indices_b, op, tolerance) {
3491
- const ptr0 = passArrayF64ToWasm0(positions_a, wasm.__wbindgen_malloc);
3492
- const len0 = WASM_VECTOR_LEN;
3493
- const ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_malloc);
3494
- const len1 = WASM_VECTOR_LEN;
3495
- const ptr2 = passArrayF64ToWasm0(positions_b, wasm.__wbindgen_malloc);
3496
- const len2 = WASM_VECTOR_LEN;
3497
- const ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_malloc);
3498
- const len3 = WASM_VECTOR_LEN;
3499
- const ptr4 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3500
- const len4 = WASM_VECTOR_LEN;
3501
- const ret = wasm.brepkernel_meshBoolean(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, tolerance);
3795
+ const val6 = +tolerance;
3796
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
3797
+ try {
3798
+ ptr0 = passArrayF64ToWasm0(positions_a, wasm.__wbindgen_malloc);
3799
+ len0 = WASM_VECTOR_LEN;
3800
+ ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_malloc);
3801
+ len1 = WASM_VECTOR_LEN;
3802
+ ptr2 = passArrayF64ToWasm0(positions_b, wasm.__wbindgen_malloc);
3803
+ len2 = WASM_VECTOR_LEN;
3804
+ ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_malloc);
3805
+ len3 = WASM_VECTOR_LEN;
3806
+ ptr4 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3807
+ len4 = WASM_VECTOR_LEN;
3808
+ } catch (e) {
3809
+ if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 1, 1); }
3810
+ if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 4, 4); }
3811
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
3812
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
3813
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
3814
+ throw e;
3815
+ }
3816
+ const ret = wasm.brepkernel_meshBoolean(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, val6);
3502
3817
  if (ret[2]) {
3503
3818
  throw takeFromExternrefTable0(ret[1]);
3504
3819
  }
@@ -3619,27 +3934,39 @@ class BrepKernel {
3619
3934
  *
3620
3935
  * Returns an error for fewer than two sections, mismatched array lengths, a
3621
3936
  * non-finite or out-of-range value, a non-planar profile, or loft failure.
3622
- * @param {Uint32Array} face_handles
3623
- * @param {Float64Array} params
3937
+ * @param {Uint32Array | number[]} face_handles
3938
+ * @param {Float64Array | number[]} params
3624
3939
  * @param {number} spine_degree
3625
- * @param {Float64Array} spine_knots
3626
- * @param {Float64Array} spine_control_points
3627
- * @param {Float64Array} spine_weights
3940
+ * @param {Float64Array | number[]} spine_knots
3941
+ * @param {Float64Array | number[]} spine_control_points
3942
+ * @param {Float64Array | number[]} spine_weights
3628
3943
  * @param {boolean} ruled
3629
3944
  * @returns {number}
3630
3945
  */
3631
3946
  multiSectionSweep(face_handles, params, spine_degree, spine_knots, spine_control_points, spine_weights, ruled) {
3632
- const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
3633
- const len0 = WASM_VECTOR_LEN;
3634
- const ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
3635
- const len1 = WASM_VECTOR_LEN;
3636
- const ptr2 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
3637
- const len2 = WASM_VECTOR_LEN;
3638
- const ptr3 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
3639
- const len3 = WASM_VECTOR_LEN;
3640
- const ptr4 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
3641
- const len4 = WASM_VECTOR_LEN;
3642
- const ret = wasm.brepkernel_multiSectionSweep(this.__wbg_ptr, ptr0, len0, ptr1, len1, spine_degree, ptr2, len2, ptr3, len3, ptr4, len4, ruled);
3947
+ const val6 = +spine_degree;
3948
+ const val7 = +ruled;
3949
+ let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
3950
+ try {
3951
+ ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
3952
+ len0 = WASM_VECTOR_LEN;
3953
+ ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
3954
+ len1 = WASM_VECTOR_LEN;
3955
+ ptr2 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
3956
+ len2 = WASM_VECTOR_LEN;
3957
+ ptr3 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
3958
+ len3 = WASM_VECTOR_LEN;
3959
+ ptr4 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
3960
+ len4 = WASM_VECTOR_LEN;
3961
+ } catch (e) {
3962
+ if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 8, 8); }
3963
+ if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 8, 8); }
3964
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
3965
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
3966
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
3967
+ throw e;
3968
+ }
3969
+ const ret = wasm.brepkernel_multiSectionSweep(this.__wbg_ptr, ptr0, len0, ptr1, len1, val6, ptr2, len2, ptr3, len3, ptr4, len4, val7);
3643
3970
  if (ret[2]) {
3644
3971
  throw takeFromExternrefTable0(ret[1]);
3645
3972
  }
@@ -3679,21 +4006,23 @@ class BrepKernel {
3679
4006
  *
3680
4007
  * `coords` is a flat array `[x,y, x,y, ...]` of 2D points.
3681
4008
  * Returns a flat array of offset polygon coordinates.
3682
- * @param {Float64Array} coords
4009
+ * @param {Float64Array | number[]} coords
3683
4010
  * @param {number} distance
3684
4011
  * @param {number} tolerance
3685
4012
  * @returns {Float64Array}
3686
4013
  */
3687
4014
  offsetPolygon2d(coords, distance, tolerance) {
4015
+ const val2 = +distance;
4016
+ const val3 = +tolerance;
3688
4017
  const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
3689
4018
  const len0 = WASM_VECTOR_LEN;
3690
- const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0, distance, tolerance);
4019
+ const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
3691
4020
  if (ret[3]) {
3692
4021
  throw takeFromExternrefTable0(ret[2]);
3693
4022
  }
3694
- var v2 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
4023
+ var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
3695
4024
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
3696
- return v2;
4025
+ return v4;
3697
4026
  }
3698
4027
  /**
3699
4028
  * Offset all faces of a solid outward or inward (V2 pipeline).
@@ -3757,9 +4086,11 @@ class BrepKernel {
3757
4086
  * @returns {number}
3758
4087
  */
3759
4088
  offsetWire2DWithJoin(wire, distance, join_type) {
4089
+ const val2 = +wire;
4090
+ const val3 = +distance;
3760
4091
  const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3761
4092
  const len0 = WASM_VECTOR_LEN;
3762
- const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr, wire, distance, ptr0, len0);
4093
+ const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr, val2, val3, ptr0, len0);
3763
4094
  if (ret[2]) {
3764
4095
  throw takeFromExternrefTable0(ret[1]);
3765
4096
  }
@@ -3781,9 +4112,11 @@ class BrepKernel {
3781
4112
  * @returns {number}
3782
4113
  */
3783
4114
  offsetWireWithJoinType(face, distance, join_type) {
4115
+ const val2 = +face;
4116
+ const val3 = +distance;
3784
4117
  const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
3785
4118
  const len0 = WASM_VECTOR_LEN;
3786
- const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr, face, distance, ptr0, len0);
4119
+ const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr, val2, val3, ptr0, len0);
3787
4120
  if (ret[2]) {
3788
4121
  throw takeFromExternrefTable0(ret[1]);
3789
4122
  }
@@ -3814,19 +4147,29 @@ class BrepKernel {
3814
4147
  * Returns an error if the face or path is invalid.
3815
4148
  * @param {number} face
3816
4149
  * @param {number} path_degree
3817
- * @param {Float64Array} path_knots
3818
- * @param {Float64Array} path_control_points
3819
- * @param {Float64Array} path_weights
4150
+ * @param {Float64Array | number[]} path_knots
4151
+ * @param {Float64Array | number[]} path_control_points
4152
+ * @param {Float64Array | number[]} path_weights
3820
4153
  * @returns {number}
3821
4154
  */
3822
4155
  pipe(face, path_degree, path_knots, path_control_points, path_weights) {
3823
- const ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
3824
- const len0 = WASM_VECTOR_LEN;
3825
- const ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
3826
- const len1 = WASM_VECTOR_LEN;
3827
- const ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
3828
- const len2 = WASM_VECTOR_LEN;
3829
- const ret = wasm.brepkernel_pipe(this.__wbg_ptr, face, path_degree, ptr0, len0, ptr1, len1, ptr2, len2);
4156
+ const val4 = +face;
4157
+ const val5 = +path_degree;
4158
+ let ptr0, len0, ptr1, len1, ptr2, len2;
4159
+ try {
4160
+ ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
4161
+ len0 = WASM_VECTOR_LEN;
4162
+ ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
4163
+ len1 = WASM_VECTOR_LEN;
4164
+ ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
4165
+ len2 = WASM_VECTOR_LEN;
4166
+ } catch (e) {
4167
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
4168
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
4169
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
4170
+ throw e;
4171
+ }
4172
+ const ret = wasm.brepkernel_pipe(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
3830
4173
  if (ret[2]) {
3831
4174
  throw takeFromExternrefTable0(ret[1]);
3832
4175
  }
@@ -3837,15 +4180,17 @@ class BrepKernel {
3837
4180
  *
3838
4181
  * `polygon_coords` is a flat array `[x,y, x,y, ...]`.
3839
4182
  * Returns `true` if the point is inside the polygon (winding number test).
3840
- * @param {Float64Array} polygon_coords
4183
+ * @param {Float64Array | number[]} polygon_coords
3841
4184
  * @param {number} px
3842
4185
  * @param {number} py
3843
4186
  * @returns {boolean}
3844
4187
  */
3845
4188
  pointInPolygon2d(polygon_coords, px, py) {
4189
+ const val2 = +px;
4190
+ const val3 = +py;
3846
4191
  const ptr0 = passArrayF64ToWasm0(polygon_coords, wasm.__wbindgen_malloc);
3847
4192
  const len0 = WASM_VECTOR_LEN;
3848
- const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0, px, py);
4193
+ const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
3849
4194
  if (ret[2]) {
3850
4195
  throw takeFromExternrefTable0(ret[1]);
3851
4196
  }
@@ -3926,15 +4271,22 @@ class BrepKernel {
3926
4271
  * Both polygons are flat arrays `[x,y, x,y, ...]`.
3927
4272
  * Returns `true` if any vertex of one polygon is inside the other
3928
4273
  * or if any edges cross.
3929
- * @param {Float64Array} coords_a
3930
- * @param {Float64Array} coords_b
4274
+ * @param {Float64Array | number[]} coords_a
4275
+ * @param {Float64Array | number[]} coords_b
3931
4276
  * @returns {boolean}
3932
4277
  */
3933
4278
  polygonsIntersect2d(coords_a, coords_b) {
3934
- const ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
3935
- const len0 = WASM_VECTOR_LEN;
3936
- const ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
3937
- const len1 = WASM_VECTOR_LEN;
4279
+ let ptr0, len0, ptr1, len1;
4280
+ try {
4281
+ ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
4282
+ len0 = WASM_VECTOR_LEN;
4283
+ ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
4284
+ len1 = WASM_VECTOR_LEN;
4285
+ } catch (e) {
4286
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
4287
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
4288
+ throw e;
4289
+ }
3938
4290
  const ret = wasm.brepkernel_polygonsIntersect2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
3939
4291
  if (ret[2]) {
3940
4292
  throw takeFromExternrefTable0(ret[1]);
@@ -4002,7 +4354,7 @@ class BrepKernel {
4002
4354
  *
4003
4355
  * Returns an error for an empty list, an invalid handle, a non-positive
4004
4356
  * `deflection`, or a degenerate `dir`/`x_axis`.
4005
- * @param {Uint32Array} solids
4357
+ * @param {Uint32Array | number[]} solids
4006
4358
  * @param {number} origin_x
4007
4359
  * @param {number} origin_y
4008
4360
  * @param {number} origin_z
@@ -4017,9 +4369,20 @@ class BrepKernel {
4017
4369
  * @returns {any}
4018
4370
  */
4019
4371
  projectSolidsEdges(solids, origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, x_axis_x, x_axis_y, x_axis_z, hidden_lines, deflection) {
4372
+ const val2 = +origin_x;
4373
+ const val3 = +origin_y;
4374
+ const val4 = +origin_z;
4375
+ const val5 = +dir_x;
4376
+ const val6 = +dir_y;
4377
+ const val7 = +dir_z;
4378
+ const val8 = +x_axis_x;
4379
+ const val9 = +x_axis_y;
4380
+ const val10 = +x_axis_z;
4381
+ const val11 = +hidden_lines;
4382
+ const val12 = +deflection;
4020
4383
  const ptr0 = passArray32ToWasm0(solids, wasm.__wbindgen_malloc);
4021
4384
  const len0 = WASM_VECTOR_LEN;
4022
- const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0, origin_x, origin_y, origin_z, dir_x, dir_y, dir_z, x_axis_x, x_axis_y, x_axis_z, hidden_lines, deflection);
4385
+ const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12);
4023
4386
  if (ret[2]) {
4024
4387
  throw takeFromExternrefTable0(ret[1]);
4025
4388
  }
@@ -4256,14 +4619,15 @@ class BrepKernel {
4256
4619
  * # Errors
4257
4620
  *
4258
4621
  * Returns an error if fewer than 2 faces or sewing fails.
4259
- * @param {Uint32Array} face_handles
4622
+ * @param {Uint32Array | number[]} face_handles
4260
4623
  * @param {number} tolerance
4261
4624
  * @returns {number}
4262
4625
  */
4263
4626
  sewFaces(face_handles, tolerance) {
4627
+ const val2 = +tolerance;
4264
4628
  const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
4265
4629
  const len0 = WASM_VECTOR_LEN;
4266
- const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0, tolerance);
4630
+ const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0, val2);
4267
4631
  if (ret[2]) {
4268
4632
  throw takeFromExternrefTable0(ret[1]);
4269
4633
  }
@@ -4297,13 +4661,15 @@ class BrepKernel {
4297
4661
  * Returns an error if thickness is non-positive or the solid is invalid.
4298
4662
  * @param {number} solid
4299
4663
  * @param {number} thickness
4300
- * @param {Uint32Array} open_faces
4664
+ * @param {Uint32Array | number[]} open_faces
4301
4665
  * @returns {number}
4302
4666
  */
4303
4667
  shell(solid, thickness, open_faces) {
4668
+ const val2 = +solid;
4669
+ const val3 = +thickness;
4304
4670
  const ptr0 = passArray32ToWasm0(open_faces, wasm.__wbindgen_malloc);
4305
4671
  const len0 = WASM_VECTOR_LEN;
4306
- const ret = wasm.brepkernel_shell(this.__wbg_ptr, solid, thickness, ptr0, len0);
4672
+ const ret = wasm.brepkernel_shell(this.__wbg_ptr, val2, val3, ptr0, len0);
4307
4673
  if (ret[2]) {
4308
4674
  throw takeFromExternrefTable0(ret[1]);
4309
4675
  }
@@ -4352,9 +4718,10 @@ class BrepKernel {
4352
4718
  * @param {string} json
4353
4719
  */
4354
4720
  sketchAddConstraint(sketch, json) {
4721
+ const val2 = +sketch;
4355
4722
  const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4356
4723
  const len0 = WASM_VECTOR_LEN;
4357
- const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr, sketch, ptr0, len0);
4724
+ const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr, val2, ptr0, len0);
4358
4725
  if (ret[1]) {
4359
4726
  throw takeFromExternrefTable0(ret[0]);
4360
4727
  }
@@ -4488,19 +4855,20 @@ class BrepKernel {
4488
4855
  * along its marks, or the pieces would not be valid solids summing to the
4489
4856
  * solid's volume.
4490
4857
  * @param {number} solid
4491
- * @param {Uint32Array} face_handles
4858
+ * @param {Uint32Array | number[]} face_handles
4492
4859
  * @returns {Uint32Array}
4493
4860
  */
4494
4861
  splitByFaces(solid, face_handles) {
4862
+ const val2 = +solid;
4495
4863
  const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
4496
4864
  const len0 = WASM_VECTOR_LEN;
4497
- const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr, solid, ptr0, len0);
4865
+ const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr, val2, ptr0, len0);
4498
4866
  if (ret[3]) {
4499
4867
  throw takeFromExternrefTable0(ret[2]);
4500
4868
  }
4501
- var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
4869
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
4502
4870
  wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
4503
- return v2;
4871
+ return v3;
4504
4872
  }
4505
4873
  /**
4506
4874
  * Split a solid into two halves along a plane.
@@ -4559,13 +4927,14 @@ class BrepKernel {
4559
4927
  *
4560
4928
  * Returns an error if fewer than 2 edges or the fit fails.
4561
4929
  * @param {number} face
4562
- * @param {Uint32Array} edge_handles
4930
+ * @param {Uint32Array | number[]} edge_handles
4563
4931
  * @returns {number}
4564
4932
  */
4565
4933
  sweepAlongEdges(face, edge_handles) {
4934
+ const val2 = +face;
4566
4935
  const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
4567
4936
  const len0 = WASM_VECTOR_LEN;
4568
- const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr, face, ptr0, len0);
4937
+ const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr, val2, ptr0, len0);
4569
4938
  if (ret[2]) {
4570
4939
  throw takeFromExternrefTable0(ret[1]);
4571
4940
  }
@@ -4585,19 +4954,29 @@ class BrepKernel {
4585
4954
  * Returns an error if the face or path is invalid, or surface fitting fails.
4586
4955
  * @param {number} face
4587
4956
  * @param {number} path_degree
4588
- * @param {Float64Array} path_knots
4589
- * @param {Float64Array} path_control_points
4590
- * @param {Float64Array} path_weights
4957
+ * @param {Float64Array | number[]} path_knots
4958
+ * @param {Float64Array | number[]} path_control_points
4959
+ * @param {Float64Array | number[]} path_weights
4591
4960
  * @returns {number}
4592
4961
  */
4593
4962
  sweepSmooth(face, path_degree, path_knots, path_control_points, path_weights) {
4594
- const ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
4595
- const len0 = WASM_VECTOR_LEN;
4596
- const ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
4597
- const len1 = WASM_VECTOR_LEN;
4598
- const ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
4599
- const len2 = WASM_VECTOR_LEN;
4600
- const ret = wasm.brepkernel_sweepSmooth(this.__wbg_ptr, face, path_degree, ptr0, len0, ptr1, len1, ptr2, len2);
4963
+ const val4 = +face;
4964
+ const val5 = +path_degree;
4965
+ let ptr0, len0, ptr1, len1, ptr2, len2;
4966
+ try {
4967
+ ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
4968
+ len0 = WASM_VECTOR_LEN;
4969
+ ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
4970
+ len1 = WASM_VECTOR_LEN;
4971
+ ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
4972
+ len2 = WASM_VECTOR_LEN;
4973
+ } catch (e) {
4974
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
4975
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
4976
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
4977
+ throw e;
4978
+ }
4979
+ const ret = wasm.brepkernel_sweepSmooth(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
4601
4980
  if (ret[2]) {
4602
4981
  throw takeFromExternrefTable0(ret[1]);
4603
4982
  }
@@ -4616,13 +4995,14 @@ class BrepKernel {
4616
4995
  * Returns an error if a handle is invalid, the chain has no edges, breaks,
4617
4996
  * closes or has a kink, or the wire is closed.
4618
4997
  * @param {number} wire
4619
- * @param {Uint32Array} path_edges
4998
+ * @param {Uint32Array | number[]} path_edges
4620
4999
  * @returns {number}
4621
5000
  */
4622
5001
  sweepWire(wire, path_edges) {
5002
+ const val2 = +wire;
4623
5003
  const ptr0 = passArray32ToWasm0(path_edges, wasm.__wbindgen_malloc);
4624
5004
  const len0 = WASM_VECTOR_LEN;
4625
- const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr, wire, ptr0, len0);
5005
+ const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr, val2, ptr0, len0);
4626
5006
  if (ret[2]) {
4627
5007
  throw takeFromExternrefTable0(ret[1]);
4628
5008
  }
@@ -4638,19 +5018,30 @@ class BrepKernel {
4638
5018
  * @param {number} profile
4639
5019
  * @param {number} path_edge
4640
5020
  * @param {string} contact_mode
4641
- * @param {Float64Array} scale_values
5021
+ * @param {Float64Array | number[]} scale_values
4642
5022
  * @param {number} segments
4643
5023
  * @param {string} corner_mode
4644
5024
  * @returns {number}
4645
5025
  */
4646
5026
  sweepWithOptions(profile, path_edge, contact_mode, scale_values, segments, corner_mode) {
4647
- const ptr0 = passStringToWasm0(contact_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4648
- const len0 = WASM_VECTOR_LEN;
4649
- const ptr1 = passArrayF64ToWasm0(scale_values, wasm.__wbindgen_malloc);
4650
- const len1 = WASM_VECTOR_LEN;
4651
- const ptr2 = passStringToWasm0(corner_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4652
- const len2 = WASM_VECTOR_LEN;
4653
- const ret = wasm.brepkernel_sweepWithOptions(this.__wbg_ptr, profile, path_edge, ptr0, len0, ptr1, len1, segments, ptr2, len2);
5027
+ const val4 = +profile;
5028
+ const val5 = +path_edge;
5029
+ const val6 = +segments;
5030
+ let ptr0, len0, ptr1, len1, ptr2, len2;
5031
+ try {
5032
+ ptr0 = passStringToWasm0(contact_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5033
+ len0 = WASM_VECTOR_LEN;
5034
+ ptr1 = passArrayF64ToWasm0(scale_values, wasm.__wbindgen_malloc);
5035
+ len1 = WASM_VECTOR_LEN;
5036
+ ptr2 = passStringToWasm0(corner_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5037
+ len2 = WASM_VECTOR_LEN;
5038
+ } catch (e) {
5039
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
5040
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
5041
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
5042
+ throw e;
5043
+ }
5044
+ const ret = wasm.brepkernel_sweepWithOptions(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, val6, ptr2, len2);
4654
5045
  if (ret[2]) {
4655
5046
  throw takeFromExternrefTable0(ret[1]);
4656
5047
  }
@@ -4673,19 +5064,29 @@ class BrepKernel {
4673
5064
  * inconsistent lengths, or the sweep operation fails.
4674
5065
  * @param {number} face
4675
5066
  * @param {number} path_degree
4676
- * @param {Float64Array} path_knots
4677
- * @param {Float64Array} path_control_points
4678
- * @param {Float64Array} path_weights
5067
+ * @param {Float64Array | number[]} path_knots
5068
+ * @param {Float64Array | number[]} path_control_points
5069
+ * @param {Float64Array | number[]} path_weights
4679
5070
  * @returns {number}
4680
5071
  */
4681
5072
  sweep(face, path_degree, path_knots, path_control_points, path_weights) {
4682
- const ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
4683
- const len0 = WASM_VECTOR_LEN;
4684
- const ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
4685
- const len1 = WASM_VECTOR_LEN;
4686
- const ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
4687
- const len2 = WASM_VECTOR_LEN;
4688
- const ret = wasm.brepkernel_sweep(this.__wbg_ptr, face, path_degree, ptr0, len0, ptr1, len1, ptr2, len2);
5073
+ const val4 = +face;
5074
+ const val5 = +path_degree;
5075
+ let ptr0, len0, ptr1, len1, ptr2, len2;
5076
+ try {
5077
+ ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
5078
+ len0 = WASM_VECTOR_LEN;
5079
+ ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
5080
+ len1 = WASM_VECTOR_LEN;
5081
+ ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
5082
+ len2 = WASM_VECTOR_LEN;
5083
+ } catch (e) {
5084
+ if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
5085
+ if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
5086
+ if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
5087
+ throw e;
5088
+ }
5089
+ const ret = wasm.brepkernel_sweep(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
4689
5090
  if (ret[2]) {
4690
5091
  throw takeFromExternrefTable0(ret[1]);
4691
5092
  }
@@ -4886,12 +5287,13 @@ class BrepKernel {
4886
5287
  * Returns an error if the face handle is invalid, the matrix doesn't
4887
5288
  * have 16 elements, or the matrix is singular.
4888
5289
  * @param {number} face
4889
- * @param {Float64Array} matrix
5290
+ * @param {Float64Array | number[]} matrix
4890
5291
  */
4891
5292
  transformFace(face, matrix) {
5293
+ const val2 = +face;
4892
5294
  const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
4893
5295
  const len0 = WASM_VECTOR_LEN;
4894
- const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, face, ptr0, len0);
5296
+ const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, val2, ptr0, len0);
4895
5297
  if (ret[1]) {
4896
5298
  throw takeFromExternrefTable0(ret[0]);
4897
5299
  }
@@ -4906,12 +5308,13 @@ class BrepKernel {
4906
5308
  * Returns an error if the solid handle is invalid, the matrix doesn't
4907
5309
  * have 16 elements, or the matrix is singular.
4908
5310
  * @param {number} solid
4909
- * @param {Float64Array} matrix
5311
+ * @param {Float64Array | number[]} matrix
4910
5312
  */
4911
5313
  transformSolid(solid, matrix) {
5314
+ const val2 = +solid;
4912
5315
  const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
4913
5316
  const len0 = WASM_VECTOR_LEN;
4914
- const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr, solid, ptr0, len0);
5317
+ const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr, val2, ptr0, len0);
4915
5318
  if (ret[1]) {
4916
5319
  throw takeFromExternrefTable0(ret[0]);
4917
5320
  }
@@ -4926,12 +5329,13 @@ class BrepKernel {
4926
5329
  * Returns an error if the wire handle is invalid, the matrix doesn't
4927
5330
  * have 16 elements, or the matrix is singular.
4928
5331
  * @param {number} wire
4929
- * @param {Float64Array} matrix
5332
+ * @param {Float64Array | number[]} matrix
4930
5333
  */
4931
5334
  transformWire(wire, matrix) {
5335
+ const val2 = +wire;
4932
5336
  const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
4933
5337
  const len0 = WASM_VECTOR_LEN;
4934
- const ret = wasm.brepkernel_transformWire(this.__wbg_ptr, wire, ptr0, len0);
5338
+ const ret = wasm.brepkernel_transformWire(this.__wbg_ptr, val2, ptr0, len0);
4935
5339
  if (ret[1]) {
4936
5340
  throw takeFromExternrefTable0(ret[0]);
4937
5341
  }
@@ -5055,14 +5459,15 @@ class BrepKernel {
5055
5459
  *
5056
5460
  * Accepts an array of face handles from potentially different shells.
5057
5461
  * Sews all faces together into a single solid.
5058
- * @param {Uint32Array} face_handles
5462
+ * @param {Uint32Array | number[]} face_handles
5059
5463
  * @param {number} tolerance
5060
5464
  * @returns {number}
5061
5465
  */
5062
5466
  weldShellsAndFaces(face_handles, tolerance) {
5467
+ const val2 = +tolerance;
5063
5468
  const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
5064
5469
  const len0 = WASM_VECTOR_LEN;
5065
- const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0, tolerance);
5470
+ const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0, val2);
5066
5471
  if (ret[2]) {
5067
5472
  throw takeFromExternrefTable0(ret[1]);
5068
5473
  }
@@ -5532,30 +5937,30 @@ exports.setLogLevel = setLogLevel;
5532
5937
  function __wbg_get_imports() {
5533
5938
  const import0 = {
5534
5939
  __proto__: null,
5535
- __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
5940
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
5536
5941
  const ret = Error(getStringFromWasm0(arg0, arg1));
5537
5942
  return ret;
5538
5943
  },
5539
- __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
5944
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
5540
5945
  const ret = debugString(arg1);
5541
5946
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5542
5947
  const len1 = WASM_VECTOR_LEN;
5543
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5544
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5948
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
5949
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
5545
5950
  },
5546
- __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
5951
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
5547
5952
  throw new Error(getStringFromWasm0(arg0, arg1));
5548
5953
  },
5549
- __wbg_error_edd2929c907c1d29: function(arg0, arg1) {
5954
+ __wbg_error_4a5317fbdfb4920e: function(arg0, arg1) {
5550
5955
  console.error(getStringFromWasm0(arg0, arg1));
5551
5956
  },
5552
- __wbg_getRandomValues_436a51d0629d84e1: function() { return handleError(function (arg0, arg1) {
5957
+ __wbg_getRandomValues_8b6f1f663e6f188d: function() { return handleError(function (arg0, arg1) {
5553
5958
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
5554
5959
  }, arguments); },
5555
- __wbg_log_7a6395b35b7afc30: function(arg0, arg1) {
5960
+ __wbg_log_e0e0fa8c4a2c7863: function(arg0, arg1) {
5556
5961
  console.log(getStringFromWasm0(arg0, arg1));
5557
5962
  },
5558
- __wbg_warn_c1f48997abe88ed4: function(arg0, arg1) {
5963
+ __wbg_warn_f4db05d28a36aed9: function(arg0, arg1) {
5559
5964
  console.warn(getStringFromWasm0(arg0, arg1));
5560
5965
  },
5561
5966
  __wbindgen_generic_0000000000000001: function(arg0, arg1) {
@@ -5565,12 +5970,11 @@ function __wbg_get_imports() {
5565
5970
  },
5566
5971
  __wbindgen_init_externref_table: function() {
5567
5972
  const table = wasm.__wbindgen_externrefs;
5568
- const offset = table.grow(4);
5569
5973
  table.set(0, undefined);
5570
- table.set(offset + 0, undefined);
5571
- table.set(offset + 1, null);
5572
- table.set(offset + 2, true);
5573
- table.set(offset + 3, false);
5974
+ table.set(1024, undefined);
5975
+ table.set(1025, null);
5976
+ table.set(1026, true);
5977
+ table.set(1027, false);
5574
5978
  },
5575
5979
  };
5576
5980
  return {
@@ -5605,68 +6009,61 @@ function addToExternrefTable0(obj) {
5605
6009
  }
5606
6010
 
5607
6011
  function debugString(val) {
5608
- // primitive types
5609
- const type = typeof val;
5610
- if (type == 'number' || type == 'boolean' || val == null) {
5611
- return `${val}`;
5612
- }
5613
- if (type == 'string') {
5614
- return `"${val}"`;
5615
- }
5616
- if (type == 'symbol') {
5617
- const description = val.description;
5618
- if (description == null) {
5619
- return 'Symbol';
5620
- } else {
5621
- return `Symbol(${description})`;
5622
- }
5623
- }
5624
- if (type == 'function') {
5625
- const name = val.name;
5626
- if (typeof name == 'string' && name.length > 0) {
5627
- return `Function(${name})`;
5628
- } else {
5629
- return 'Function';
5630
- }
5631
- }
5632
- // objects
5633
- if (Array.isArray(val)) {
5634
- const length = val.length;
5635
- let debug = '[';
5636
- if (length > 0) {
5637
- debug += debugString(val[0]);
5638
- }
5639
- for(let i = 1; i < length; i++) {
5640
- debug += ', ' + debugString(val[i]);
5641
- }
5642
- debug += ']';
5643
- return debug;
5644
- }
5645
- // Test for built-in
5646
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
5647
- let className;
5648
- if (builtInMatches && builtInMatches.length > 1) {
5649
- className = builtInMatches[1];
5650
- } else {
5651
- // Failed to match the standard '[object ClassName]'
5652
- return toString.call(val);
5653
- }
5654
- if (className == 'Object') {
5655
- // we're a user defined class or Object
5656
- // JSON.stringify avoids problems with cycles, and is generally much
5657
- // easier than looping through ownProperties of `val`.
5658
- try {
5659
- return 'Object(' + JSON.stringify(val) + ')';
5660
- } catch (_) {
5661
- return 'Object';
6012
+ switch (typeof val) {
6013
+ // primitive types
6014
+ case 'number':
6015
+ case 'boolean':
6016
+ case 'undefined':
6017
+ return `${val}`;
6018
+ case 'string':
6019
+ return JSON.stringify(val);
6020
+ case 'bigint':
6021
+ return `${val}n`;
6022
+ case 'symbol':
6023
+ return val.description !== undefined
6024
+ ? `Symbol(${val.description})`
6025
+ : 'Symbol';
6026
+ case 'function':
6027
+ return typeof val.name === 'string' && val.name !== ''
6028
+ ? `Function(${val.name})`
6029
+ : 'Function';
6030
+ case 'object': {
6031
+ if (val === null) {
6032
+ return 'null';
6033
+ }
6034
+ // objects
6035
+ if (Array.isArray(val)) {
6036
+ return '[' + Array.from(val, debugString).join(', ') + ']';
6037
+ }
6038
+ // errors
6039
+ if (val instanceof Error) {
6040
+ return `${val.name}: ${val.message}\n${val.stack}`;
6041
+ }
6042
+
6043
+ const toStringOutput = toString.call(val);
6044
+ // Test for built-in
6045
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
6046
+
6047
+ // Failed to match the standard '[object ClassName]'
6048
+ if (className === undefined) {
6049
+ return toStringOutput;
6050
+ }
6051
+ if (className === 'Object') {
6052
+ // we're a user defined class or Object
6053
+ // JSON.stringify avoids problems with cycles, and is generally much
6054
+ // easier than looping through ownProperties of `val`.
6055
+ try {
6056
+ return 'Object(' + JSON.stringify(val) + ')';
6057
+ } catch (_) {
6058
+ return 'Object';
6059
+ }
6060
+ }
6061
+ // TODO we could test for more things here, like `Set`s and `Map`s.
6062
+ return className;
5662
6063
  }
6064
+ // Per MDN: 'This list of values is exhaustive.'
6065
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
5663
6066
  }
5664
- // errors
5665
- if (val instanceof Error) {
5666
- return `${val.name}: ${val.message}\n${val.stack}`;
5667
- }
5668
- // TODO we could test for more things here, like `Set`s and `Map`s.
5669
- return className;
5670
6067
  }
5671
6068
 
5672
6069
  function getArrayF32FromWasm0(ptr, len) {
@@ -5714,7 +6111,8 @@ function getFloat64ArrayMemory0() {
5714
6111
  }
5715
6112
 
5716
6113
  function getStringFromWasm0(ptr, len) {
5717
- return decodeText(ptr >>> 0, len);
6114
+ ptr = ptr >>> 0;
6115
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
5718
6116
  }
5719
6117
 
5720
6118
  let cachedUint32ArrayMemory0 = null;
@@ -5810,10 +6208,10 @@ function takeFromExternrefTable0(idx) {
5810
6208
  return value;
5811
6209
  }
5812
6210
 
5813
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
6211
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
5814
6212
  cachedTextDecoder.decode();
5815
- function decodeText(ptr, len) {
5816
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
6213
+ function decodeText(bytes) {
6214
+ return cachedTextDecoder.decode(bytes);
5817
6215
  }
5818
6216
 
5819
6217
  const cachedTextEncoder = new TextEncoder();