brepkit-wasm 4.9.0 → 4.10.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.
- package/brepkit_wasm.d.ts +123 -67
- package/brepkit_wasm_bg.js +718 -332
- package/brepkit_wasm_bg.wasm +0 -0
- package/brepkit_wasm_node.cjs +715 -329
- package/package.json +1 -1
package/brepkit_wasm_bg.js
CHANGED
|
@@ -21,13 +21,14 @@ export class BrepKernel {
|
|
|
21
21
|
*
|
|
22
22
|
* Returns a new face handle (`u32`).
|
|
23
23
|
* @param {number} face
|
|
24
|
-
* @param {Uint32Array} hole_wire_handles
|
|
24
|
+
* @param {Uint32Array | number[]} hole_wire_handles
|
|
25
25
|
* @returns {number}
|
|
26
26
|
*/
|
|
27
27
|
addHolesToFace(face, hole_wire_handles) {
|
|
28
|
+
const val2 = +face;
|
|
28
29
|
const ptr0 = passArray32ToWasm0(hole_wire_handles, wasm.__wbindgen_malloc);
|
|
29
30
|
const len0 = WASM_VECTOR_LEN;
|
|
30
|
-
const ret = wasm.brepkernel_addHolesToFace(this.__wbg_ptr,
|
|
31
|
+
const ret = wasm.brepkernel_addHolesToFace(this.__wbg_ptr, val2, ptr0, len0);
|
|
31
32
|
if (ret[2]) {
|
|
32
33
|
throw takeFromExternrefTable0(ret[1]);
|
|
33
34
|
}
|
|
@@ -54,7 +55,7 @@ export class BrepKernel {
|
|
|
54
55
|
* Approximate a curve through points using LSPIA (progressive iteration).
|
|
55
56
|
*
|
|
56
57
|
* Returns an edge handle.
|
|
57
|
-
* @param {Float64Array} coords
|
|
58
|
+
* @param {Float64Array | number[]} coords
|
|
58
59
|
* @param {number} degree
|
|
59
60
|
* @param {number} num_control_points
|
|
60
61
|
* @param {number} tolerance
|
|
@@ -62,9 +63,13 @@ export class BrepKernel {
|
|
|
62
63
|
* @returns {number}
|
|
63
64
|
*/
|
|
64
65
|
approximateCurveLspia(coords, degree, num_control_points, tolerance, max_iterations) {
|
|
66
|
+
const val2 = +degree;
|
|
67
|
+
const val3 = +num_control_points;
|
|
68
|
+
const val4 = +tolerance;
|
|
69
|
+
const val5 = +max_iterations;
|
|
65
70
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
66
71
|
const len0 = WASM_VECTOR_LEN;
|
|
67
|
-
const ret = wasm.brepkernel_approximateCurveLspia(this.__wbg_ptr, ptr0, len0,
|
|
72
|
+
const ret = wasm.brepkernel_approximateCurveLspia(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5);
|
|
68
73
|
if (ret[2]) {
|
|
69
74
|
throw takeFromExternrefTable0(ret[1]);
|
|
70
75
|
}
|
|
@@ -74,15 +79,17 @@ export class BrepKernel {
|
|
|
74
79
|
* Approximate a curve through points (least-squares).
|
|
75
80
|
*
|
|
76
81
|
* Returns an edge handle.
|
|
77
|
-
* @param {Float64Array} coords
|
|
82
|
+
* @param {Float64Array | number[]} coords
|
|
78
83
|
* @param {number} degree
|
|
79
84
|
* @param {number} num_control_points
|
|
80
85
|
* @returns {number}
|
|
81
86
|
*/
|
|
82
87
|
approximateCurve(coords, degree, num_control_points) {
|
|
88
|
+
const val2 = +degree;
|
|
89
|
+
const val3 = +num_control_points;
|
|
83
90
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
84
91
|
const len0 = WASM_VECTOR_LEN;
|
|
85
|
-
const ret = wasm.brepkernel_approximateCurve(this.__wbg_ptr, ptr0, len0,
|
|
92
|
+
const ret = wasm.brepkernel_approximateCurve(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
86
93
|
if (ret[2]) {
|
|
87
94
|
throw takeFromExternrefTable0(ret[1]);
|
|
88
95
|
}
|
|
@@ -92,7 +99,7 @@ export class BrepKernel {
|
|
|
92
99
|
* Approximate a grid of points into a NURBS surface using LSPIA.
|
|
93
100
|
*
|
|
94
101
|
* Returns a face handle.
|
|
95
|
-
* @param {Float64Array} coords
|
|
102
|
+
* @param {Float64Array | number[]} coords
|
|
96
103
|
* @param {number} rows
|
|
97
104
|
* @param {number} cols
|
|
98
105
|
* @param {number} degree_u
|
|
@@ -104,9 +111,17 @@ export class BrepKernel {
|
|
|
104
111
|
* @returns {number}
|
|
105
112
|
*/
|
|
106
113
|
approximateSurfaceLspia(coords, rows, cols, degree_u, degree_v, num_cps_u, num_cps_v, tolerance, max_iterations) {
|
|
114
|
+
const val2 = +rows;
|
|
115
|
+
const val3 = +cols;
|
|
116
|
+
const val4 = +degree_u;
|
|
117
|
+
const val5 = +degree_v;
|
|
118
|
+
const val6 = +num_cps_u;
|
|
119
|
+
const val7 = +num_cps_v;
|
|
120
|
+
const val8 = +tolerance;
|
|
121
|
+
const val9 = +max_iterations;
|
|
107
122
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
108
123
|
const len0 = WASM_VECTOR_LEN;
|
|
109
|
-
const ret = wasm.brepkernel_approximateSurfaceLspia(this.__wbg_ptr, ptr0, len0,
|
|
124
|
+
const ret = wasm.brepkernel_approximateSurfaceLspia(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5, val6, val7, val8, val9);
|
|
110
125
|
if (ret[2]) {
|
|
111
126
|
throw takeFromExternrefTable0(ret[1]);
|
|
112
127
|
}
|
|
@@ -120,15 +135,25 @@ export class BrepKernel {
|
|
|
120
135
|
* @param {number} parent
|
|
121
136
|
* @param {string} name
|
|
122
137
|
* @param {number} solid
|
|
123
|
-
* @param {Float64Array} matrix
|
|
138
|
+
* @param {Float64Array | number[]} matrix
|
|
124
139
|
* @returns {number}
|
|
125
140
|
*/
|
|
126
141
|
assemblyAddChild(assembly, parent, name, solid, matrix) {
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
const val3 = +assembly;
|
|
143
|
+
const val4 = +parent;
|
|
144
|
+
const val5 = +solid;
|
|
145
|
+
let ptr0, len0, ptr1, len1;
|
|
146
|
+
try {
|
|
147
|
+
ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
148
|
+
len0 = WASM_VECTOR_LEN;
|
|
149
|
+
ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
150
|
+
len1 = WASM_VECTOR_LEN;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
153
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
154
|
+
throw e;
|
|
155
|
+
}
|
|
156
|
+
const ret = wasm.brepkernel_assemblyAddChild(this.__wbg_ptr, val3, val4, ptr0, len0, val5, ptr1, len1);
|
|
132
157
|
if (ret[2]) {
|
|
133
158
|
throw takeFromExternrefTable0(ret[1]);
|
|
134
159
|
}
|
|
@@ -141,15 +166,24 @@ export class BrepKernel {
|
|
|
141
166
|
* @param {number} assembly
|
|
142
167
|
* @param {string} name
|
|
143
168
|
* @param {number} solid
|
|
144
|
-
* @param {Float64Array} matrix
|
|
169
|
+
* @param {Float64Array | number[]} matrix
|
|
145
170
|
* @returns {number}
|
|
146
171
|
*/
|
|
147
172
|
assemblyAddRoot(assembly, name, solid, matrix) {
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
const val3 = +assembly;
|
|
174
|
+
const val4 = +solid;
|
|
175
|
+
let ptr0, len0, ptr1, len1;
|
|
176
|
+
try {
|
|
177
|
+
ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
178
|
+
len0 = WASM_VECTOR_LEN;
|
|
179
|
+
ptr1 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
180
|
+
len1 = WASM_VECTOR_LEN;
|
|
181
|
+
} catch (e) {
|
|
182
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
183
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
184
|
+
throw e;
|
|
185
|
+
}
|
|
186
|
+
const ret = wasm.brepkernel_assemblyAddRoot(this.__wbg_ptr, val3, ptr0, len0, val4, ptr1, len1);
|
|
153
187
|
if (ret[2]) {
|
|
154
188
|
throw takeFromExternrefTable0(ret[1]);
|
|
155
189
|
}
|
|
@@ -216,6 +250,49 @@ export class BrepKernel {
|
|
|
216
250
|
const ret = wasm.brepkernel_assemblyNew(this.__wbg_ptr, ptr0, len0);
|
|
217
251
|
return ret >>> 0;
|
|
218
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Bridge two edge chains with a surface G1 or G2 continuous to the face
|
|
255
|
+
* beside each.
|
|
256
|
+
*
|
|
257
|
+
* Each chain lists its edges in running order, each stored either way.
|
|
258
|
+
* `options` is JSON: `{ "continuity": "g1" | "g2", "weights"?: [a, b] }`.
|
|
259
|
+
* Returns a face handle.
|
|
260
|
+
*
|
|
261
|
+
* # Errors
|
|
262
|
+
*
|
|
263
|
+
* Returns an error if a handle or the options are invalid, a weight is not
|
|
264
|
+
* positive, a chain breaks or leaves its face, or one chain is closed and
|
|
265
|
+
* the other open.
|
|
266
|
+
* @param {Uint32Array | number[]} chain_a
|
|
267
|
+
* @param {number} face_a
|
|
268
|
+
* @param {Uint32Array | number[]} chain_b
|
|
269
|
+
* @param {number} face_b
|
|
270
|
+
* @param {string} options
|
|
271
|
+
* @returns {number}
|
|
272
|
+
*/
|
|
273
|
+
blendSurface(chain_a, face_a, chain_b, face_b, options) {
|
|
274
|
+
const val4 = +face_a;
|
|
275
|
+
const val5 = +face_b;
|
|
276
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
277
|
+
try {
|
|
278
|
+
ptr0 = passArray32ToWasm0(chain_a, wasm.__wbindgen_malloc);
|
|
279
|
+
len0 = WASM_VECTOR_LEN;
|
|
280
|
+
ptr1 = passArray32ToWasm0(chain_b, wasm.__wbindgen_malloc);
|
|
281
|
+
len1 = WASM_VECTOR_LEN;
|
|
282
|
+
ptr2 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
283
|
+
len2 = WASM_VECTOR_LEN;
|
|
284
|
+
} catch (e) {
|
|
285
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
286
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
287
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
288
|
+
throw e;
|
|
289
|
+
}
|
|
290
|
+
const ret = wasm.brepkernel_blendSurface(this.__wbg_ptr, ptr0, len0, val4, ptr1, len1, val5, ptr2, len2);
|
|
291
|
+
if (ret[2]) {
|
|
292
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
293
|
+
}
|
|
294
|
+
return ret[0] >>> 0;
|
|
295
|
+
}
|
|
219
296
|
/**
|
|
220
297
|
* Compute the axis-aligned bounding box of a solid.
|
|
221
298
|
*
|
|
@@ -263,20 +340,21 @@ export class BrepKernel {
|
|
|
263
340
|
* `coords` is a flat array `[x,y, x,y, ...]`.
|
|
264
341
|
* `distance` is the chamfer distance from each corner.
|
|
265
342
|
* Returns a flat array of the chamfered polygon coordinates.
|
|
266
|
-
* @param {Float64Array} coords
|
|
343
|
+
* @param {Float64Array | number[]} coords
|
|
267
344
|
* @param {number} distance
|
|
268
345
|
* @returns {Float64Array}
|
|
269
346
|
*/
|
|
270
347
|
chamfer2d(coords, distance) {
|
|
348
|
+
const val2 = +distance;
|
|
271
349
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
272
350
|
const len0 = WASM_VECTOR_LEN;
|
|
273
|
-
const ret = wasm.brepkernel_chamfer2d(this.__wbg_ptr, ptr0, len0,
|
|
351
|
+
const ret = wasm.brepkernel_chamfer2d(this.__wbg_ptr, ptr0, len0, val2);
|
|
274
352
|
if (ret[3]) {
|
|
275
353
|
throw takeFromExternrefTable0(ret[2]);
|
|
276
354
|
}
|
|
277
|
-
var
|
|
355
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
278
356
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
279
|
-
return
|
|
357
|
+
return v3;
|
|
280
358
|
}
|
|
281
359
|
/**
|
|
282
360
|
* Chamfer edges with distance and angle using the v2 blend engine.
|
|
@@ -288,15 +366,18 @@ export class BrepKernel {
|
|
|
288
366
|
* Returns an error if the solid or edge handles are invalid, the blend
|
|
289
367
|
* computation fails, or any edge could not be blended.
|
|
290
368
|
* @param {number} solid
|
|
291
|
-
* @param {Uint32Array} edge_handles
|
|
369
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
292
370
|
* @param {number} distance
|
|
293
371
|
* @param {number} angle
|
|
294
372
|
* @returns {number}
|
|
295
373
|
*/
|
|
296
374
|
chamferDistanceAngle(solid, edge_handles, distance, angle) {
|
|
375
|
+
const val2 = +solid;
|
|
376
|
+
const val3 = +distance;
|
|
377
|
+
const val4 = +angle;
|
|
297
378
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
298
379
|
const len0 = WASM_VECTOR_LEN;
|
|
299
|
-
const ret = wasm.brepkernel_chamferDistanceAngle(this.__wbg_ptr,
|
|
380
|
+
const ret = wasm.brepkernel_chamferDistanceAngle(this.__wbg_ptr, val2, ptr0, len0, val3, val4);
|
|
300
381
|
if (ret[2]) {
|
|
301
382
|
throw takeFromExternrefTable0(ret[1]);
|
|
302
383
|
}
|
|
@@ -312,15 +393,18 @@ export class BrepKernel {
|
|
|
312
393
|
* Returns an error if the solid or edge handles are invalid, the blend
|
|
313
394
|
* computation fails, or any edge could not be blended.
|
|
314
395
|
* @param {number} solid
|
|
315
|
-
* @param {Uint32Array} edge_handles
|
|
396
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
316
397
|
* @param {number} d1
|
|
317
398
|
* @param {number} d2
|
|
318
399
|
* @returns {number}
|
|
319
400
|
*/
|
|
320
401
|
chamferV2(solid, edge_handles, d1, d2) {
|
|
402
|
+
const val2 = +solid;
|
|
403
|
+
const val3 = +d1;
|
|
404
|
+
const val4 = +d2;
|
|
321
405
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
322
406
|
const len0 = WASM_VECTOR_LEN;
|
|
323
|
-
const ret = wasm.brepkernel_chamferV2(this.__wbg_ptr,
|
|
407
|
+
const ret = wasm.brepkernel_chamferV2(this.__wbg_ptr, val2, ptr0, len0, val3, val4);
|
|
324
408
|
if (ret[2]) {
|
|
325
409
|
throw takeFromExternrefTable0(ret[1]);
|
|
326
410
|
}
|
|
@@ -335,14 +419,16 @@ export class BrepKernel {
|
|
|
335
419
|
*
|
|
336
420
|
* Returns an error if distance is non-positive or edges are invalid.
|
|
337
421
|
* @param {number} solid
|
|
338
|
-
* @param {Uint32Array} edge_handles
|
|
422
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
339
423
|
* @param {number} distance
|
|
340
424
|
* @returns {number}
|
|
341
425
|
*/
|
|
342
426
|
chamfer(solid, edge_handles, distance) {
|
|
427
|
+
const val2 = +solid;
|
|
428
|
+
const val3 = +distance;
|
|
343
429
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
344
430
|
const len0 = WASM_VECTOR_LEN;
|
|
345
|
-
const ret = wasm.brepkernel_chamfer(this.__wbg_ptr,
|
|
431
|
+
const ret = wasm.brepkernel_chamfer(this.__wbg_ptr, val2, ptr0, len0, val3);
|
|
346
432
|
if (ret[2]) {
|
|
347
433
|
throw takeFromExternrefTable0(ret[1]);
|
|
348
434
|
}
|
|
@@ -487,15 +573,22 @@ export class BrepKernel {
|
|
|
487
573
|
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
488
574
|
* Returns a flat array of common segment endpoints `[x1,y1, x2,y2, ...]`,
|
|
489
575
|
* or an empty array if no common segments exist.
|
|
490
|
-
* @param {Float64Array} coords_a
|
|
491
|
-
* @param {Float64Array} coords_b
|
|
576
|
+
* @param {Float64Array | number[]} coords_a
|
|
577
|
+
* @param {Float64Array | number[]} coords_b
|
|
492
578
|
* @returns {Float64Array}
|
|
493
579
|
*/
|
|
494
580
|
commonSegment2d(coords_a, coords_b) {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
581
|
+
let ptr0, len0, ptr1, len1;
|
|
582
|
+
try {
|
|
583
|
+
ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
|
|
584
|
+
len0 = WASM_VECTOR_LEN;
|
|
585
|
+
ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
|
|
586
|
+
len1 = WASM_VECTOR_LEN;
|
|
587
|
+
} catch (e) {
|
|
588
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
589
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
590
|
+
throw e;
|
|
591
|
+
}
|
|
499
592
|
const ret = wasm.brepkernel_commonSegment2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
500
593
|
if (ret[3]) {
|
|
501
594
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -513,15 +606,22 @@ export class BrepKernel {
|
|
|
513
606
|
* # Errors
|
|
514
607
|
*
|
|
515
608
|
* Returns an error if either matrix doesn't have 16 elements.
|
|
516
|
-
* @param {Float64Array} matrix_a
|
|
517
|
-
* @param {Float64Array} matrix_b
|
|
609
|
+
* @param {Float64Array | number[]} matrix_a
|
|
610
|
+
* @param {Float64Array | number[]} matrix_b
|
|
518
611
|
* @returns {Float64Array}
|
|
519
612
|
*/
|
|
520
613
|
composeTransforms(matrix_a, matrix_b) {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
614
|
+
let ptr0, len0, ptr1, len1;
|
|
615
|
+
try {
|
|
616
|
+
ptr0 = passArrayF64ToWasm0(matrix_a, wasm.__wbindgen_malloc);
|
|
617
|
+
len0 = WASM_VECTOR_LEN;
|
|
618
|
+
ptr1 = passArrayF64ToWasm0(matrix_b, wasm.__wbindgen_malloc);
|
|
619
|
+
len1 = WASM_VECTOR_LEN;
|
|
620
|
+
} catch (e) {
|
|
621
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
622
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
623
|
+
throw e;
|
|
624
|
+
}
|
|
525
625
|
const ret = wasm.brepkernel_composeTransforms(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
526
626
|
if (ret[3]) {
|
|
527
627
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -543,13 +643,14 @@ export class BrepKernel {
|
|
|
543
643
|
*
|
|
544
644
|
* Returns an error if any handle is invalid or the operation fails.
|
|
545
645
|
* @param {number} target
|
|
546
|
-
* @param {Uint32Array} tool_ids
|
|
646
|
+
* @param {Uint32Array | number[]} tool_ids
|
|
547
647
|
* @returns {number}
|
|
548
648
|
*/
|
|
549
649
|
compoundCut(target, tool_ids) {
|
|
650
|
+
const val2 = +target;
|
|
550
651
|
const ptr0 = passArray32ToWasm0(tool_ids, wasm.__wbindgen_malloc);
|
|
551
652
|
const len0 = WASM_VECTOR_LEN;
|
|
552
|
-
const ret = wasm.brepkernel_compoundCut(this.__wbg_ptr,
|
|
653
|
+
const ret = wasm.brepkernel_compoundCut(this.__wbg_ptr, val2, ptr0, len0);
|
|
553
654
|
if (ret[2]) {
|
|
554
655
|
throw takeFromExternrefTable0(ret[1]);
|
|
555
656
|
}
|
|
@@ -612,7 +713,7 @@ export class BrepKernel {
|
|
|
612
713
|
* # Errors
|
|
613
714
|
*
|
|
614
715
|
* Returns an error if fewer than 4 non-coplanar points are provided.
|
|
615
|
-
* @param {Float64Array} coords
|
|
716
|
+
* @param {Float64Array | number[]} coords
|
|
616
717
|
* @returns {number}
|
|
617
718
|
*/
|
|
618
719
|
convexHull(coords) {
|
|
@@ -635,13 +736,14 @@ export class BrepKernel {
|
|
|
635
736
|
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
636
737
|
* have 16 elements, or the matrix is singular.
|
|
637
738
|
* @param {number} solid
|
|
638
|
-
* @param {Float64Array} matrix
|
|
739
|
+
* @param {Float64Array | number[]} matrix
|
|
639
740
|
* @returns {number}
|
|
640
741
|
*/
|
|
641
742
|
copyAndTransformSolid(solid, matrix) {
|
|
743
|
+
const val2 = +solid;
|
|
642
744
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
643
745
|
const len0 = WASM_VECTOR_LEN;
|
|
644
|
-
const ret = wasm.brepkernel_copyAndTransformSolid(this.__wbg_ptr,
|
|
746
|
+
const ret = wasm.brepkernel_copyAndTransformSolid(this.__wbg_ptr, val2, ptr0, len0);
|
|
645
747
|
if (ret[2]) {
|
|
646
748
|
throw takeFromExternrefTable0(ret[1]);
|
|
647
749
|
}
|
|
@@ -827,13 +929,14 @@ export class BrepKernel {
|
|
|
827
929
|
* `face_handles` is an array of face handles to remove.
|
|
828
930
|
* Returns a new solid handle.
|
|
829
931
|
* @param {number} solid
|
|
830
|
-
* @param {Uint32Array} face_handles
|
|
932
|
+
* @param {Uint32Array | number[]} face_handles
|
|
831
933
|
* @returns {number}
|
|
832
934
|
*/
|
|
833
935
|
defeature(solid, face_handles) {
|
|
936
|
+
const val2 = +solid;
|
|
834
937
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
835
938
|
const len0 = WASM_VECTOR_LEN;
|
|
836
|
-
const ret = wasm.brepkernel_defeature(this.__wbg_ptr,
|
|
939
|
+
const ret = wasm.brepkernel_defeature(this.__wbg_ptr, val2, ptr0, len0);
|
|
837
940
|
if (ret[2]) {
|
|
838
941
|
throw takeFromExternrefTable0(ret[1]);
|
|
839
942
|
}
|
|
@@ -845,7 +948,7 @@ export class BrepKernel {
|
|
|
845
948
|
* # Errors
|
|
846
949
|
*
|
|
847
950
|
* Returns an error if the buffer is malformed or reconstruction fails.
|
|
848
|
-
* @param {Uint8Array} data
|
|
951
|
+
* @param {Uint8Array | number[]} data
|
|
849
952
|
* @returns {number}
|
|
850
953
|
*/
|
|
851
954
|
deserializeSolid(data) {
|
|
@@ -939,7 +1042,7 @@ export class BrepKernel {
|
|
|
939
1042
|
*
|
|
940
1043
|
* Returns an error if angle is zero or faces are invalid.
|
|
941
1044
|
* @param {number} solid
|
|
942
|
-
* @param {Uint32Array} face_handles
|
|
1045
|
+
* @param {Uint32Array | number[]} face_handles
|
|
943
1046
|
* @param {number} pull_x
|
|
944
1047
|
* @param {number} pull_y
|
|
945
1048
|
* @param {number} pull_z
|
|
@@ -950,9 +1053,17 @@ export class BrepKernel {
|
|
|
950
1053
|
* @returns {number}
|
|
951
1054
|
*/
|
|
952
1055
|
draft(solid, face_handles, pull_x, pull_y, pull_z, neutral_x, neutral_y, neutral_z, angle_degrees) {
|
|
1056
|
+
const val2 = +solid;
|
|
1057
|
+
const val3 = +pull_x;
|
|
1058
|
+
const val4 = +pull_y;
|
|
1059
|
+
const val5 = +pull_z;
|
|
1060
|
+
const val6 = +neutral_x;
|
|
1061
|
+
const val7 = +neutral_y;
|
|
1062
|
+
const val8 = +neutral_z;
|
|
1063
|
+
const val9 = +angle_degrees;
|
|
953
1064
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
954
1065
|
const len0 = WASM_VECTOR_LEN;
|
|
955
|
-
const ret = wasm.brepkernel_draft(this.__wbg_ptr,
|
|
1066
|
+
const ret = wasm.brepkernel_draft(this.__wbg_ptr, val2, ptr0, len0, val3, val4, val5, val6, val7, val8, val9);
|
|
956
1067
|
if (ret[2]) {
|
|
957
1068
|
throw takeFromExternrefTable0(ret[1]);
|
|
958
1069
|
}
|
|
@@ -1162,7 +1273,7 @@ export class BrepKernel {
|
|
|
1162
1273
|
* # Errors
|
|
1163
1274
|
*
|
|
1164
1275
|
* Returns an error if a solid handle is invalid or export fails.
|
|
1165
|
-
* @param {Uint32Array} solids
|
|
1276
|
+
* @param {Uint32Array | number[]} solids
|
|
1166
1277
|
* @returns {Uint8Array}
|
|
1167
1278
|
*/
|
|
1168
1279
|
exportIgesSolids(solids) {
|
|
@@ -1391,21 +1502,48 @@ export class BrepKernel {
|
|
|
1391
1502
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1392
1503
|
return v1;
|
|
1393
1504
|
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Smooth a surface, staying within `tolerance` of it, with its boundary
|
|
1507
|
+
* held. A surface with no bumps to remove comes back unchanged.
|
|
1508
|
+
*
|
|
1509
|
+
* Returns a new face handle.
|
|
1510
|
+
*
|
|
1511
|
+
* # Errors
|
|
1512
|
+
*
|
|
1513
|
+
* Returns an error if the handle is invalid or `tolerance` is not positive.
|
|
1514
|
+
* @param {number} face
|
|
1515
|
+
* @param {number} tolerance
|
|
1516
|
+
* @returns {number}
|
|
1517
|
+
*/
|
|
1518
|
+
fairSurface(face, tolerance) {
|
|
1519
|
+
const ret = wasm.brepkernel_fairSurface(this.__wbg_ptr, face, tolerance);
|
|
1520
|
+
if (ret[2]) {
|
|
1521
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1522
|
+
}
|
|
1523
|
+
return ret[0] >>> 0;
|
|
1524
|
+
}
|
|
1394
1525
|
/**
|
|
1395
1526
|
* Fill a 4-sided boundary with a Coons patch surface.
|
|
1396
1527
|
*
|
|
1397
1528
|
* `boundary_coords` is flat `[x,y,z, ...]` for all 4 curves concatenated.
|
|
1398
1529
|
* `curve_lengths` is `[n0, n1, n2, n3]` — number of points per curve.
|
|
1399
1530
|
* Returns a face handle.
|
|
1400
|
-
* @param {Float64Array} boundary_coords
|
|
1401
|
-
* @param {Uint32Array} curve_lengths
|
|
1531
|
+
* @param {Float64Array | number[]} boundary_coords
|
|
1532
|
+
* @param {Uint32Array | number[]} curve_lengths
|
|
1402
1533
|
* @returns {number}
|
|
1403
1534
|
*/
|
|
1404
1535
|
fillCoonsPatch(boundary_coords, curve_lengths) {
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1536
|
+
let ptr0, len0, ptr1, len1;
|
|
1537
|
+
try {
|
|
1538
|
+
ptr0 = passArrayF64ToWasm0(boundary_coords, wasm.__wbindgen_malloc);
|
|
1539
|
+
len0 = WASM_VECTOR_LEN;
|
|
1540
|
+
ptr1 = passArray32ToWasm0(curve_lengths, wasm.__wbindgen_malloc);
|
|
1541
|
+
len1 = WASM_VECTOR_LEN;
|
|
1542
|
+
} catch (e) {
|
|
1543
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
1544
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
1545
|
+
throw e;
|
|
1546
|
+
}
|
|
1409
1547
|
const ret = wasm.brepkernel_fillCoonsPatch(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1410
1548
|
if (ret[2]) {
|
|
1411
1549
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -1418,20 +1556,60 @@ export class BrepKernel {
|
|
|
1418
1556
|
* `coords` is a flat array `[x,y, x,y, ...]`.
|
|
1419
1557
|
* `radius` is the fillet radius.
|
|
1420
1558
|
* Returns a flat array of the filleted polygon coordinates.
|
|
1421
|
-
* @param {Float64Array} coords
|
|
1559
|
+
* @param {Float64Array | number[]} coords
|
|
1422
1560
|
* @param {number} radius
|
|
1423
1561
|
* @returns {Float64Array}
|
|
1424
1562
|
*/
|
|
1425
1563
|
fillet2d(coords, radius) {
|
|
1564
|
+
const val2 = +radius;
|
|
1426
1565
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
1427
1566
|
const len0 = WASM_VECTOR_LEN;
|
|
1428
|
-
const ret = wasm.brepkernel_fillet2d(this.__wbg_ptr, ptr0, len0,
|
|
1567
|
+
const ret = wasm.brepkernel_fillet2d(this.__wbg_ptr, ptr0, len0, val2);
|
|
1429
1568
|
if (ret[3]) {
|
|
1430
1569
|
throw takeFromExternrefTable0(ret[2]);
|
|
1431
1570
|
}
|
|
1432
|
-
var
|
|
1571
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1433
1572
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1434
|
-
return
|
|
1573
|
+
return v3;
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Fillet edges with options at corners where three of them meet: how far
|
|
1577
|
+
* back along each edge its round stops, and what closes the hole that
|
|
1578
|
+
* leaves. `corners_json` is an array of
|
|
1579
|
+
* `{"vertex": h, "setbacks": [{"edge": h, "distance": d}, ...], "corner": "rolling" | "g2"}`,
|
|
1580
|
+
* with `setbacks` and `corner` optional: no set-backs and `"g2"` stops each
|
|
1581
|
+
* round one radius past where a ball would.
|
|
1582
|
+
*
|
|
1583
|
+
* # Errors
|
|
1584
|
+
*
|
|
1585
|
+
* Returns an error if a handle is invalid, the JSON is malformed, the blend
|
|
1586
|
+
* computation fails, or a corner is not three straight rounds between flat
|
|
1587
|
+
* faces with set-backs past the ball and short of each edge's far end.
|
|
1588
|
+
* @param {number} solid
|
|
1589
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
1590
|
+
* @param {number} radius
|
|
1591
|
+
* @param {string} corners_json
|
|
1592
|
+
* @returns {number}
|
|
1593
|
+
*/
|
|
1594
|
+
filletV2Corners(solid, edge_handles, radius, corners_json) {
|
|
1595
|
+
const val3 = +solid;
|
|
1596
|
+
const val4 = +radius;
|
|
1597
|
+
let ptr0, len0, ptr1, len1;
|
|
1598
|
+
try {
|
|
1599
|
+
ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1600
|
+
len0 = WASM_VECTOR_LEN;
|
|
1601
|
+
ptr1 = passStringToWasm0(corners_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1602
|
+
len1 = WASM_VECTOR_LEN;
|
|
1603
|
+
} catch (e) {
|
|
1604
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
1605
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
1606
|
+
throw e;
|
|
1607
|
+
}
|
|
1608
|
+
const ret = wasm.brepkernel_filletV2Corners(this.__wbg_ptr, val3, ptr0, len0, val4, ptr1, len1);
|
|
1609
|
+
if (ret[2]) {
|
|
1610
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1611
|
+
}
|
|
1612
|
+
return ret[0] >>> 0;
|
|
1435
1613
|
}
|
|
1436
1614
|
/**
|
|
1437
1615
|
* Fillet edges using the v2 walking-based blend engine.
|
|
@@ -1443,14 +1621,16 @@ export class BrepKernel {
|
|
|
1443
1621
|
* Returns an error if the solid or edge handles are invalid, the blend
|
|
1444
1622
|
* computation fails, or any edge could not be blended.
|
|
1445
1623
|
* @param {number} solid
|
|
1446
|
-
* @param {Uint32Array} edge_handles
|
|
1624
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
1447
1625
|
* @param {number} radius
|
|
1448
1626
|
* @returns {number}
|
|
1449
1627
|
*/
|
|
1450
1628
|
filletV2(solid, edge_handles, radius) {
|
|
1629
|
+
const val2 = +solid;
|
|
1630
|
+
const val3 = +radius;
|
|
1451
1631
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1452
1632
|
const len0 = WASM_VECTOR_LEN;
|
|
1453
|
-
const ret = wasm.brepkernel_filletV2(this.__wbg_ptr,
|
|
1633
|
+
const ret = wasm.brepkernel_filletV2(this.__wbg_ptr, val2, ptr0, len0, val3);
|
|
1454
1634
|
if (ret[2]) {
|
|
1455
1635
|
throw takeFromExternrefTable0(ret[1]);
|
|
1456
1636
|
}
|
|
@@ -1470,9 +1650,10 @@ export class BrepKernel {
|
|
|
1470
1650
|
* @returns {number}
|
|
1471
1651
|
*/
|
|
1472
1652
|
filletVariable(solid, json) {
|
|
1653
|
+
const val2 = +solid;
|
|
1473
1654
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1474
1655
|
const len0 = WASM_VECTOR_LEN;
|
|
1475
|
-
const ret = wasm.brepkernel_filletVariable(this.__wbg_ptr,
|
|
1656
|
+
const ret = wasm.brepkernel_filletVariable(this.__wbg_ptr, val2, ptr0, len0);
|
|
1476
1657
|
if (ret[2]) {
|
|
1477
1658
|
throw takeFromExternrefTable0(ret[1]);
|
|
1478
1659
|
}
|
|
@@ -1492,14 +1673,16 @@ export class BrepKernel {
|
|
|
1492
1673
|
* Returns an error if a handle is invalid, the radius is non-positive, or
|
|
1493
1674
|
* the fillet fails.
|
|
1494
1675
|
* @param {number} solid
|
|
1495
|
-
* @param {Uint32Array} edge_handles
|
|
1676
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
1496
1677
|
* @param {number} radius
|
|
1497
1678
|
* @returns {any}
|
|
1498
1679
|
*/
|
|
1499
1680
|
filletWithEvolution(solid, edge_handles, radius) {
|
|
1681
|
+
const val2 = +solid;
|
|
1682
|
+
const val3 = +radius;
|
|
1500
1683
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1501
1684
|
const len0 = WASM_VECTOR_LEN;
|
|
1502
|
-
const ret = wasm.brepkernel_filletWithEvolution(this.__wbg_ptr,
|
|
1685
|
+
const ret = wasm.brepkernel_filletWithEvolution(this.__wbg_ptr, val2, ptr0, len0, val3);
|
|
1503
1686
|
if (ret[2]) {
|
|
1504
1687
|
throw takeFromExternrefTable0(ret[1]);
|
|
1505
1688
|
}
|
|
@@ -1515,14 +1698,16 @@ export class BrepKernel {
|
|
|
1515
1698
|
* Returns an error if radius is non-positive, edges are invalid, or no
|
|
1516
1699
|
* fillet engine can produce a valid changed solid.
|
|
1517
1700
|
* @param {number} solid
|
|
1518
|
-
* @param {Uint32Array} edge_handles
|
|
1701
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
1519
1702
|
* @param {number} radius
|
|
1520
1703
|
* @returns {number}
|
|
1521
1704
|
*/
|
|
1522
1705
|
fillet(solid, edge_handles, radius) {
|
|
1706
|
+
const val2 = +solid;
|
|
1707
|
+
const val3 = +radius;
|
|
1523
1708
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1524
1709
|
const len0 = WASM_VECTOR_LEN;
|
|
1525
|
-
const ret = wasm.brepkernel_fillet(this.__wbg_ptr,
|
|
1710
|
+
const ret = wasm.brepkernel_fillet(this.__wbg_ptr, val2, ptr0, len0, val3);
|
|
1526
1711
|
if (ret[2]) {
|
|
1527
1712
|
throw takeFromExternrefTable0(ret[1]);
|
|
1528
1713
|
}
|
|
@@ -1580,7 +1765,7 @@ export class BrepKernel {
|
|
|
1580
1765
|
*
|
|
1581
1766
|
* Returns an error if any solid handle is invalid, the list is empty,
|
|
1582
1767
|
* or a boolean operation produces an empty or non-manifold result.
|
|
1583
|
-
* @param {Uint32Array} solid_handles
|
|
1768
|
+
* @param {Uint32Array | number[]} solid_handles
|
|
1584
1769
|
* @returns {number}
|
|
1585
1770
|
*/
|
|
1586
1771
|
fuseAll(solid_handles) {
|
|
@@ -2261,29 +2446,43 @@ export class BrepKernel {
|
|
|
2261
2446
|
* profile, or a degenerate path.
|
|
2262
2447
|
* @param {number} face
|
|
2263
2448
|
* @param {number} spine_degree
|
|
2264
|
-
* @param {Float64Array} spine_knots
|
|
2265
|
-
* @param {Float64Array} spine_control_points
|
|
2266
|
-
* @param {Float64Array} spine_weights
|
|
2449
|
+
* @param {Float64Array | number[]} spine_knots
|
|
2450
|
+
* @param {Float64Array | number[]} spine_control_points
|
|
2451
|
+
* @param {Float64Array | number[]} spine_weights
|
|
2267
2452
|
* @param {number} aux_degree
|
|
2268
|
-
* @param {Float64Array} aux_knots
|
|
2269
|
-
* @param {Float64Array} aux_control_points
|
|
2270
|
-
* @param {Float64Array} aux_weights
|
|
2453
|
+
* @param {Float64Array | number[]} aux_knots
|
|
2454
|
+
* @param {Float64Array | number[]} aux_control_points
|
|
2455
|
+
* @param {Float64Array | number[]} aux_weights
|
|
2271
2456
|
* @returns {number}
|
|
2272
2457
|
*/
|
|
2273
2458
|
guidedSweep(face, spine_degree, spine_knots, spine_control_points, spine_weights, aux_degree, aux_knots, aux_control_points, aux_weights) {
|
|
2274
|
-
const
|
|
2275
|
-
const
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2459
|
+
const val7 = +face;
|
|
2460
|
+
const val8 = +spine_degree;
|
|
2461
|
+
const val9 = +aux_degree;
|
|
2462
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5;
|
|
2463
|
+
try {
|
|
2464
|
+
ptr0 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
|
|
2465
|
+
len0 = WASM_VECTOR_LEN;
|
|
2466
|
+
ptr1 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
|
|
2467
|
+
len1 = WASM_VECTOR_LEN;
|
|
2468
|
+
ptr2 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
|
|
2469
|
+
len2 = WASM_VECTOR_LEN;
|
|
2470
|
+
ptr3 = passArrayF64ToWasm0(aux_knots, wasm.__wbindgen_malloc);
|
|
2471
|
+
len3 = WASM_VECTOR_LEN;
|
|
2472
|
+
ptr4 = passArrayF64ToWasm0(aux_control_points, wasm.__wbindgen_malloc);
|
|
2473
|
+
len4 = WASM_VECTOR_LEN;
|
|
2474
|
+
ptr5 = passArrayF64ToWasm0(aux_weights, wasm.__wbindgen_malloc);
|
|
2475
|
+
len5 = WASM_VECTOR_LEN;
|
|
2476
|
+
} catch (e) {
|
|
2477
|
+
if (ptr5) { wasm.__wbindgen_free(ptr5, len5 * 8, 8); }
|
|
2478
|
+
if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 8, 8); }
|
|
2479
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 8, 8); }
|
|
2480
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
2481
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
2482
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
2483
|
+
throw e;
|
|
2484
|
+
}
|
|
2485
|
+
const ret = wasm.brepkernel_guidedSweep(this.__wbg_ptr, val7, val8, ptr0, len0, ptr1, len1, ptr2, len2, val9, ptr3, len3, ptr4, len4, ptr5, len5);
|
|
2287
2486
|
if (ret[2]) {
|
|
2288
2487
|
throw takeFromExternrefTable0(ret[1]);
|
|
2289
2488
|
}
|
|
@@ -2339,7 +2538,7 @@ export class BrepKernel {
|
|
|
2339
2538
|
* # Errors
|
|
2340
2539
|
*
|
|
2341
2540
|
* Returns an error if the 3MF data is malformed.
|
|
2342
|
-
* @param {Uint8Array} data
|
|
2541
|
+
* @param {Uint8Array | number[]} data
|
|
2343
2542
|
* @returns {Uint32Array}
|
|
2344
2543
|
*/
|
|
2345
2544
|
import3mf(data) {
|
|
@@ -2359,7 +2558,7 @@ export class BrepKernel {
|
|
|
2359
2558
|
* # Errors
|
|
2360
2559
|
*
|
|
2361
2560
|
* Returns an error if the file is malformed or mesh import fails.
|
|
2362
|
-
* @param {Uint8Array} data
|
|
2561
|
+
* @param {Uint8Array | number[]} data
|
|
2363
2562
|
* @returns {number}
|
|
2364
2563
|
*/
|
|
2365
2564
|
importGlb(data) {
|
|
@@ -2377,7 +2576,7 @@ export class BrepKernel {
|
|
|
2377
2576
|
* # Errors
|
|
2378
2577
|
*
|
|
2379
2578
|
* Returns an error if the IGES data is malformed.
|
|
2380
|
-
* @param {Uint8Array} data
|
|
2579
|
+
* @param {Uint8Array | number[]} data
|
|
2381
2580
|
* @returns {Uint32Array}
|
|
2382
2581
|
*/
|
|
2383
2582
|
importIges(data) {
|
|
@@ -2401,15 +2600,22 @@ export class BrepKernel {
|
|
|
2401
2600
|
* # Errors
|
|
2402
2601
|
*
|
|
2403
2602
|
* Returns an error if the arrays are malformed or mesh import fails.
|
|
2404
|
-
* @param {Float64Array} positions
|
|
2405
|
-
* @param {Uint32Array} indices
|
|
2603
|
+
* @param {Float64Array | number[]} positions
|
|
2604
|
+
* @param {Uint32Array | number[]} indices
|
|
2406
2605
|
* @returns {number}
|
|
2407
2606
|
*/
|
|
2408
2607
|
importIndexedMesh(positions, indices) {
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2608
|
+
let ptr0, len0, ptr1, len1;
|
|
2609
|
+
try {
|
|
2610
|
+
ptr0 = passArrayF64ToWasm0(positions, wasm.__wbindgen_malloc);
|
|
2611
|
+
len0 = WASM_VECTOR_LEN;
|
|
2612
|
+
ptr1 = passArray32ToWasm0(indices, wasm.__wbindgen_malloc);
|
|
2613
|
+
len1 = WASM_VECTOR_LEN;
|
|
2614
|
+
} catch (e) {
|
|
2615
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
2616
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
2617
|
+
throw e;
|
|
2618
|
+
}
|
|
2413
2619
|
const ret = wasm.brepkernel_importIndexedMesh(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2414
2620
|
if (ret[2]) {
|
|
2415
2621
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -2422,7 +2628,7 @@ export class BrepKernel {
|
|
|
2422
2628
|
* # Errors
|
|
2423
2629
|
*
|
|
2424
2630
|
* Returns an error if the file is malformed or mesh import fails.
|
|
2425
|
-
* @param {Uint8Array} data
|
|
2631
|
+
* @param {Uint8Array | number[]} data
|
|
2426
2632
|
* @returns {number}
|
|
2427
2633
|
*/
|
|
2428
2634
|
importObj(data) {
|
|
@@ -2442,7 +2648,7 @@ export class BrepKernel {
|
|
|
2442
2648
|
* # Errors
|
|
2443
2649
|
*
|
|
2444
2650
|
* Returns an error if the STEP data is malformed.
|
|
2445
|
-
* @param {Uint8Array} data
|
|
2651
|
+
* @param {Uint8Array | number[]} data
|
|
2446
2652
|
* @returns {Uint32Array}
|
|
2447
2653
|
*/
|
|
2448
2654
|
importStep(data) {
|
|
@@ -2465,7 +2671,7 @@ export class BrepKernel {
|
|
|
2465
2671
|
* # Errors
|
|
2466
2672
|
*
|
|
2467
2673
|
* Returns an error if the STL data is malformed or empty.
|
|
2468
|
-
* @param {Uint8Array} data
|
|
2674
|
+
* @param {Uint8Array | number[]} data
|
|
2469
2675
|
* @returns {number}
|
|
2470
2676
|
*/
|
|
2471
2677
|
importStl(data) {
|
|
@@ -2489,16 +2695,24 @@ export class BrepKernel {
|
|
|
2489
2695
|
* along its marks, or the result would not be a valid solid of the same
|
|
2490
2696
|
* volume.
|
|
2491
2697
|
* @param {number} solid
|
|
2492
|
-
* @param {Uint32Array} face_handles
|
|
2493
|
-
* @param {Uint32Array} edge_handles
|
|
2698
|
+
* @param {Uint32Array | number[]} face_handles
|
|
2699
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
2494
2700
|
* @returns {number}
|
|
2495
2701
|
*/
|
|
2496
2702
|
imprintFaces(solid, face_handles, edge_handles) {
|
|
2497
|
-
const
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2703
|
+
const val3 = +solid;
|
|
2704
|
+
let ptr0, len0, ptr1, len1;
|
|
2705
|
+
try {
|
|
2706
|
+
ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
2707
|
+
len0 = WASM_VECTOR_LEN;
|
|
2708
|
+
ptr1 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
2709
|
+
len1 = WASM_VECTOR_LEN;
|
|
2710
|
+
} catch (e) {
|
|
2711
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
2712
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
2713
|
+
throw e;
|
|
2714
|
+
}
|
|
2715
|
+
const ret = wasm.brepkernel_imprintFaces(this.__wbg_ptr, val3, ptr0, len0, ptr1, len1);
|
|
2502
2716
|
if (ret[2]) {
|
|
2503
2717
|
throw takeFromExternrefTable0(ret[1]);
|
|
2504
2718
|
}
|
|
@@ -2509,14 +2723,15 @@ export class BrepKernel {
|
|
|
2509
2723
|
*
|
|
2510
2724
|
* Uses chord-length parameterization with the given degree.
|
|
2511
2725
|
* Returns an edge handle (`u32`).
|
|
2512
|
-
* @param {Float64Array} coords
|
|
2726
|
+
* @param {Float64Array | number[]} coords
|
|
2513
2727
|
* @param {number} degree
|
|
2514
2728
|
* @returns {number}
|
|
2515
2729
|
*/
|
|
2516
2730
|
interpolatePoints(coords, degree) {
|
|
2731
|
+
const val2 = +degree;
|
|
2517
2732
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2518
2733
|
const len0 = WASM_VECTOR_LEN;
|
|
2519
|
-
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0,
|
|
2734
|
+
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0, val2);
|
|
2520
2735
|
if (ret[2]) {
|
|
2521
2736
|
throw takeFromExternrefTable0(ret[1]);
|
|
2522
2737
|
}
|
|
@@ -2527,7 +2742,7 @@ export class BrepKernel {
|
|
|
2527
2742
|
*
|
|
2528
2743
|
* `coords` is a flat array `[x,y,z, ...]` of `rows * cols` points.
|
|
2529
2744
|
* Returns a face handle.
|
|
2530
|
-
* @param {Float64Array} coords
|
|
2745
|
+
* @param {Float64Array | number[]} coords
|
|
2531
2746
|
* @param {number} rows
|
|
2532
2747
|
* @param {number} cols
|
|
2533
2748
|
* @param {number} degree_u
|
|
@@ -2535,9 +2750,13 @@ export class BrepKernel {
|
|
|
2535
2750
|
* @returns {number}
|
|
2536
2751
|
*/
|
|
2537
2752
|
interpolateSurface(coords, rows, cols, degree_u, degree_v) {
|
|
2753
|
+
const val2 = +rows;
|
|
2754
|
+
const val3 = +cols;
|
|
2755
|
+
const val4 = +degree_u;
|
|
2756
|
+
const val5 = +degree_v;
|
|
2538
2757
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2539
2758
|
const len0 = WASM_VECTOR_LEN;
|
|
2540
|
-
const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0,
|
|
2759
|
+
const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5);
|
|
2541
2760
|
if (ret[2]) {
|
|
2542
2761
|
throw takeFromExternrefTable0(ret[1]);
|
|
2543
2762
|
}
|
|
@@ -2551,15 +2770,22 @@ export class BrepKernel {
|
|
|
2551
2770
|
* or an empty array if they don't intersect.
|
|
2552
2771
|
*
|
|
2553
2772
|
* Uses the Sutherland-Hodgman algorithm (convex clipper).
|
|
2554
|
-
* @param {Float64Array} coords_a
|
|
2555
|
-
* @param {Float64Array} coords_b
|
|
2773
|
+
* @param {Float64Array | number[]} coords_a
|
|
2774
|
+
* @param {Float64Array | number[]} coords_b
|
|
2556
2775
|
* @returns {Float64Array}
|
|
2557
2776
|
*/
|
|
2558
2777
|
intersectPolygons2d(coords_a, coords_b) {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2778
|
+
let ptr0, len0, ptr1, len1;
|
|
2779
|
+
try {
|
|
2780
|
+
ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
|
|
2781
|
+
len0 = WASM_VECTOR_LEN;
|
|
2782
|
+
ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
|
|
2783
|
+
len1 = WASM_VECTOR_LEN;
|
|
2784
|
+
} catch (e) {
|
|
2785
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
2786
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
2787
|
+
throw e;
|
|
2788
|
+
}
|
|
2563
2789
|
const ret = wasm.brepkernel_intersectPolygons2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2564
2790
|
if (ret[3]) {
|
|
2565
2791
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -2664,7 +2890,7 @@ export class BrepKernel {
|
|
|
2664
2890
|
*
|
|
2665
2891
|
* Returns an edge handle (`u32`).
|
|
2666
2892
|
* @param {number} curve_type
|
|
2667
|
-
* @param {Float64Array} curve_params
|
|
2893
|
+
* @param {Float64Array | number[]} curve_params
|
|
2668
2894
|
* @param {number} origin_x
|
|
2669
2895
|
* @param {number} origin_y
|
|
2670
2896
|
* @param {number} origin_z
|
|
@@ -2679,9 +2905,21 @@ export class BrepKernel {
|
|
|
2679
2905
|
* @returns {number}
|
|
2680
2906
|
*/
|
|
2681
2907
|
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) {
|
|
2908
|
+
const val2 = +curve_type;
|
|
2909
|
+
const val3 = +origin_x;
|
|
2910
|
+
const val4 = +origin_y;
|
|
2911
|
+
const val5 = +origin_z;
|
|
2912
|
+
const val6 = +x_axis_x;
|
|
2913
|
+
const val7 = +x_axis_y;
|
|
2914
|
+
const val8 = +x_axis_z;
|
|
2915
|
+
const val9 = +normal_x;
|
|
2916
|
+
const val10 = +normal_y;
|
|
2917
|
+
const val11 = +normal_z;
|
|
2918
|
+
const val12 = +t_start;
|
|
2919
|
+
const val13 = +t_end;
|
|
2682
2920
|
const ptr0 = passArrayF64ToWasm0(curve_params, wasm.__wbindgen_malloc);
|
|
2683
2921
|
const len0 = WASM_VECTOR_LEN;
|
|
2684
|
-
const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr,
|
|
2922
|
+
const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr, val2, ptr0, len0, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12, val13);
|
|
2685
2923
|
if (ret[2]) {
|
|
2686
2924
|
throw takeFromExternrefTable0(ret[1]);
|
|
2687
2925
|
}
|
|
@@ -2723,7 +2961,7 @@ export class BrepKernel {
|
|
|
2723
2961
|
*
|
|
2724
2962
|
* Returns an error if fewer than 2 profiles are given, profiles have
|
|
2725
2963
|
* different vertex counts, or surface fitting fails.
|
|
2726
|
-
* @param {Uint32Array} faces
|
|
2964
|
+
* @param {Uint32Array | number[]} faces
|
|
2727
2965
|
* @returns {number}
|
|
2728
2966
|
*/
|
|
2729
2967
|
loftSmooth(faces) {
|
|
@@ -2745,7 +2983,7 @@ export class BrepKernel {
|
|
|
2745
2983
|
* Returns an error if a handle is invalid, fewer than two wires are given,
|
|
2746
2984
|
* their edge counts differ, a wire is closed, meets itself or breaks, two
|
|
2747
2985
|
* wires touch where they would be joined, or two lines cross or fold over.
|
|
2748
|
-
* @param {Uint32Array} wires
|
|
2986
|
+
* @param {Uint32Array | number[]} wires
|
|
2749
2987
|
* @returns {number}
|
|
2750
2988
|
*/
|
|
2751
2989
|
loftWires(wires) {
|
|
@@ -2767,15 +3005,22 @@ export class BrepKernel {
|
|
|
2767
3005
|
* - `solid: bool` — true (default) returns a solid handle; false returns
|
|
2768
3006
|
* a shell handle holding the loft's faces without the caps on its end
|
|
2769
3007
|
* profiles
|
|
2770
|
-
* @param {Uint32Array} faces
|
|
3008
|
+
* @param {Uint32Array | number[]} faces
|
|
2771
3009
|
* @param {string} options
|
|
2772
3010
|
* @returns {number}
|
|
2773
3011
|
*/
|
|
2774
3012
|
loftWithOptions(faces, options) {
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
3013
|
+
let ptr0, len0, ptr1, len1;
|
|
3014
|
+
try {
|
|
3015
|
+
ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
|
|
3016
|
+
len0 = WASM_VECTOR_LEN;
|
|
3017
|
+
ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3018
|
+
len1 = WASM_VECTOR_LEN;
|
|
3019
|
+
} catch (e) {
|
|
3020
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3021
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
3022
|
+
throw e;
|
|
3023
|
+
}
|
|
2779
3024
|
const ret = wasm.brepkernel_loftWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2780
3025
|
if (ret[2]) {
|
|
2781
3026
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -2791,7 +3036,7 @@ export class BrepKernel {
|
|
|
2791
3036
|
*
|
|
2792
3037
|
* Returns an error if fewer than 2 faces or profiles have
|
|
2793
3038
|
* different vertex counts.
|
|
2794
|
-
* @param {Uint32Array} faces
|
|
3039
|
+
* @param {Uint32Array | number[]} faces
|
|
2795
3040
|
* @returns {number}
|
|
2796
3041
|
*/
|
|
2797
3042
|
loft(faces) {
|
|
@@ -2961,7 +3206,7 @@ export class BrepKernel {
|
|
|
2961
3206
|
* Create a compound from multiple solid handles.
|
|
2962
3207
|
*
|
|
2963
3208
|
* Returns a compound handle (stored as `u32`).
|
|
2964
|
-
* @param {Uint32Array} solid_handles
|
|
3209
|
+
* @param {Uint32Array | number[]} solid_handles
|
|
2965
3210
|
* @returns {number}
|
|
2966
3211
|
*/
|
|
2967
3212
|
makeCompound(solid_handles) {
|
|
@@ -3197,19 +3442,34 @@ export class BrepKernel {
|
|
|
3197
3442
|
* @param {number} end_y
|
|
3198
3443
|
* @param {number} end_z
|
|
3199
3444
|
* @param {number} degree
|
|
3200
|
-
* @param {Float64Array} knots
|
|
3201
|
-
* @param {Float64Array} control_points
|
|
3202
|
-
* @param {Float64Array} weights
|
|
3445
|
+
* @param {Float64Array | number[]} knots
|
|
3446
|
+
* @param {Float64Array | number[]} control_points
|
|
3447
|
+
* @param {Float64Array | number[]} weights
|
|
3203
3448
|
* @returns {number}
|
|
3204
3449
|
*/
|
|
3205
3450
|
makeNurbsEdge(start_x, start_y, start_z, end_x, end_y, end_z, degree, knots, control_points, weights) {
|
|
3206
|
-
const
|
|
3207
|
-
const
|
|
3208
|
-
const
|
|
3209
|
-
const
|
|
3210
|
-
const
|
|
3211
|
-
const
|
|
3212
|
-
const
|
|
3451
|
+
const val4 = +start_x;
|
|
3452
|
+
const val5 = +start_y;
|
|
3453
|
+
const val6 = +start_z;
|
|
3454
|
+
const val7 = +end_x;
|
|
3455
|
+
const val8 = +end_y;
|
|
3456
|
+
const val9 = +end_z;
|
|
3457
|
+
const val10 = +degree;
|
|
3458
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3459
|
+
try {
|
|
3460
|
+
ptr0 = passArrayF64ToWasm0(knots, wasm.__wbindgen_malloc);
|
|
3461
|
+
len0 = WASM_VECTOR_LEN;
|
|
3462
|
+
ptr1 = passArrayF64ToWasm0(control_points, wasm.__wbindgen_malloc);
|
|
3463
|
+
len1 = WASM_VECTOR_LEN;
|
|
3464
|
+
ptr2 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
|
|
3465
|
+
len2 = WASM_VECTOR_LEN;
|
|
3466
|
+
} catch (e) {
|
|
3467
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3468
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
3469
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
3470
|
+
throw e;
|
|
3471
|
+
}
|
|
3472
|
+
const ret = wasm.brepkernel_makeNurbsEdge(this.__wbg_ptr, val4, val5, val6, val7, val8, val9, val10, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3213
3473
|
if (ret[2]) {
|
|
3214
3474
|
throw takeFromExternrefTable0(ret[1]);
|
|
3215
3475
|
}
|
|
@@ -3237,7 +3497,7 @@ export class BrepKernel {
|
|
|
3237
3497
|
* Create a closed polygon wire from flat coordinates.
|
|
3238
3498
|
*
|
|
3239
3499
|
* Returns a wire handle.
|
|
3240
|
-
* @param {Float64Array} coords
|
|
3500
|
+
* @param {Float64Array | number[]} coords
|
|
3241
3501
|
* @returns {number}
|
|
3242
3502
|
*/
|
|
3243
3503
|
makePolygonWire(coords) {
|
|
@@ -3259,7 +3519,7 @@ export class BrepKernel {
|
|
|
3259
3519
|
*
|
|
3260
3520
|
* Returns an error if `coords` length is not a multiple of 3,
|
|
3261
3521
|
* fewer than 3 points are provided, or the face normal is degenerate.
|
|
3262
|
-
* @param {Float64Array} coords
|
|
3522
|
+
* @param {Float64Array | number[]} coords
|
|
3263
3523
|
* @returns {number}
|
|
3264
3524
|
*/
|
|
3265
3525
|
makePolygon(coords) {
|
|
@@ -3311,7 +3571,7 @@ export class BrepKernel {
|
|
|
3311
3571
|
*
|
|
3312
3572
|
* Alias for `sewFaces` with a default tolerance. This is the equivalent
|
|
3313
3573
|
* of sewing faces into a closed shell and building a solid.
|
|
3314
|
-
* @param {Uint32Array} face_handles
|
|
3574
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3315
3575
|
* @returns {number}
|
|
3316
3576
|
*/
|
|
3317
3577
|
makeSolid(face_handles) {
|
|
@@ -3408,14 +3668,46 @@ export class BrepKernel {
|
|
|
3408
3668
|
* Create a closed wire from an ordered array of edge handles.
|
|
3409
3669
|
*
|
|
3410
3670
|
* Returns a wire handle (`u32`).
|
|
3411
|
-
* @param {Uint32Array} edge_handles
|
|
3671
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
3412
3672
|
* @param {boolean} closed
|
|
3413
3673
|
* @returns {number}
|
|
3414
3674
|
*/
|
|
3415
3675
|
makeWire(edge_handles, closed) {
|
|
3676
|
+
const val2 = +closed;
|
|
3416
3677
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
3417
3678
|
const len0 = WASM_VECTOR_LEN;
|
|
3418
|
-
const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0,
|
|
3679
|
+
const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0, val2);
|
|
3680
|
+
if (ret[2]) {
|
|
3681
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3682
|
+
}
|
|
3683
|
+
return ret[0] >>> 0;
|
|
3684
|
+
}
|
|
3685
|
+
/**
|
|
3686
|
+
* Move one surface's edge on to another's at G0, G1 or G2, keeping the
|
|
3687
|
+
* rest of the surface as close as the move allows.
|
|
3688
|
+
*
|
|
3689
|
+
* `options` is JSON: `{ "continuity": "g0" | "g1" | "g2", "targetFace"?: face }`.
|
|
3690
|
+
* `targetFace` names the face a solid's edge is matched to, since it
|
|
3691
|
+
* bounds two. Returns a new face handle.
|
|
3692
|
+
*
|
|
3693
|
+
* # Errors
|
|
3694
|
+
*
|
|
3695
|
+
* Returns an error if a handle or the options are invalid, `edge` is not on
|
|
3696
|
+
* the face's outer boundary, or the target bounds no face or several when
|
|
3697
|
+
* a surface is needed and none is named.
|
|
3698
|
+
* @param {number} face
|
|
3699
|
+
* @param {number} edge
|
|
3700
|
+
* @param {number} target_edge
|
|
3701
|
+
* @param {string} options
|
|
3702
|
+
* @returns {number}
|
|
3703
|
+
*/
|
|
3704
|
+
matchSurface(face, edge, target_edge, options) {
|
|
3705
|
+
const val2 = +face;
|
|
3706
|
+
const val3 = +edge;
|
|
3707
|
+
const val4 = +target_edge;
|
|
3708
|
+
const ptr0 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3709
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3710
|
+
const ret = wasm.brepkernel_matchSurface(this.__wbg_ptr, val2, val3, val4, ptr0, len0);
|
|
3419
3711
|
if (ret[2]) {
|
|
3420
3712
|
throw takeFromExternrefTable0(ret[1]);
|
|
3421
3713
|
}
|
|
@@ -3477,26 +3769,37 @@ export class BrepKernel {
|
|
|
3477
3769
|
* Perform a mesh boolean on raw triangle data.
|
|
3478
3770
|
*
|
|
3479
3771
|
* Returns a `JsMesh` with the result.
|
|
3480
|
-
* @param {Float64Array} positions_a
|
|
3481
|
-
* @param {Uint32Array} indices_a
|
|
3482
|
-
* @param {Float64Array} positions_b
|
|
3483
|
-
* @param {Uint32Array} indices_b
|
|
3772
|
+
* @param {Float64Array | number[]} positions_a
|
|
3773
|
+
* @param {Uint32Array | number[]} indices_a
|
|
3774
|
+
* @param {Float64Array | number[]} positions_b
|
|
3775
|
+
* @param {Uint32Array | number[]} indices_b
|
|
3484
3776
|
* @param {string} op
|
|
3485
3777
|
* @param {number} tolerance
|
|
3486
3778
|
* @returns {JsMesh}
|
|
3487
3779
|
*/
|
|
3488
3780
|
meshBoolean(positions_a, indices_a, positions_b, indices_b, op, tolerance) {
|
|
3489
|
-
const
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3781
|
+
const val6 = +tolerance;
|
|
3782
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
|
|
3783
|
+
try {
|
|
3784
|
+
ptr0 = passArrayF64ToWasm0(positions_a, wasm.__wbindgen_malloc);
|
|
3785
|
+
len0 = WASM_VECTOR_LEN;
|
|
3786
|
+
ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_malloc);
|
|
3787
|
+
len1 = WASM_VECTOR_LEN;
|
|
3788
|
+
ptr2 = passArrayF64ToWasm0(positions_b, wasm.__wbindgen_malloc);
|
|
3789
|
+
len2 = WASM_VECTOR_LEN;
|
|
3790
|
+
ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_malloc);
|
|
3791
|
+
len3 = WASM_VECTOR_LEN;
|
|
3792
|
+
ptr4 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3793
|
+
len4 = WASM_VECTOR_LEN;
|
|
3794
|
+
} catch (e) {
|
|
3795
|
+
if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 1, 1); }
|
|
3796
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 4, 4); }
|
|
3797
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3798
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
3799
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
3800
|
+
throw e;
|
|
3801
|
+
}
|
|
3802
|
+
const ret = wasm.brepkernel_meshBoolean(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, val6);
|
|
3500
3803
|
if (ret[2]) {
|
|
3501
3804
|
throw takeFromExternrefTable0(ret[1]);
|
|
3502
3805
|
}
|
|
@@ -3617,27 +3920,39 @@ export class BrepKernel {
|
|
|
3617
3920
|
*
|
|
3618
3921
|
* Returns an error for fewer than two sections, mismatched array lengths, a
|
|
3619
3922
|
* non-finite or out-of-range value, a non-planar profile, or loft failure.
|
|
3620
|
-
* @param {Uint32Array} face_handles
|
|
3621
|
-
* @param {Float64Array} params
|
|
3923
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3924
|
+
* @param {Float64Array | number[]} params
|
|
3622
3925
|
* @param {number} spine_degree
|
|
3623
|
-
* @param {Float64Array} spine_knots
|
|
3624
|
-
* @param {Float64Array} spine_control_points
|
|
3625
|
-
* @param {Float64Array} spine_weights
|
|
3926
|
+
* @param {Float64Array | number[]} spine_knots
|
|
3927
|
+
* @param {Float64Array | number[]} spine_control_points
|
|
3928
|
+
* @param {Float64Array | number[]} spine_weights
|
|
3626
3929
|
* @param {boolean} ruled
|
|
3627
3930
|
* @returns {number}
|
|
3628
3931
|
*/
|
|
3629
3932
|
multiSectionSweep(face_handles, params, spine_degree, spine_knots, spine_control_points, spine_weights, ruled) {
|
|
3630
|
-
const
|
|
3631
|
-
const
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3933
|
+
const val6 = +spine_degree;
|
|
3934
|
+
const val7 = +ruled;
|
|
3935
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
|
|
3936
|
+
try {
|
|
3937
|
+
ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
3938
|
+
len0 = WASM_VECTOR_LEN;
|
|
3939
|
+
ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
3940
|
+
len1 = WASM_VECTOR_LEN;
|
|
3941
|
+
ptr2 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
|
|
3942
|
+
len2 = WASM_VECTOR_LEN;
|
|
3943
|
+
ptr3 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
|
|
3944
|
+
len3 = WASM_VECTOR_LEN;
|
|
3945
|
+
ptr4 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
|
|
3946
|
+
len4 = WASM_VECTOR_LEN;
|
|
3947
|
+
} catch (e) {
|
|
3948
|
+
if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 8, 8); }
|
|
3949
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 8, 8); }
|
|
3950
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3951
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
3952
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
3953
|
+
throw e;
|
|
3954
|
+
}
|
|
3955
|
+
const ret = wasm.brepkernel_multiSectionSweep(this.__wbg_ptr, ptr0, len0, ptr1, len1, val6, ptr2, len2, ptr3, len3, ptr4, len4, val7);
|
|
3641
3956
|
if (ret[2]) {
|
|
3642
3957
|
throw takeFromExternrefTable0(ret[1]);
|
|
3643
3958
|
}
|
|
@@ -3677,21 +3992,23 @@ export class BrepKernel {
|
|
|
3677
3992
|
*
|
|
3678
3993
|
* `coords` is a flat array `[x,y, x,y, ...]` of 2D points.
|
|
3679
3994
|
* Returns a flat array of offset polygon coordinates.
|
|
3680
|
-
* @param {Float64Array} coords
|
|
3995
|
+
* @param {Float64Array | number[]} coords
|
|
3681
3996
|
* @param {number} distance
|
|
3682
3997
|
* @param {number} tolerance
|
|
3683
3998
|
* @returns {Float64Array}
|
|
3684
3999
|
*/
|
|
3685
4000
|
offsetPolygon2d(coords, distance, tolerance) {
|
|
4001
|
+
const val2 = +distance;
|
|
4002
|
+
const val3 = +tolerance;
|
|
3686
4003
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
3687
4004
|
const len0 = WASM_VECTOR_LEN;
|
|
3688
|
-
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4005
|
+
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3689
4006
|
if (ret[3]) {
|
|
3690
4007
|
throw takeFromExternrefTable0(ret[2]);
|
|
3691
4008
|
}
|
|
3692
|
-
var
|
|
4009
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3693
4010
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3694
|
-
return
|
|
4011
|
+
return v4;
|
|
3695
4012
|
}
|
|
3696
4013
|
/**
|
|
3697
4014
|
* Offset all faces of a solid outward or inward (V2 pipeline).
|
|
@@ -3755,9 +4072,11 @@ export class BrepKernel {
|
|
|
3755
4072
|
* @returns {number}
|
|
3756
4073
|
*/
|
|
3757
4074
|
offsetWire2DWithJoin(wire, distance, join_type) {
|
|
4075
|
+
const val2 = +wire;
|
|
4076
|
+
const val3 = +distance;
|
|
3758
4077
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3759
4078
|
const len0 = WASM_VECTOR_LEN;
|
|
3760
|
-
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr,
|
|
4079
|
+
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3761
4080
|
if (ret[2]) {
|
|
3762
4081
|
throw takeFromExternrefTable0(ret[1]);
|
|
3763
4082
|
}
|
|
@@ -3779,9 +4098,11 @@ export class BrepKernel {
|
|
|
3779
4098
|
* @returns {number}
|
|
3780
4099
|
*/
|
|
3781
4100
|
offsetWireWithJoinType(face, distance, join_type) {
|
|
4101
|
+
const val2 = +face;
|
|
4102
|
+
const val3 = +distance;
|
|
3782
4103
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3783
4104
|
const len0 = WASM_VECTOR_LEN;
|
|
3784
|
-
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr,
|
|
4105
|
+
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3785
4106
|
if (ret[2]) {
|
|
3786
4107
|
throw takeFromExternrefTable0(ret[1]);
|
|
3787
4108
|
}
|
|
@@ -3812,19 +4133,29 @@ export class BrepKernel {
|
|
|
3812
4133
|
* Returns an error if the face or path is invalid.
|
|
3813
4134
|
* @param {number} face
|
|
3814
4135
|
* @param {number} path_degree
|
|
3815
|
-
* @param {Float64Array} path_knots
|
|
3816
|
-
* @param {Float64Array} path_control_points
|
|
3817
|
-
* @param {Float64Array} path_weights
|
|
4136
|
+
* @param {Float64Array | number[]} path_knots
|
|
4137
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4138
|
+
* @param {Float64Array | number[]} path_weights
|
|
3818
4139
|
* @returns {number}
|
|
3819
4140
|
*/
|
|
3820
4141
|
pipe(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
3821
|
-
const
|
|
3822
|
-
const
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
4142
|
+
const val4 = +face;
|
|
4143
|
+
const val5 = +path_degree;
|
|
4144
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4145
|
+
try {
|
|
4146
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4147
|
+
len0 = WASM_VECTOR_LEN;
|
|
4148
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4149
|
+
len1 = WASM_VECTOR_LEN;
|
|
4150
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4151
|
+
len2 = WASM_VECTOR_LEN;
|
|
4152
|
+
} catch (e) {
|
|
4153
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
4154
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4155
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4156
|
+
throw e;
|
|
4157
|
+
}
|
|
4158
|
+
const ret = wasm.brepkernel_pipe(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3828
4159
|
if (ret[2]) {
|
|
3829
4160
|
throw takeFromExternrefTable0(ret[1]);
|
|
3830
4161
|
}
|
|
@@ -3835,15 +4166,17 @@ export class BrepKernel {
|
|
|
3835
4166
|
*
|
|
3836
4167
|
* `polygon_coords` is a flat array `[x,y, x,y, ...]`.
|
|
3837
4168
|
* Returns `true` if the point is inside the polygon (winding number test).
|
|
3838
|
-
* @param {Float64Array} polygon_coords
|
|
4169
|
+
* @param {Float64Array | number[]} polygon_coords
|
|
3839
4170
|
* @param {number} px
|
|
3840
4171
|
* @param {number} py
|
|
3841
4172
|
* @returns {boolean}
|
|
3842
4173
|
*/
|
|
3843
4174
|
pointInPolygon2d(polygon_coords, px, py) {
|
|
4175
|
+
const val2 = +px;
|
|
4176
|
+
const val3 = +py;
|
|
3844
4177
|
const ptr0 = passArrayF64ToWasm0(polygon_coords, wasm.__wbindgen_malloc);
|
|
3845
4178
|
const len0 = WASM_VECTOR_LEN;
|
|
3846
|
-
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4179
|
+
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3847
4180
|
if (ret[2]) {
|
|
3848
4181
|
throw takeFromExternrefTable0(ret[1]);
|
|
3849
4182
|
}
|
|
@@ -3924,15 +4257,22 @@ export class BrepKernel {
|
|
|
3924
4257
|
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
3925
4258
|
* Returns `true` if any vertex of one polygon is inside the other
|
|
3926
4259
|
* or if any edges cross.
|
|
3927
|
-
* @param {Float64Array} coords_a
|
|
3928
|
-
* @param {Float64Array} coords_b
|
|
4260
|
+
* @param {Float64Array | number[]} coords_a
|
|
4261
|
+
* @param {Float64Array | number[]} coords_b
|
|
3929
4262
|
* @returns {boolean}
|
|
3930
4263
|
*/
|
|
3931
4264
|
polygonsIntersect2d(coords_a, coords_b) {
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
4265
|
+
let ptr0, len0, ptr1, len1;
|
|
4266
|
+
try {
|
|
4267
|
+
ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
|
|
4268
|
+
len0 = WASM_VECTOR_LEN;
|
|
4269
|
+
ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
|
|
4270
|
+
len1 = WASM_VECTOR_LEN;
|
|
4271
|
+
} catch (e) {
|
|
4272
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4273
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4274
|
+
throw e;
|
|
4275
|
+
}
|
|
3936
4276
|
const ret = wasm.brepkernel_polygonsIntersect2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
3937
4277
|
if (ret[2]) {
|
|
3938
4278
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -4000,7 +4340,7 @@ export class BrepKernel {
|
|
|
4000
4340
|
*
|
|
4001
4341
|
* Returns an error for an empty list, an invalid handle, a non-positive
|
|
4002
4342
|
* `deflection`, or a degenerate `dir`/`x_axis`.
|
|
4003
|
-
* @param {Uint32Array} solids
|
|
4343
|
+
* @param {Uint32Array | number[]} solids
|
|
4004
4344
|
* @param {number} origin_x
|
|
4005
4345
|
* @param {number} origin_y
|
|
4006
4346
|
* @param {number} origin_z
|
|
@@ -4015,9 +4355,20 @@ export class BrepKernel {
|
|
|
4015
4355
|
* @returns {any}
|
|
4016
4356
|
*/
|
|
4017
4357
|
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) {
|
|
4358
|
+
const val2 = +origin_x;
|
|
4359
|
+
const val3 = +origin_y;
|
|
4360
|
+
const val4 = +origin_z;
|
|
4361
|
+
const val5 = +dir_x;
|
|
4362
|
+
const val6 = +dir_y;
|
|
4363
|
+
const val7 = +dir_z;
|
|
4364
|
+
const val8 = +x_axis_x;
|
|
4365
|
+
const val9 = +x_axis_y;
|
|
4366
|
+
const val10 = +x_axis_z;
|
|
4367
|
+
const val11 = +hidden_lines;
|
|
4368
|
+
const val12 = +deflection;
|
|
4018
4369
|
const ptr0 = passArray32ToWasm0(solids, wasm.__wbindgen_malloc);
|
|
4019
4370
|
const len0 = WASM_VECTOR_LEN;
|
|
4020
|
-
const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0,
|
|
4371
|
+
const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12);
|
|
4021
4372
|
if (ret[2]) {
|
|
4022
4373
|
throw takeFromExternrefTable0(ret[1]);
|
|
4023
4374
|
}
|
|
@@ -4254,14 +4605,15 @@ export class BrepKernel {
|
|
|
4254
4605
|
* # Errors
|
|
4255
4606
|
*
|
|
4256
4607
|
* Returns an error if fewer than 2 faces or sewing fails.
|
|
4257
|
-
* @param {Uint32Array} face_handles
|
|
4608
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4258
4609
|
* @param {number} tolerance
|
|
4259
4610
|
* @returns {number}
|
|
4260
4611
|
*/
|
|
4261
4612
|
sewFaces(face_handles, tolerance) {
|
|
4613
|
+
const val2 = +tolerance;
|
|
4262
4614
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4263
4615
|
const len0 = WASM_VECTOR_LEN;
|
|
4264
|
-
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0,
|
|
4616
|
+
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
4265
4617
|
if (ret[2]) {
|
|
4266
4618
|
throw takeFromExternrefTable0(ret[1]);
|
|
4267
4619
|
}
|
|
@@ -4295,13 +4647,15 @@ export class BrepKernel {
|
|
|
4295
4647
|
* Returns an error if thickness is non-positive or the solid is invalid.
|
|
4296
4648
|
* @param {number} solid
|
|
4297
4649
|
* @param {number} thickness
|
|
4298
|
-
* @param {Uint32Array} open_faces
|
|
4650
|
+
* @param {Uint32Array | number[]} open_faces
|
|
4299
4651
|
* @returns {number}
|
|
4300
4652
|
*/
|
|
4301
4653
|
shell(solid, thickness, open_faces) {
|
|
4654
|
+
const val2 = +solid;
|
|
4655
|
+
const val3 = +thickness;
|
|
4302
4656
|
const ptr0 = passArray32ToWasm0(open_faces, wasm.__wbindgen_malloc);
|
|
4303
4657
|
const len0 = WASM_VECTOR_LEN;
|
|
4304
|
-
const ret = wasm.brepkernel_shell(this.__wbg_ptr,
|
|
4658
|
+
const ret = wasm.brepkernel_shell(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
4305
4659
|
if (ret[2]) {
|
|
4306
4660
|
throw takeFromExternrefTable0(ret[1]);
|
|
4307
4661
|
}
|
|
@@ -4350,9 +4704,10 @@ export class BrepKernel {
|
|
|
4350
4704
|
* @param {string} json
|
|
4351
4705
|
*/
|
|
4352
4706
|
sketchAddConstraint(sketch, json) {
|
|
4707
|
+
const val2 = +sketch;
|
|
4353
4708
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4354
4709
|
const len0 = WASM_VECTOR_LEN;
|
|
4355
|
-
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr,
|
|
4710
|
+
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr, val2, ptr0, len0);
|
|
4356
4711
|
if (ret[1]) {
|
|
4357
4712
|
throw takeFromExternrefTable0(ret[0]);
|
|
4358
4713
|
}
|
|
@@ -4486,19 +4841,20 @@ export class BrepKernel {
|
|
|
4486
4841
|
* along its marks, or the pieces would not be valid solids summing to the
|
|
4487
4842
|
* solid's volume.
|
|
4488
4843
|
* @param {number} solid
|
|
4489
|
-
* @param {Uint32Array} face_handles
|
|
4844
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4490
4845
|
* @returns {Uint32Array}
|
|
4491
4846
|
*/
|
|
4492
4847
|
splitByFaces(solid, face_handles) {
|
|
4848
|
+
const val2 = +solid;
|
|
4493
4849
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4494
4850
|
const len0 = WASM_VECTOR_LEN;
|
|
4495
|
-
const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr,
|
|
4851
|
+
const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr, val2, ptr0, len0);
|
|
4496
4852
|
if (ret[3]) {
|
|
4497
4853
|
throw takeFromExternrefTable0(ret[2]);
|
|
4498
4854
|
}
|
|
4499
|
-
var
|
|
4855
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
4500
4856
|
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4501
|
-
return
|
|
4857
|
+
return v3;
|
|
4502
4858
|
}
|
|
4503
4859
|
/**
|
|
4504
4860
|
* Split a solid into two halves along a plane.
|
|
@@ -4557,13 +4913,14 @@ export class BrepKernel {
|
|
|
4557
4913
|
*
|
|
4558
4914
|
* Returns an error if fewer than 2 edges or the fit fails.
|
|
4559
4915
|
* @param {number} face
|
|
4560
|
-
* @param {Uint32Array} edge_handles
|
|
4916
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
4561
4917
|
* @returns {number}
|
|
4562
4918
|
*/
|
|
4563
4919
|
sweepAlongEdges(face, edge_handles) {
|
|
4920
|
+
const val2 = +face;
|
|
4564
4921
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
4565
4922
|
const len0 = WASM_VECTOR_LEN;
|
|
4566
|
-
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr,
|
|
4923
|
+
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr, val2, ptr0, len0);
|
|
4567
4924
|
if (ret[2]) {
|
|
4568
4925
|
throw takeFromExternrefTable0(ret[1]);
|
|
4569
4926
|
}
|
|
@@ -4583,19 +4940,29 @@ export class BrepKernel {
|
|
|
4583
4940
|
* Returns an error if the face or path is invalid, or surface fitting fails.
|
|
4584
4941
|
* @param {number} face
|
|
4585
4942
|
* @param {number} path_degree
|
|
4586
|
-
* @param {Float64Array} path_knots
|
|
4587
|
-
* @param {Float64Array} path_control_points
|
|
4588
|
-
* @param {Float64Array} path_weights
|
|
4943
|
+
* @param {Float64Array | number[]} path_knots
|
|
4944
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4945
|
+
* @param {Float64Array | number[]} path_weights
|
|
4589
4946
|
* @returns {number}
|
|
4590
4947
|
*/
|
|
4591
4948
|
sweepSmooth(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4592
|
-
const
|
|
4593
|
-
const
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4949
|
+
const val4 = +face;
|
|
4950
|
+
const val5 = +path_degree;
|
|
4951
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4952
|
+
try {
|
|
4953
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4954
|
+
len0 = WASM_VECTOR_LEN;
|
|
4955
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4956
|
+
len1 = WASM_VECTOR_LEN;
|
|
4957
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4958
|
+
len2 = WASM_VECTOR_LEN;
|
|
4959
|
+
} catch (e) {
|
|
4960
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
4961
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4962
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4963
|
+
throw e;
|
|
4964
|
+
}
|
|
4965
|
+
const ret = wasm.brepkernel_sweepSmooth(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4599
4966
|
if (ret[2]) {
|
|
4600
4967
|
throw takeFromExternrefTable0(ret[1]);
|
|
4601
4968
|
}
|
|
@@ -4614,13 +4981,14 @@ export class BrepKernel {
|
|
|
4614
4981
|
* Returns an error if a handle is invalid, the chain has no edges, breaks,
|
|
4615
4982
|
* closes or has a kink, or the wire is closed.
|
|
4616
4983
|
* @param {number} wire
|
|
4617
|
-
* @param {Uint32Array} path_edges
|
|
4984
|
+
* @param {Uint32Array | number[]} path_edges
|
|
4618
4985
|
* @returns {number}
|
|
4619
4986
|
*/
|
|
4620
4987
|
sweepWire(wire, path_edges) {
|
|
4988
|
+
const val2 = +wire;
|
|
4621
4989
|
const ptr0 = passArray32ToWasm0(path_edges, wasm.__wbindgen_malloc);
|
|
4622
4990
|
const len0 = WASM_VECTOR_LEN;
|
|
4623
|
-
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr,
|
|
4991
|
+
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4624
4992
|
if (ret[2]) {
|
|
4625
4993
|
throw takeFromExternrefTable0(ret[1]);
|
|
4626
4994
|
}
|
|
@@ -4636,19 +5004,30 @@ export class BrepKernel {
|
|
|
4636
5004
|
* @param {number} profile
|
|
4637
5005
|
* @param {number} path_edge
|
|
4638
5006
|
* @param {string} contact_mode
|
|
4639
|
-
* @param {Float64Array} scale_values
|
|
5007
|
+
* @param {Float64Array | number[]} scale_values
|
|
4640
5008
|
* @param {number} segments
|
|
4641
5009
|
* @param {string} corner_mode
|
|
4642
5010
|
* @returns {number}
|
|
4643
5011
|
*/
|
|
4644
5012
|
sweepWithOptions(profile, path_edge, contact_mode, scale_values, segments, corner_mode) {
|
|
4645
|
-
const
|
|
4646
|
-
const
|
|
4647
|
-
const
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
5013
|
+
const val4 = +profile;
|
|
5014
|
+
const val5 = +path_edge;
|
|
5015
|
+
const val6 = +segments;
|
|
5016
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
5017
|
+
try {
|
|
5018
|
+
ptr0 = passStringToWasm0(contact_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5019
|
+
len0 = WASM_VECTOR_LEN;
|
|
5020
|
+
ptr1 = passArrayF64ToWasm0(scale_values, wasm.__wbindgen_malloc);
|
|
5021
|
+
len1 = WASM_VECTOR_LEN;
|
|
5022
|
+
ptr2 = passStringToWasm0(corner_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5023
|
+
len2 = WASM_VECTOR_LEN;
|
|
5024
|
+
} catch (e) {
|
|
5025
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
5026
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
5027
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
5028
|
+
throw e;
|
|
5029
|
+
}
|
|
5030
|
+
const ret = wasm.brepkernel_sweepWithOptions(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, val6, ptr2, len2);
|
|
4652
5031
|
if (ret[2]) {
|
|
4653
5032
|
throw takeFromExternrefTable0(ret[1]);
|
|
4654
5033
|
}
|
|
@@ -4671,19 +5050,29 @@ export class BrepKernel {
|
|
|
4671
5050
|
* inconsistent lengths, or the sweep operation fails.
|
|
4672
5051
|
* @param {number} face
|
|
4673
5052
|
* @param {number} path_degree
|
|
4674
|
-
* @param {Float64Array} path_knots
|
|
4675
|
-
* @param {Float64Array} path_control_points
|
|
4676
|
-
* @param {Float64Array} path_weights
|
|
5053
|
+
* @param {Float64Array | number[]} path_knots
|
|
5054
|
+
* @param {Float64Array | number[]} path_control_points
|
|
5055
|
+
* @param {Float64Array | number[]} path_weights
|
|
4677
5056
|
* @returns {number}
|
|
4678
5057
|
*/
|
|
4679
5058
|
sweep(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4680
|
-
const
|
|
4681
|
-
const
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
5059
|
+
const val4 = +face;
|
|
5060
|
+
const val5 = +path_degree;
|
|
5061
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
5062
|
+
try {
|
|
5063
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
5064
|
+
len0 = WASM_VECTOR_LEN;
|
|
5065
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
5066
|
+
len1 = WASM_VECTOR_LEN;
|
|
5067
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
5068
|
+
len2 = WASM_VECTOR_LEN;
|
|
5069
|
+
} catch (e) {
|
|
5070
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
5071
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
5072
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
5073
|
+
throw e;
|
|
5074
|
+
}
|
|
5075
|
+
const ret = wasm.brepkernel_sweep(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4687
5076
|
if (ret[2]) {
|
|
4688
5077
|
throw takeFromExternrefTable0(ret[1]);
|
|
4689
5078
|
}
|
|
@@ -4884,12 +5273,13 @@ export class BrepKernel {
|
|
|
4884
5273
|
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
4885
5274
|
* have 16 elements, or the matrix is singular.
|
|
4886
5275
|
* @param {number} face
|
|
4887
|
-
* @param {Float64Array} matrix
|
|
5276
|
+
* @param {Float64Array | number[]} matrix
|
|
4888
5277
|
*/
|
|
4889
5278
|
transformFace(face, matrix) {
|
|
5279
|
+
const val2 = +face;
|
|
4890
5280
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4891
5281
|
const len0 = WASM_VECTOR_LEN;
|
|
4892
|
-
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr,
|
|
5282
|
+
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, val2, ptr0, len0);
|
|
4893
5283
|
if (ret[1]) {
|
|
4894
5284
|
throw takeFromExternrefTable0(ret[0]);
|
|
4895
5285
|
}
|
|
@@ -4904,12 +5294,13 @@ export class BrepKernel {
|
|
|
4904
5294
|
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
4905
5295
|
* have 16 elements, or the matrix is singular.
|
|
4906
5296
|
* @param {number} solid
|
|
4907
|
-
* @param {Float64Array} matrix
|
|
5297
|
+
* @param {Float64Array | number[]} matrix
|
|
4908
5298
|
*/
|
|
4909
5299
|
transformSolid(solid, matrix) {
|
|
5300
|
+
const val2 = +solid;
|
|
4910
5301
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4911
5302
|
const len0 = WASM_VECTOR_LEN;
|
|
4912
|
-
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr,
|
|
5303
|
+
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr, val2, ptr0, len0);
|
|
4913
5304
|
if (ret[1]) {
|
|
4914
5305
|
throw takeFromExternrefTable0(ret[0]);
|
|
4915
5306
|
}
|
|
@@ -4924,12 +5315,13 @@ export class BrepKernel {
|
|
|
4924
5315
|
* Returns an error if the wire handle is invalid, the matrix doesn't
|
|
4925
5316
|
* have 16 elements, or the matrix is singular.
|
|
4926
5317
|
* @param {number} wire
|
|
4927
|
-
* @param {Float64Array} matrix
|
|
5318
|
+
* @param {Float64Array | number[]} matrix
|
|
4928
5319
|
*/
|
|
4929
5320
|
transformWire(wire, matrix) {
|
|
5321
|
+
const val2 = +wire;
|
|
4930
5322
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4931
5323
|
const len0 = WASM_VECTOR_LEN;
|
|
4932
|
-
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr,
|
|
5324
|
+
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4933
5325
|
if (ret[1]) {
|
|
4934
5326
|
throw takeFromExternrefTable0(ret[0]);
|
|
4935
5327
|
}
|
|
@@ -5053,14 +5445,15 @@ export class BrepKernel {
|
|
|
5053
5445
|
*
|
|
5054
5446
|
* Accepts an array of face handles from potentially different shells.
|
|
5055
5447
|
* Sews all faces together into a single solid.
|
|
5056
|
-
* @param {Uint32Array} face_handles
|
|
5448
|
+
* @param {Uint32Array | number[]} face_handles
|
|
5057
5449
|
* @param {number} tolerance
|
|
5058
5450
|
* @returns {number}
|
|
5059
5451
|
*/
|
|
5060
5452
|
weldShellsAndFaces(face_handles, tolerance) {
|
|
5453
|
+
const val2 = +tolerance;
|
|
5061
5454
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
5062
5455
|
const len0 = WASM_VECTOR_LEN;
|
|
5063
|
-
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0,
|
|
5456
|
+
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
5064
5457
|
if (ret[2]) {
|
|
5065
5458
|
throw takeFromExternrefTable0(ret[1]);
|
|
5066
5459
|
}
|
|
@@ -5518,30 +5911,30 @@ export function setLogLevel(level) {
|
|
|
5518
5911
|
throw takeFromExternrefTable0(ret[0]);
|
|
5519
5912
|
}
|
|
5520
5913
|
}
|
|
5521
|
-
export function
|
|
5914
|
+
export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
|
|
5522
5915
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5523
5916
|
return ret;
|
|
5524
5917
|
}
|
|
5525
|
-
export function
|
|
5918
|
+
export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
|
|
5526
5919
|
const ret = debugString(arg1);
|
|
5527
5920
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5528
5921
|
const len1 = WASM_VECTOR_LEN;
|
|
5529
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5530
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5922
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
5923
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
5531
5924
|
}
|
|
5532
|
-
export function
|
|
5925
|
+
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
5533
5926
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
5534
5927
|
}
|
|
5535
|
-
export function
|
|
5928
|
+
export function __wbg_error_b693e3f4fbf3e888(arg0, arg1) {
|
|
5536
5929
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
5537
5930
|
}
|
|
5538
|
-
export function
|
|
5931
|
+
export function __wbg_getRandomValues_8b6f1f663e6f188d() { return handleError(function (arg0, arg1) {
|
|
5539
5932
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
5540
5933
|
}, arguments); }
|
|
5541
|
-
export function
|
|
5934
|
+
export function __wbg_log_85d5c5732049ef45(arg0, arg1) {
|
|
5542
5935
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5543
5936
|
}
|
|
5544
|
-
export function
|
|
5937
|
+
export function __wbg_warn_bc26df775fd739d9(arg0, arg1) {
|
|
5545
5938
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
5546
5939
|
}
|
|
5547
5940
|
export function __wbindgen_generic_0000000000000001(arg0, arg1) {
|
|
@@ -5551,12 +5944,11 @@ export function __wbindgen_generic_0000000000000001(arg0, arg1) {
|
|
|
5551
5944
|
}
|
|
5552
5945
|
export function __wbindgen_init_externref_table() {
|
|
5553
5946
|
const table = wasm.__wbindgen_externrefs;
|
|
5554
|
-
const offset = table.grow(4);
|
|
5555
5947
|
table.set(0, undefined);
|
|
5556
|
-
table.set(
|
|
5557
|
-
table.set(
|
|
5558
|
-
table.set(
|
|
5559
|
-
table.set(
|
|
5948
|
+
table.set(1024, undefined);
|
|
5949
|
+
table.set(1025, null);
|
|
5950
|
+
table.set(1026, true);
|
|
5951
|
+
table.set(1027, false);
|
|
5560
5952
|
}
|
|
5561
5953
|
const BrepKernelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5562
5954
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -5584,68 +5976,61 @@ function addToExternrefTable0(obj) {
|
|
|
5584
5976
|
}
|
|
5585
5977
|
|
|
5586
5978
|
function debugString(val) {
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
5639
|
-
} catch (_) {
|
|
5640
|
-
return 'Object';
|
|
5979
|
+
switch (typeof val) {
|
|
5980
|
+
// primitive types
|
|
5981
|
+
case 'number':
|
|
5982
|
+
case 'boolean':
|
|
5983
|
+
case 'undefined':
|
|
5984
|
+
return `${val}`;
|
|
5985
|
+
case 'string':
|
|
5986
|
+
return JSON.stringify(val);
|
|
5987
|
+
case 'bigint':
|
|
5988
|
+
return `${val}n`;
|
|
5989
|
+
case 'symbol':
|
|
5990
|
+
return val.description !== undefined
|
|
5991
|
+
? `Symbol(${val.description})`
|
|
5992
|
+
: 'Symbol';
|
|
5993
|
+
case 'function':
|
|
5994
|
+
return typeof val.name === 'string' && val.name !== ''
|
|
5995
|
+
? `Function(${val.name})`
|
|
5996
|
+
: 'Function';
|
|
5997
|
+
case 'object': {
|
|
5998
|
+
if (val === null) {
|
|
5999
|
+
return 'null';
|
|
6000
|
+
}
|
|
6001
|
+
// objects
|
|
6002
|
+
if (Array.isArray(val)) {
|
|
6003
|
+
return '[' + Array.from(val, debugString).join(', ') + ']';
|
|
6004
|
+
}
|
|
6005
|
+
// errors
|
|
6006
|
+
if (val instanceof Error) {
|
|
6007
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
6008
|
+
}
|
|
6009
|
+
|
|
6010
|
+
const toStringOutput = toString.call(val);
|
|
6011
|
+
// Test for built-in
|
|
6012
|
+
const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
|
|
6013
|
+
|
|
6014
|
+
// Failed to match the standard '[object ClassName]'
|
|
6015
|
+
if (className === undefined) {
|
|
6016
|
+
return toStringOutput;
|
|
6017
|
+
}
|
|
6018
|
+
if (className === 'Object') {
|
|
6019
|
+
// we're a user defined class or Object
|
|
6020
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
6021
|
+
// easier than looping through ownProperties of `val`.
|
|
6022
|
+
try {
|
|
6023
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
6024
|
+
} catch (_) {
|
|
6025
|
+
return 'Object';
|
|
6026
|
+
}
|
|
6027
|
+
}
|
|
6028
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
6029
|
+
return className;
|
|
5641
6030
|
}
|
|
6031
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
6032
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
5642
6033
|
}
|
|
5643
|
-
// errors
|
|
5644
|
-
if (val instanceof Error) {
|
|
5645
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
5646
|
-
}
|
|
5647
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
5648
|
-
return className;
|
|
5649
6034
|
}
|
|
5650
6035
|
|
|
5651
6036
|
function getArrayF32FromWasm0(ptr, len) {
|
|
@@ -5693,7 +6078,8 @@ function getFloat64ArrayMemory0() {
|
|
|
5693
6078
|
}
|
|
5694
6079
|
|
|
5695
6080
|
function getStringFromWasm0(ptr, len) {
|
|
5696
|
-
|
|
6081
|
+
ptr = ptr >>> 0;
|
|
6082
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
5697
6083
|
}
|
|
5698
6084
|
|
|
5699
6085
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -5789,18 +6175,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
5789
6175
|
return value;
|
|
5790
6176
|
}
|
|
5791
6177
|
|
|
5792
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
6178
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
5793
6179
|
cachedTextDecoder.decode();
|
|
5794
6180
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
5795
6181
|
let numBytesDecoded = 0;
|
|
5796
|
-
function decodeText(
|
|
5797
|
-
numBytesDecoded +=
|
|
6182
|
+
function decodeText(bytes) {
|
|
6183
|
+
numBytesDecoded += bytes.length;
|
|
5798
6184
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
5799
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
6185
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
5800
6186
|
cachedTextDecoder.decode();
|
|
5801
|
-
numBytesDecoded =
|
|
6187
|
+
numBytesDecoded = bytes.length;
|
|
5802
6188
|
}
|
|
5803
|
-
return cachedTextDecoder.decode(
|
|
6189
|
+
return cachedTextDecoder.decode(bytes);
|
|
5804
6190
|
}
|
|
5805
6191
|
|
|
5806
6192
|
const cachedTextEncoder = new TextEncoder();
|