brepkit-wasm 4.8.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 +148 -65
- package/brepkit_wasm_bg.js +761 -321
- package/brepkit_wasm_bg.wasm +0 -0
- package/brepkit_wasm_node.cjs +758 -318
- package/package.json +1 -1
package/brepkit_wasm_node.cjs
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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,
|
|
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
|
|
357
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
280
358
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
281
|
-
return
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
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
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
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,
|
|
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
|
|
1573
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1435
1574
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1436
|
-
return
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
2277
|
-
const
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
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
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
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) {
|
|
@@ -2479,19 +2685,55 @@ class BrepKernel {
|
|
|
2479
2685
|
}
|
|
2480
2686
|
return ret[0] >>> 0;
|
|
2481
2687
|
}
|
|
2688
|
+
/**
|
|
2689
|
+
* A copy of a solid with its faces split where the given faces and edges
|
|
2690
|
+
* meet them.
|
|
2691
|
+
*
|
|
2692
|
+
* Returns a solid handle. The copy has the solid's volume.
|
|
2693
|
+
*
|
|
2694
|
+
* # Errors
|
|
2695
|
+
*
|
|
2696
|
+
* Returns an error if a handle does not resolve, a face cannot be split
|
|
2697
|
+
* along its marks, or the result would not be a valid solid of the same
|
|
2698
|
+
* volume.
|
|
2699
|
+
* @param {number} solid
|
|
2700
|
+
* @param {Uint32Array | number[]} face_handles
|
|
2701
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
2702
|
+
* @returns {number}
|
|
2703
|
+
*/
|
|
2704
|
+
imprintFaces(solid, face_handles, edge_handles) {
|
|
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);
|
|
2718
|
+
if (ret[2]) {
|
|
2719
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2720
|
+
}
|
|
2721
|
+
return ret[0] >>> 0;
|
|
2722
|
+
}
|
|
2482
2723
|
/**
|
|
2483
2724
|
* Interpolate a NURBS curve through points and create an edge.
|
|
2484
2725
|
*
|
|
2485
2726
|
* Uses chord-length parameterization with the given degree.
|
|
2486
2727
|
* Returns an edge handle (`u32`).
|
|
2487
|
-
* @param {Float64Array} coords
|
|
2728
|
+
* @param {Float64Array | number[]} coords
|
|
2488
2729
|
* @param {number} degree
|
|
2489
2730
|
* @returns {number}
|
|
2490
2731
|
*/
|
|
2491
2732
|
interpolatePoints(coords, degree) {
|
|
2733
|
+
const val2 = +degree;
|
|
2492
2734
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2493
2735
|
const len0 = WASM_VECTOR_LEN;
|
|
2494
|
-
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0,
|
|
2736
|
+
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0, val2);
|
|
2495
2737
|
if (ret[2]) {
|
|
2496
2738
|
throw takeFromExternrefTable0(ret[1]);
|
|
2497
2739
|
}
|
|
@@ -2502,7 +2744,7 @@ class BrepKernel {
|
|
|
2502
2744
|
*
|
|
2503
2745
|
* `coords` is a flat array `[x,y,z, ...]` of `rows * cols` points.
|
|
2504
2746
|
* Returns a face handle.
|
|
2505
|
-
* @param {Float64Array} coords
|
|
2747
|
+
* @param {Float64Array | number[]} coords
|
|
2506
2748
|
* @param {number} rows
|
|
2507
2749
|
* @param {number} cols
|
|
2508
2750
|
* @param {number} degree_u
|
|
@@ -2510,9 +2752,13 @@ class BrepKernel {
|
|
|
2510
2752
|
* @returns {number}
|
|
2511
2753
|
*/
|
|
2512
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;
|
|
2513
2759
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2514
2760
|
const len0 = WASM_VECTOR_LEN;
|
|
2515
|
-
const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0,
|
|
2761
|
+
const ret = wasm.brepkernel_interpolateSurface(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5);
|
|
2516
2762
|
if (ret[2]) {
|
|
2517
2763
|
throw takeFromExternrefTable0(ret[1]);
|
|
2518
2764
|
}
|
|
@@ -2526,15 +2772,22 @@ class BrepKernel {
|
|
|
2526
2772
|
* or an empty array if they don't intersect.
|
|
2527
2773
|
*
|
|
2528
2774
|
* Uses the Sutherland-Hodgman algorithm (convex clipper).
|
|
2529
|
-
* @param {Float64Array} coords_a
|
|
2530
|
-
* @param {Float64Array} coords_b
|
|
2775
|
+
* @param {Float64Array | number[]} coords_a
|
|
2776
|
+
* @param {Float64Array | number[]} coords_b
|
|
2531
2777
|
* @returns {Float64Array}
|
|
2532
2778
|
*/
|
|
2533
2779
|
intersectPolygons2d(coords_a, coords_b) {
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
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
|
+
}
|
|
2538
2791
|
const ret = wasm.brepkernel_intersectPolygons2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2539
2792
|
if (ret[3]) {
|
|
2540
2793
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -2639,7 +2892,7 @@ class BrepKernel {
|
|
|
2639
2892
|
*
|
|
2640
2893
|
* Returns an edge handle (`u32`).
|
|
2641
2894
|
* @param {number} curve_type
|
|
2642
|
-
* @param {Float64Array} curve_params
|
|
2895
|
+
* @param {Float64Array | number[]} curve_params
|
|
2643
2896
|
* @param {number} origin_x
|
|
2644
2897
|
* @param {number} origin_y
|
|
2645
2898
|
* @param {number} origin_z
|
|
@@ -2654,9 +2907,21 @@ class BrepKernel {
|
|
|
2654
2907
|
* @returns {number}
|
|
2655
2908
|
*/
|
|
2656
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;
|
|
2657
2922
|
const ptr0 = passArrayF64ToWasm0(curve_params, wasm.__wbindgen_malloc);
|
|
2658
2923
|
const len0 = WASM_VECTOR_LEN;
|
|
2659
|
-
const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr,
|
|
2924
|
+
const ret = wasm.brepkernel_liftCurve2dToPlane(this.__wbg_ptr, val2, ptr0, len0, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12, val13);
|
|
2660
2925
|
if (ret[2]) {
|
|
2661
2926
|
throw takeFromExternrefTable0(ret[1]);
|
|
2662
2927
|
}
|
|
@@ -2698,7 +2963,7 @@ class BrepKernel {
|
|
|
2698
2963
|
*
|
|
2699
2964
|
* Returns an error if fewer than 2 profiles are given, profiles have
|
|
2700
2965
|
* different vertex counts, or surface fitting fails.
|
|
2701
|
-
* @param {Uint32Array} faces
|
|
2966
|
+
* @param {Uint32Array | number[]} faces
|
|
2702
2967
|
* @returns {number}
|
|
2703
2968
|
*/
|
|
2704
2969
|
loftSmooth(faces) {
|
|
@@ -2720,7 +2985,7 @@ class BrepKernel {
|
|
|
2720
2985
|
* Returns an error if a handle is invalid, fewer than two wires are given,
|
|
2721
2986
|
* their edge counts differ, a wire is closed, meets itself or breaks, two
|
|
2722
2987
|
* wires touch where they would be joined, or two lines cross or fold over.
|
|
2723
|
-
* @param {Uint32Array} wires
|
|
2988
|
+
* @param {Uint32Array | number[]} wires
|
|
2724
2989
|
* @returns {number}
|
|
2725
2990
|
*/
|
|
2726
2991
|
loftWires(wires) {
|
|
@@ -2742,15 +3007,22 @@ class BrepKernel {
|
|
|
2742
3007
|
* - `solid: bool` — true (default) returns a solid handle; false returns
|
|
2743
3008
|
* a shell handle holding the loft's faces without the caps on its end
|
|
2744
3009
|
* profiles
|
|
2745
|
-
* @param {Uint32Array} faces
|
|
3010
|
+
* @param {Uint32Array | number[]} faces
|
|
2746
3011
|
* @param {string} options
|
|
2747
3012
|
* @returns {number}
|
|
2748
3013
|
*/
|
|
2749
3014
|
loftWithOptions(faces, options) {
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
3015
|
+
let ptr0, len0, ptr1, len1;
|
|
3016
|
+
try {
|
|
3017
|
+
ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
|
|
3018
|
+
len0 = WASM_VECTOR_LEN;
|
|
3019
|
+
ptr1 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3020
|
+
len1 = WASM_VECTOR_LEN;
|
|
3021
|
+
} catch (e) {
|
|
3022
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
3023
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
3024
|
+
throw e;
|
|
3025
|
+
}
|
|
2754
3026
|
const ret = wasm.brepkernel_loftWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2755
3027
|
if (ret[2]) {
|
|
2756
3028
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -2766,7 +3038,7 @@ class BrepKernel {
|
|
|
2766
3038
|
*
|
|
2767
3039
|
* Returns an error if fewer than 2 faces or profiles have
|
|
2768
3040
|
* different vertex counts.
|
|
2769
|
-
* @param {Uint32Array} faces
|
|
3041
|
+
* @param {Uint32Array | number[]} faces
|
|
2770
3042
|
* @returns {number}
|
|
2771
3043
|
*/
|
|
2772
3044
|
loft(faces) {
|
|
@@ -2936,7 +3208,7 @@ class BrepKernel {
|
|
|
2936
3208
|
* Create a compound from multiple solid handles.
|
|
2937
3209
|
*
|
|
2938
3210
|
* Returns a compound handle (stored as `u32`).
|
|
2939
|
-
* @param {Uint32Array} solid_handles
|
|
3211
|
+
* @param {Uint32Array | number[]} solid_handles
|
|
2940
3212
|
* @returns {number}
|
|
2941
3213
|
*/
|
|
2942
3214
|
makeCompound(solid_handles) {
|
|
@@ -3172,19 +3444,34 @@ class BrepKernel {
|
|
|
3172
3444
|
* @param {number} end_y
|
|
3173
3445
|
* @param {number} end_z
|
|
3174
3446
|
* @param {number} degree
|
|
3175
|
-
* @param {Float64Array} knots
|
|
3176
|
-
* @param {Float64Array} control_points
|
|
3177
|
-
* @param {Float64Array} weights
|
|
3447
|
+
* @param {Float64Array | number[]} knots
|
|
3448
|
+
* @param {Float64Array | number[]} control_points
|
|
3449
|
+
* @param {Float64Array | number[]} weights
|
|
3178
3450
|
* @returns {number}
|
|
3179
3451
|
*/
|
|
3180
3452
|
makeNurbsEdge(start_x, start_y, start_z, end_x, end_y, end_z, degree, knots, control_points, weights) {
|
|
3181
|
-
const
|
|
3182
|
-
const
|
|
3183
|
-
const
|
|
3184
|
-
const
|
|
3185
|
-
const
|
|
3186
|
-
const
|
|
3187
|
-
const
|
|
3453
|
+
const val4 = +start_x;
|
|
3454
|
+
const val5 = +start_y;
|
|
3455
|
+
const val6 = +start_z;
|
|
3456
|
+
const val7 = +end_x;
|
|
3457
|
+
const val8 = +end_y;
|
|
3458
|
+
const val9 = +end_z;
|
|
3459
|
+
const val10 = +degree;
|
|
3460
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
3461
|
+
try {
|
|
3462
|
+
ptr0 = passArrayF64ToWasm0(knots, wasm.__wbindgen_malloc);
|
|
3463
|
+
len0 = WASM_VECTOR_LEN;
|
|
3464
|
+
ptr1 = passArrayF64ToWasm0(control_points, wasm.__wbindgen_malloc);
|
|
3465
|
+
len1 = WASM_VECTOR_LEN;
|
|
3466
|
+
ptr2 = passArrayF64ToWasm0(weights, wasm.__wbindgen_malloc);
|
|
3467
|
+
len2 = WASM_VECTOR_LEN;
|
|
3468
|
+
} catch (e) {
|
|
3469
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3470
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
3471
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
3472
|
+
throw e;
|
|
3473
|
+
}
|
|
3474
|
+
const ret = wasm.brepkernel_makeNurbsEdge(this.__wbg_ptr, val4, val5, val6, val7, val8, val9, val10, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3188
3475
|
if (ret[2]) {
|
|
3189
3476
|
throw takeFromExternrefTable0(ret[1]);
|
|
3190
3477
|
}
|
|
@@ -3212,7 +3499,7 @@ class BrepKernel {
|
|
|
3212
3499
|
* Create a closed polygon wire from flat coordinates.
|
|
3213
3500
|
*
|
|
3214
3501
|
* Returns a wire handle.
|
|
3215
|
-
* @param {Float64Array} coords
|
|
3502
|
+
* @param {Float64Array | number[]} coords
|
|
3216
3503
|
* @returns {number}
|
|
3217
3504
|
*/
|
|
3218
3505
|
makePolygonWire(coords) {
|
|
@@ -3234,7 +3521,7 @@ class BrepKernel {
|
|
|
3234
3521
|
*
|
|
3235
3522
|
* Returns an error if `coords` length is not a multiple of 3,
|
|
3236
3523
|
* fewer than 3 points are provided, or the face normal is degenerate.
|
|
3237
|
-
* @param {Float64Array} coords
|
|
3524
|
+
* @param {Float64Array | number[]} coords
|
|
3238
3525
|
* @returns {number}
|
|
3239
3526
|
*/
|
|
3240
3527
|
makePolygon(coords) {
|
|
@@ -3286,7 +3573,7 @@ class BrepKernel {
|
|
|
3286
3573
|
*
|
|
3287
3574
|
* Alias for `sewFaces` with a default tolerance. This is the equivalent
|
|
3288
3575
|
* of sewing faces into a closed shell and building a solid.
|
|
3289
|
-
* @param {Uint32Array} face_handles
|
|
3576
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3290
3577
|
* @returns {number}
|
|
3291
3578
|
*/
|
|
3292
3579
|
makeSolid(face_handles) {
|
|
@@ -3383,14 +3670,46 @@ class BrepKernel {
|
|
|
3383
3670
|
* Create a closed wire from an ordered array of edge handles.
|
|
3384
3671
|
*
|
|
3385
3672
|
* Returns a wire handle (`u32`).
|
|
3386
|
-
* @param {Uint32Array} edge_handles
|
|
3673
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
3387
3674
|
* @param {boolean} closed
|
|
3388
3675
|
* @returns {number}
|
|
3389
3676
|
*/
|
|
3390
3677
|
makeWire(edge_handles, closed) {
|
|
3678
|
+
const val2 = +closed;
|
|
3391
3679
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
3392
3680
|
const len0 = WASM_VECTOR_LEN;
|
|
3393
|
-
const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0,
|
|
3681
|
+
const ret = wasm.brepkernel_makeWire(this.__wbg_ptr, ptr0, len0, val2);
|
|
3682
|
+
if (ret[2]) {
|
|
3683
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3684
|
+
}
|
|
3685
|
+
return ret[0] >>> 0;
|
|
3686
|
+
}
|
|
3687
|
+
/**
|
|
3688
|
+
* Move one surface's edge on to another's at G0, G1 or G2, keeping the
|
|
3689
|
+
* rest of the surface as close as the move allows.
|
|
3690
|
+
*
|
|
3691
|
+
* `options` is JSON: `{ "continuity": "g0" | "g1" | "g2", "targetFace"?: face }`.
|
|
3692
|
+
* `targetFace` names the face a solid's edge is matched to, since it
|
|
3693
|
+
* bounds two. Returns a new face handle.
|
|
3694
|
+
*
|
|
3695
|
+
* # Errors
|
|
3696
|
+
*
|
|
3697
|
+
* Returns an error if a handle or the options are invalid, `edge` is not on
|
|
3698
|
+
* the face's outer boundary, or the target bounds no face or several when
|
|
3699
|
+
* a surface is needed and none is named.
|
|
3700
|
+
* @param {number} face
|
|
3701
|
+
* @param {number} edge
|
|
3702
|
+
* @param {number} target_edge
|
|
3703
|
+
* @param {string} options
|
|
3704
|
+
* @returns {number}
|
|
3705
|
+
*/
|
|
3706
|
+
matchSurface(face, edge, target_edge, options) {
|
|
3707
|
+
const val2 = +face;
|
|
3708
|
+
const val3 = +edge;
|
|
3709
|
+
const val4 = +target_edge;
|
|
3710
|
+
const ptr0 = passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3711
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3712
|
+
const ret = wasm.brepkernel_matchSurface(this.__wbg_ptr, val2, val3, val4, ptr0, len0);
|
|
3394
3713
|
if (ret[2]) {
|
|
3395
3714
|
throw takeFromExternrefTable0(ret[1]);
|
|
3396
3715
|
}
|
|
@@ -3452,26 +3771,37 @@ class BrepKernel {
|
|
|
3452
3771
|
* Perform a mesh boolean on raw triangle data.
|
|
3453
3772
|
*
|
|
3454
3773
|
* Returns a `JsMesh` with the result.
|
|
3455
|
-
* @param {Float64Array} positions_a
|
|
3456
|
-
* @param {Uint32Array} indices_a
|
|
3457
|
-
* @param {Float64Array} positions_b
|
|
3458
|
-
* @param {Uint32Array} indices_b
|
|
3774
|
+
* @param {Float64Array | number[]} positions_a
|
|
3775
|
+
* @param {Uint32Array | number[]} indices_a
|
|
3776
|
+
* @param {Float64Array | number[]} positions_b
|
|
3777
|
+
* @param {Uint32Array | number[]} indices_b
|
|
3459
3778
|
* @param {string} op
|
|
3460
3779
|
* @param {number} tolerance
|
|
3461
3780
|
* @returns {JsMesh}
|
|
3462
3781
|
*/
|
|
3463
3782
|
meshBoolean(positions_a, indices_a, positions_b, indices_b, op, tolerance) {
|
|
3464
|
-
const
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3783
|
+
const val6 = +tolerance;
|
|
3784
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
|
|
3785
|
+
try {
|
|
3786
|
+
ptr0 = passArrayF64ToWasm0(positions_a, wasm.__wbindgen_malloc);
|
|
3787
|
+
len0 = WASM_VECTOR_LEN;
|
|
3788
|
+
ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_malloc);
|
|
3789
|
+
len1 = WASM_VECTOR_LEN;
|
|
3790
|
+
ptr2 = passArrayF64ToWasm0(positions_b, wasm.__wbindgen_malloc);
|
|
3791
|
+
len2 = WASM_VECTOR_LEN;
|
|
3792
|
+
ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_malloc);
|
|
3793
|
+
len3 = WASM_VECTOR_LEN;
|
|
3794
|
+
ptr4 = passStringToWasm0(op, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3795
|
+
len4 = WASM_VECTOR_LEN;
|
|
3796
|
+
} catch (e) {
|
|
3797
|
+
if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 1, 1); }
|
|
3798
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 4, 4); }
|
|
3799
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3800
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 4, 4); }
|
|
3801
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
3802
|
+
throw e;
|
|
3803
|
+
}
|
|
3804
|
+
const ret = wasm.brepkernel_meshBoolean(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, val6);
|
|
3475
3805
|
if (ret[2]) {
|
|
3476
3806
|
throw takeFromExternrefTable0(ret[1]);
|
|
3477
3807
|
}
|
|
@@ -3592,27 +3922,39 @@ class BrepKernel {
|
|
|
3592
3922
|
*
|
|
3593
3923
|
* Returns an error for fewer than two sections, mismatched array lengths, a
|
|
3594
3924
|
* non-finite or out-of-range value, a non-planar profile, or loft failure.
|
|
3595
|
-
* @param {Uint32Array} face_handles
|
|
3596
|
-
* @param {Float64Array} params
|
|
3925
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3926
|
+
* @param {Float64Array | number[]} params
|
|
3597
3927
|
* @param {number} spine_degree
|
|
3598
|
-
* @param {Float64Array} spine_knots
|
|
3599
|
-
* @param {Float64Array} spine_control_points
|
|
3600
|
-
* @param {Float64Array} spine_weights
|
|
3928
|
+
* @param {Float64Array | number[]} spine_knots
|
|
3929
|
+
* @param {Float64Array | number[]} spine_control_points
|
|
3930
|
+
* @param {Float64Array | number[]} spine_weights
|
|
3601
3931
|
* @param {boolean} ruled
|
|
3602
3932
|
* @returns {number}
|
|
3603
3933
|
*/
|
|
3604
3934
|
multiSectionSweep(face_handles, params, spine_degree, spine_knots, spine_control_points, spine_weights, ruled) {
|
|
3605
|
-
const
|
|
3606
|
-
const
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3935
|
+
const val6 = +spine_degree;
|
|
3936
|
+
const val7 = +ruled;
|
|
3937
|
+
let ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4;
|
|
3938
|
+
try {
|
|
3939
|
+
ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
3940
|
+
len0 = WASM_VECTOR_LEN;
|
|
3941
|
+
ptr1 = passArrayF64ToWasm0(params, wasm.__wbindgen_malloc);
|
|
3942
|
+
len1 = WASM_VECTOR_LEN;
|
|
3943
|
+
ptr2 = passArrayF64ToWasm0(spine_knots, wasm.__wbindgen_malloc);
|
|
3944
|
+
len2 = WASM_VECTOR_LEN;
|
|
3945
|
+
ptr3 = passArrayF64ToWasm0(spine_control_points, wasm.__wbindgen_malloc);
|
|
3946
|
+
len3 = WASM_VECTOR_LEN;
|
|
3947
|
+
ptr4 = passArrayF64ToWasm0(spine_weights, wasm.__wbindgen_malloc);
|
|
3948
|
+
len4 = WASM_VECTOR_LEN;
|
|
3949
|
+
} catch (e) {
|
|
3950
|
+
if (ptr4) { wasm.__wbindgen_free(ptr4, len4 * 8, 8); }
|
|
3951
|
+
if (ptr3) { wasm.__wbindgen_free(ptr3, len3 * 8, 8); }
|
|
3952
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
3953
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
3954
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
3955
|
+
throw e;
|
|
3956
|
+
}
|
|
3957
|
+
const ret = wasm.brepkernel_multiSectionSweep(this.__wbg_ptr, ptr0, len0, ptr1, len1, val6, ptr2, len2, ptr3, len3, ptr4, len4, val7);
|
|
3616
3958
|
if (ret[2]) {
|
|
3617
3959
|
throw takeFromExternrefTable0(ret[1]);
|
|
3618
3960
|
}
|
|
@@ -3652,21 +3994,23 @@ class BrepKernel {
|
|
|
3652
3994
|
*
|
|
3653
3995
|
* `coords` is a flat array `[x,y, x,y, ...]` of 2D points.
|
|
3654
3996
|
* Returns a flat array of offset polygon coordinates.
|
|
3655
|
-
* @param {Float64Array} coords
|
|
3997
|
+
* @param {Float64Array | number[]} coords
|
|
3656
3998
|
* @param {number} distance
|
|
3657
3999
|
* @param {number} tolerance
|
|
3658
4000
|
* @returns {Float64Array}
|
|
3659
4001
|
*/
|
|
3660
4002
|
offsetPolygon2d(coords, distance, tolerance) {
|
|
4003
|
+
const val2 = +distance;
|
|
4004
|
+
const val3 = +tolerance;
|
|
3661
4005
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
3662
4006
|
const len0 = WASM_VECTOR_LEN;
|
|
3663
|
-
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4007
|
+
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3664
4008
|
if (ret[3]) {
|
|
3665
4009
|
throw takeFromExternrefTable0(ret[2]);
|
|
3666
4010
|
}
|
|
3667
|
-
var
|
|
4011
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3668
4012
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3669
|
-
return
|
|
4013
|
+
return v4;
|
|
3670
4014
|
}
|
|
3671
4015
|
/**
|
|
3672
4016
|
* Offset all faces of a solid outward or inward (V2 pipeline).
|
|
@@ -3730,9 +4074,11 @@ class BrepKernel {
|
|
|
3730
4074
|
* @returns {number}
|
|
3731
4075
|
*/
|
|
3732
4076
|
offsetWire2DWithJoin(wire, distance, join_type) {
|
|
4077
|
+
const val2 = +wire;
|
|
4078
|
+
const val3 = +distance;
|
|
3733
4079
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3734
4080
|
const len0 = WASM_VECTOR_LEN;
|
|
3735
|
-
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr,
|
|
4081
|
+
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3736
4082
|
if (ret[2]) {
|
|
3737
4083
|
throw takeFromExternrefTable0(ret[1]);
|
|
3738
4084
|
}
|
|
@@ -3754,9 +4100,11 @@ class BrepKernel {
|
|
|
3754
4100
|
* @returns {number}
|
|
3755
4101
|
*/
|
|
3756
4102
|
offsetWireWithJoinType(face, distance, join_type) {
|
|
4103
|
+
const val2 = +face;
|
|
4104
|
+
const val3 = +distance;
|
|
3757
4105
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3758
4106
|
const len0 = WASM_VECTOR_LEN;
|
|
3759
|
-
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr,
|
|
4107
|
+
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3760
4108
|
if (ret[2]) {
|
|
3761
4109
|
throw takeFromExternrefTable0(ret[1]);
|
|
3762
4110
|
}
|
|
@@ -3787,19 +4135,29 @@ class BrepKernel {
|
|
|
3787
4135
|
* Returns an error if the face or path is invalid.
|
|
3788
4136
|
* @param {number} face
|
|
3789
4137
|
* @param {number} path_degree
|
|
3790
|
-
* @param {Float64Array} path_knots
|
|
3791
|
-
* @param {Float64Array} path_control_points
|
|
3792
|
-
* @param {Float64Array} path_weights
|
|
4138
|
+
* @param {Float64Array | number[]} path_knots
|
|
4139
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4140
|
+
* @param {Float64Array | number[]} path_weights
|
|
3793
4141
|
* @returns {number}
|
|
3794
4142
|
*/
|
|
3795
4143
|
pipe(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
3796
|
-
const
|
|
3797
|
-
const
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
4144
|
+
const val4 = +face;
|
|
4145
|
+
const val5 = +path_degree;
|
|
4146
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4147
|
+
try {
|
|
4148
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4149
|
+
len0 = WASM_VECTOR_LEN;
|
|
4150
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4151
|
+
len1 = WASM_VECTOR_LEN;
|
|
4152
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4153
|
+
len2 = WASM_VECTOR_LEN;
|
|
4154
|
+
} catch (e) {
|
|
4155
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
4156
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4157
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4158
|
+
throw e;
|
|
4159
|
+
}
|
|
4160
|
+
const ret = wasm.brepkernel_pipe(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
3803
4161
|
if (ret[2]) {
|
|
3804
4162
|
throw takeFromExternrefTable0(ret[1]);
|
|
3805
4163
|
}
|
|
@@ -3810,15 +4168,17 @@ class BrepKernel {
|
|
|
3810
4168
|
*
|
|
3811
4169
|
* `polygon_coords` is a flat array `[x,y, x,y, ...]`.
|
|
3812
4170
|
* Returns `true` if the point is inside the polygon (winding number test).
|
|
3813
|
-
* @param {Float64Array} polygon_coords
|
|
4171
|
+
* @param {Float64Array | number[]} polygon_coords
|
|
3814
4172
|
* @param {number} px
|
|
3815
4173
|
* @param {number} py
|
|
3816
4174
|
* @returns {boolean}
|
|
3817
4175
|
*/
|
|
3818
4176
|
pointInPolygon2d(polygon_coords, px, py) {
|
|
4177
|
+
const val2 = +px;
|
|
4178
|
+
const val3 = +py;
|
|
3819
4179
|
const ptr0 = passArrayF64ToWasm0(polygon_coords, wasm.__wbindgen_malloc);
|
|
3820
4180
|
const len0 = WASM_VECTOR_LEN;
|
|
3821
|
-
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4181
|
+
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3822
4182
|
if (ret[2]) {
|
|
3823
4183
|
throw takeFromExternrefTable0(ret[1]);
|
|
3824
4184
|
}
|
|
@@ -3899,15 +4259,22 @@ class BrepKernel {
|
|
|
3899
4259
|
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
3900
4260
|
* Returns `true` if any vertex of one polygon is inside the other
|
|
3901
4261
|
* or if any edges cross.
|
|
3902
|
-
* @param {Float64Array} coords_a
|
|
3903
|
-
* @param {Float64Array} coords_b
|
|
4262
|
+
* @param {Float64Array | number[]} coords_a
|
|
4263
|
+
* @param {Float64Array | number[]} coords_b
|
|
3904
4264
|
* @returns {boolean}
|
|
3905
4265
|
*/
|
|
3906
4266
|
polygonsIntersect2d(coords_a, coords_b) {
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
4267
|
+
let ptr0, len0, ptr1, len1;
|
|
4268
|
+
try {
|
|
4269
|
+
ptr0 = passArrayF64ToWasm0(coords_a, wasm.__wbindgen_malloc);
|
|
4270
|
+
len0 = WASM_VECTOR_LEN;
|
|
4271
|
+
ptr1 = passArrayF64ToWasm0(coords_b, wasm.__wbindgen_malloc);
|
|
4272
|
+
len1 = WASM_VECTOR_LEN;
|
|
4273
|
+
} catch (e) {
|
|
4274
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4275
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4276
|
+
throw e;
|
|
4277
|
+
}
|
|
3911
4278
|
const ret = wasm.brepkernel_polygonsIntersect2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
3912
4279
|
if (ret[2]) {
|
|
3913
4280
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -3975,7 +4342,7 @@ class BrepKernel {
|
|
|
3975
4342
|
*
|
|
3976
4343
|
* Returns an error for an empty list, an invalid handle, a non-positive
|
|
3977
4344
|
* `deflection`, or a degenerate `dir`/`x_axis`.
|
|
3978
|
-
* @param {Uint32Array} solids
|
|
4345
|
+
* @param {Uint32Array | number[]} solids
|
|
3979
4346
|
* @param {number} origin_x
|
|
3980
4347
|
* @param {number} origin_y
|
|
3981
4348
|
* @param {number} origin_z
|
|
@@ -3990,9 +4357,20 @@ class BrepKernel {
|
|
|
3990
4357
|
* @returns {any}
|
|
3991
4358
|
*/
|
|
3992
4359
|
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) {
|
|
4360
|
+
const val2 = +origin_x;
|
|
4361
|
+
const val3 = +origin_y;
|
|
4362
|
+
const val4 = +origin_z;
|
|
4363
|
+
const val5 = +dir_x;
|
|
4364
|
+
const val6 = +dir_y;
|
|
4365
|
+
const val7 = +dir_z;
|
|
4366
|
+
const val8 = +x_axis_x;
|
|
4367
|
+
const val9 = +x_axis_y;
|
|
4368
|
+
const val10 = +x_axis_z;
|
|
4369
|
+
const val11 = +hidden_lines;
|
|
4370
|
+
const val12 = +deflection;
|
|
3993
4371
|
const ptr0 = passArray32ToWasm0(solids, wasm.__wbindgen_malloc);
|
|
3994
4372
|
const len0 = WASM_VECTOR_LEN;
|
|
3995
|
-
const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0,
|
|
4373
|
+
const ret = wasm.brepkernel_projectSolidsEdges(this.__wbg_ptr, ptr0, len0, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12);
|
|
3996
4374
|
if (ret[2]) {
|
|
3997
4375
|
throw takeFromExternrefTable0(ret[1]);
|
|
3998
4376
|
}
|
|
@@ -4229,14 +4607,15 @@ class BrepKernel {
|
|
|
4229
4607
|
* # Errors
|
|
4230
4608
|
*
|
|
4231
4609
|
* Returns an error if fewer than 2 faces or sewing fails.
|
|
4232
|
-
* @param {Uint32Array} face_handles
|
|
4610
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4233
4611
|
* @param {number} tolerance
|
|
4234
4612
|
* @returns {number}
|
|
4235
4613
|
*/
|
|
4236
4614
|
sewFaces(face_handles, tolerance) {
|
|
4615
|
+
const val2 = +tolerance;
|
|
4237
4616
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4238
4617
|
const len0 = WASM_VECTOR_LEN;
|
|
4239
|
-
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0,
|
|
4618
|
+
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
4240
4619
|
if (ret[2]) {
|
|
4241
4620
|
throw takeFromExternrefTable0(ret[1]);
|
|
4242
4621
|
}
|
|
@@ -4270,13 +4649,15 @@ class BrepKernel {
|
|
|
4270
4649
|
* Returns an error if thickness is non-positive or the solid is invalid.
|
|
4271
4650
|
* @param {number} solid
|
|
4272
4651
|
* @param {number} thickness
|
|
4273
|
-
* @param {Uint32Array} open_faces
|
|
4652
|
+
* @param {Uint32Array | number[]} open_faces
|
|
4274
4653
|
* @returns {number}
|
|
4275
4654
|
*/
|
|
4276
4655
|
shell(solid, thickness, open_faces) {
|
|
4656
|
+
const val2 = +solid;
|
|
4657
|
+
const val3 = +thickness;
|
|
4277
4658
|
const ptr0 = passArray32ToWasm0(open_faces, wasm.__wbindgen_malloc);
|
|
4278
4659
|
const len0 = WASM_VECTOR_LEN;
|
|
4279
|
-
const ret = wasm.brepkernel_shell(this.__wbg_ptr,
|
|
4660
|
+
const ret = wasm.brepkernel_shell(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
4280
4661
|
if (ret[2]) {
|
|
4281
4662
|
throw takeFromExternrefTable0(ret[1]);
|
|
4282
4663
|
}
|
|
@@ -4325,9 +4706,10 @@ class BrepKernel {
|
|
|
4325
4706
|
* @param {string} json
|
|
4326
4707
|
*/
|
|
4327
4708
|
sketchAddConstraint(sketch, json) {
|
|
4709
|
+
const val2 = +sketch;
|
|
4328
4710
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4329
4711
|
const len0 = WASM_VECTOR_LEN;
|
|
4330
|
-
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr,
|
|
4712
|
+
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr, val2, ptr0, len0);
|
|
4331
4713
|
if (ret[1]) {
|
|
4332
4714
|
throw takeFromExternrefTable0(ret[0]);
|
|
4333
4715
|
}
|
|
@@ -4448,6 +4830,34 @@ class BrepKernel {
|
|
|
4448
4830
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
4449
4831
|
return v1;
|
|
4450
4832
|
}
|
|
4833
|
+
/**
|
|
4834
|
+
* A solid in the pieces the given faces separate it into. A face that
|
|
4835
|
+
* walls nothing off imprints instead, so a face that only dips in returns
|
|
4836
|
+
* one solid.
|
|
4837
|
+
*
|
|
4838
|
+
* Returns solid handles.
|
|
4839
|
+
*
|
|
4840
|
+
* # Errors
|
|
4841
|
+
*
|
|
4842
|
+
* Returns an error if a handle does not resolve, a face cannot be split
|
|
4843
|
+
* along its marks, or the pieces would not be valid solids summing to the
|
|
4844
|
+
* solid's volume.
|
|
4845
|
+
* @param {number} solid
|
|
4846
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4847
|
+
* @returns {Uint32Array}
|
|
4848
|
+
*/
|
|
4849
|
+
splitByFaces(solid, face_handles) {
|
|
4850
|
+
const val2 = +solid;
|
|
4851
|
+
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4852
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4853
|
+
const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr, val2, ptr0, len0);
|
|
4854
|
+
if (ret[3]) {
|
|
4855
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4856
|
+
}
|
|
4857
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
4858
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4859
|
+
return v3;
|
|
4860
|
+
}
|
|
4451
4861
|
/**
|
|
4452
4862
|
* Split a solid into two halves along a plane.
|
|
4453
4863
|
*
|
|
@@ -4505,13 +4915,14 @@ class BrepKernel {
|
|
|
4505
4915
|
*
|
|
4506
4916
|
* Returns an error if fewer than 2 edges or the fit fails.
|
|
4507
4917
|
* @param {number} face
|
|
4508
|
-
* @param {Uint32Array} edge_handles
|
|
4918
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
4509
4919
|
* @returns {number}
|
|
4510
4920
|
*/
|
|
4511
4921
|
sweepAlongEdges(face, edge_handles) {
|
|
4922
|
+
const val2 = +face;
|
|
4512
4923
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
4513
4924
|
const len0 = WASM_VECTOR_LEN;
|
|
4514
|
-
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr,
|
|
4925
|
+
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr, val2, ptr0, len0);
|
|
4515
4926
|
if (ret[2]) {
|
|
4516
4927
|
throw takeFromExternrefTable0(ret[1]);
|
|
4517
4928
|
}
|
|
@@ -4531,19 +4942,29 @@ class BrepKernel {
|
|
|
4531
4942
|
* Returns an error if the face or path is invalid, or surface fitting fails.
|
|
4532
4943
|
* @param {number} face
|
|
4533
4944
|
* @param {number} path_degree
|
|
4534
|
-
* @param {Float64Array} path_knots
|
|
4535
|
-
* @param {Float64Array} path_control_points
|
|
4536
|
-
* @param {Float64Array} path_weights
|
|
4945
|
+
* @param {Float64Array | number[]} path_knots
|
|
4946
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4947
|
+
* @param {Float64Array | number[]} path_weights
|
|
4537
4948
|
* @returns {number}
|
|
4538
4949
|
*/
|
|
4539
4950
|
sweepSmooth(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4540
|
-
const
|
|
4541
|
-
const
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4951
|
+
const val4 = +face;
|
|
4952
|
+
const val5 = +path_degree;
|
|
4953
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
4954
|
+
try {
|
|
4955
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4956
|
+
len0 = WASM_VECTOR_LEN;
|
|
4957
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4958
|
+
len1 = WASM_VECTOR_LEN;
|
|
4959
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4960
|
+
len2 = WASM_VECTOR_LEN;
|
|
4961
|
+
} catch (e) {
|
|
4962
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
4963
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
4964
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
4965
|
+
throw e;
|
|
4966
|
+
}
|
|
4967
|
+
const ret = wasm.brepkernel_sweepSmooth(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4547
4968
|
if (ret[2]) {
|
|
4548
4969
|
throw takeFromExternrefTable0(ret[1]);
|
|
4549
4970
|
}
|
|
@@ -4562,13 +4983,14 @@ class BrepKernel {
|
|
|
4562
4983
|
* Returns an error if a handle is invalid, the chain has no edges, breaks,
|
|
4563
4984
|
* closes or has a kink, or the wire is closed.
|
|
4564
4985
|
* @param {number} wire
|
|
4565
|
-
* @param {Uint32Array} path_edges
|
|
4986
|
+
* @param {Uint32Array | number[]} path_edges
|
|
4566
4987
|
* @returns {number}
|
|
4567
4988
|
*/
|
|
4568
4989
|
sweepWire(wire, path_edges) {
|
|
4990
|
+
const val2 = +wire;
|
|
4569
4991
|
const ptr0 = passArray32ToWasm0(path_edges, wasm.__wbindgen_malloc);
|
|
4570
4992
|
const len0 = WASM_VECTOR_LEN;
|
|
4571
|
-
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr,
|
|
4993
|
+
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4572
4994
|
if (ret[2]) {
|
|
4573
4995
|
throw takeFromExternrefTable0(ret[1]);
|
|
4574
4996
|
}
|
|
@@ -4584,19 +5006,30 @@ class BrepKernel {
|
|
|
4584
5006
|
* @param {number} profile
|
|
4585
5007
|
* @param {number} path_edge
|
|
4586
5008
|
* @param {string} contact_mode
|
|
4587
|
-
* @param {Float64Array} scale_values
|
|
5009
|
+
* @param {Float64Array | number[]} scale_values
|
|
4588
5010
|
* @param {number} segments
|
|
4589
5011
|
* @param {string} corner_mode
|
|
4590
5012
|
* @returns {number}
|
|
4591
5013
|
*/
|
|
4592
5014
|
sweepWithOptions(profile, path_edge, contact_mode, scale_values, segments, corner_mode) {
|
|
4593
|
-
const
|
|
4594
|
-
const
|
|
4595
|
-
const
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
5015
|
+
const val4 = +profile;
|
|
5016
|
+
const val5 = +path_edge;
|
|
5017
|
+
const val6 = +segments;
|
|
5018
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
5019
|
+
try {
|
|
5020
|
+
ptr0 = passStringToWasm0(contact_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5021
|
+
len0 = WASM_VECTOR_LEN;
|
|
5022
|
+
ptr1 = passArrayF64ToWasm0(scale_values, wasm.__wbindgen_malloc);
|
|
5023
|
+
len1 = WASM_VECTOR_LEN;
|
|
5024
|
+
ptr2 = passStringToWasm0(corner_mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5025
|
+
len2 = WASM_VECTOR_LEN;
|
|
5026
|
+
} catch (e) {
|
|
5027
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 1, 1); }
|
|
5028
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
5029
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
5030
|
+
throw e;
|
|
5031
|
+
}
|
|
5032
|
+
const ret = wasm.brepkernel_sweepWithOptions(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, val6, ptr2, len2);
|
|
4600
5033
|
if (ret[2]) {
|
|
4601
5034
|
throw takeFromExternrefTable0(ret[1]);
|
|
4602
5035
|
}
|
|
@@ -4619,19 +5052,29 @@ class BrepKernel {
|
|
|
4619
5052
|
* inconsistent lengths, or the sweep operation fails.
|
|
4620
5053
|
* @param {number} face
|
|
4621
5054
|
* @param {number} path_degree
|
|
4622
|
-
* @param {Float64Array} path_knots
|
|
4623
|
-
* @param {Float64Array} path_control_points
|
|
4624
|
-
* @param {Float64Array} path_weights
|
|
5055
|
+
* @param {Float64Array | number[]} path_knots
|
|
5056
|
+
* @param {Float64Array | number[]} path_control_points
|
|
5057
|
+
* @param {Float64Array | number[]} path_weights
|
|
4625
5058
|
* @returns {number}
|
|
4626
5059
|
*/
|
|
4627
5060
|
sweep(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4628
|
-
const
|
|
4629
|
-
const
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
5061
|
+
const val4 = +face;
|
|
5062
|
+
const val5 = +path_degree;
|
|
5063
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
5064
|
+
try {
|
|
5065
|
+
ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
5066
|
+
len0 = WASM_VECTOR_LEN;
|
|
5067
|
+
ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
5068
|
+
len1 = WASM_VECTOR_LEN;
|
|
5069
|
+
ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
5070
|
+
len2 = WASM_VECTOR_LEN;
|
|
5071
|
+
} catch (e) {
|
|
5072
|
+
if (ptr2) { wasm.__wbindgen_free(ptr2, len2 * 8, 8); }
|
|
5073
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 8, 8); }
|
|
5074
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 8, 8); }
|
|
5075
|
+
throw e;
|
|
5076
|
+
}
|
|
5077
|
+
const ret = wasm.brepkernel_sweep(this.__wbg_ptr, val4, val5, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4635
5078
|
if (ret[2]) {
|
|
4636
5079
|
throw takeFromExternrefTable0(ret[1]);
|
|
4637
5080
|
}
|
|
@@ -4832,12 +5275,13 @@ class BrepKernel {
|
|
|
4832
5275
|
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
4833
5276
|
* have 16 elements, or the matrix is singular.
|
|
4834
5277
|
* @param {number} face
|
|
4835
|
-
* @param {Float64Array} matrix
|
|
5278
|
+
* @param {Float64Array | number[]} matrix
|
|
4836
5279
|
*/
|
|
4837
5280
|
transformFace(face, matrix) {
|
|
5281
|
+
const val2 = +face;
|
|
4838
5282
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4839
5283
|
const len0 = WASM_VECTOR_LEN;
|
|
4840
|
-
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr,
|
|
5284
|
+
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, val2, ptr0, len0);
|
|
4841
5285
|
if (ret[1]) {
|
|
4842
5286
|
throw takeFromExternrefTable0(ret[0]);
|
|
4843
5287
|
}
|
|
@@ -4852,12 +5296,13 @@ class BrepKernel {
|
|
|
4852
5296
|
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
4853
5297
|
* have 16 elements, or the matrix is singular.
|
|
4854
5298
|
* @param {number} solid
|
|
4855
|
-
* @param {Float64Array} matrix
|
|
5299
|
+
* @param {Float64Array | number[]} matrix
|
|
4856
5300
|
*/
|
|
4857
5301
|
transformSolid(solid, matrix) {
|
|
5302
|
+
const val2 = +solid;
|
|
4858
5303
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4859
5304
|
const len0 = WASM_VECTOR_LEN;
|
|
4860
|
-
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr,
|
|
5305
|
+
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr, val2, ptr0, len0);
|
|
4861
5306
|
if (ret[1]) {
|
|
4862
5307
|
throw takeFromExternrefTable0(ret[0]);
|
|
4863
5308
|
}
|
|
@@ -4872,12 +5317,13 @@ class BrepKernel {
|
|
|
4872
5317
|
* Returns an error if the wire handle is invalid, the matrix doesn't
|
|
4873
5318
|
* have 16 elements, or the matrix is singular.
|
|
4874
5319
|
* @param {number} wire
|
|
4875
|
-
* @param {Float64Array} matrix
|
|
5320
|
+
* @param {Float64Array | number[]} matrix
|
|
4876
5321
|
*/
|
|
4877
5322
|
transformWire(wire, matrix) {
|
|
5323
|
+
const val2 = +wire;
|
|
4878
5324
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4879
5325
|
const len0 = WASM_VECTOR_LEN;
|
|
4880
|
-
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr,
|
|
5326
|
+
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4881
5327
|
if (ret[1]) {
|
|
4882
5328
|
throw takeFromExternrefTable0(ret[0]);
|
|
4883
5329
|
}
|
|
@@ -5001,14 +5447,15 @@ class BrepKernel {
|
|
|
5001
5447
|
*
|
|
5002
5448
|
* Accepts an array of face handles from potentially different shells.
|
|
5003
5449
|
* Sews all faces together into a single solid.
|
|
5004
|
-
* @param {Uint32Array} face_handles
|
|
5450
|
+
* @param {Uint32Array | number[]} face_handles
|
|
5005
5451
|
* @param {number} tolerance
|
|
5006
5452
|
* @returns {number}
|
|
5007
5453
|
*/
|
|
5008
5454
|
weldShellsAndFaces(face_handles, tolerance) {
|
|
5455
|
+
const val2 = +tolerance;
|
|
5009
5456
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
5010
5457
|
const len0 = WASM_VECTOR_LEN;
|
|
5011
|
-
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0,
|
|
5458
|
+
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
5012
5459
|
if (ret[2]) {
|
|
5013
5460
|
throw takeFromExternrefTable0(ret[1]);
|
|
5014
5461
|
}
|
|
@@ -5478,30 +5925,30 @@ exports.setLogLevel = setLogLevel;
|
|
|
5478
5925
|
function __wbg_get_imports() {
|
|
5479
5926
|
const import0 = {
|
|
5480
5927
|
__proto__: null,
|
|
5481
|
-
|
|
5928
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
5482
5929
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5483
5930
|
return ret;
|
|
5484
5931
|
},
|
|
5485
|
-
|
|
5932
|
+
__wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
|
|
5486
5933
|
const ret = debugString(arg1);
|
|
5487
5934
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5488
5935
|
const len1 = WASM_VECTOR_LEN;
|
|
5489
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5490
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5936
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
5937
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
5491
5938
|
},
|
|
5492
|
-
|
|
5939
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
5493
5940
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
5494
5941
|
},
|
|
5495
|
-
|
|
5942
|
+
__wbg_error_b693e3f4fbf3e888: function(arg0, arg1) {
|
|
5496
5943
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
5497
5944
|
},
|
|
5498
|
-
|
|
5945
|
+
__wbg_getRandomValues_8b6f1f663e6f188d: function() { return handleError(function (arg0, arg1) {
|
|
5499
5946
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
5500
5947
|
}, arguments); },
|
|
5501
|
-
|
|
5948
|
+
__wbg_log_85d5c5732049ef45: function(arg0, arg1) {
|
|
5502
5949
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5503
5950
|
},
|
|
5504
|
-
|
|
5951
|
+
__wbg_warn_bc26df775fd739d9: function(arg0, arg1) {
|
|
5505
5952
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
5506
5953
|
},
|
|
5507
5954
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
@@ -5511,12 +5958,11 @@ function __wbg_get_imports() {
|
|
|
5511
5958
|
},
|
|
5512
5959
|
__wbindgen_init_externref_table: function() {
|
|
5513
5960
|
const table = wasm.__wbindgen_externrefs;
|
|
5514
|
-
const offset = table.grow(4);
|
|
5515
5961
|
table.set(0, undefined);
|
|
5516
|
-
table.set(
|
|
5517
|
-
table.set(
|
|
5518
|
-
table.set(
|
|
5519
|
-
table.set(
|
|
5962
|
+
table.set(1024, undefined);
|
|
5963
|
+
table.set(1025, null);
|
|
5964
|
+
table.set(1026, true);
|
|
5965
|
+
table.set(1027, false);
|
|
5520
5966
|
},
|
|
5521
5967
|
};
|
|
5522
5968
|
return {
|
|
@@ -5551,68 +5997,61 @@ function addToExternrefTable0(obj) {
|
|
|
5551
5997
|
}
|
|
5552
5998
|
|
|
5553
5999
|
function debugString(val) {
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
5606
|
-
} catch (_) {
|
|
5607
|
-
return 'Object';
|
|
6000
|
+
switch (typeof val) {
|
|
6001
|
+
// primitive types
|
|
6002
|
+
case 'number':
|
|
6003
|
+
case 'boolean':
|
|
6004
|
+
case 'undefined':
|
|
6005
|
+
return `${val}`;
|
|
6006
|
+
case 'string':
|
|
6007
|
+
return JSON.stringify(val);
|
|
6008
|
+
case 'bigint':
|
|
6009
|
+
return `${val}n`;
|
|
6010
|
+
case 'symbol':
|
|
6011
|
+
return val.description !== undefined
|
|
6012
|
+
? `Symbol(${val.description})`
|
|
6013
|
+
: 'Symbol';
|
|
6014
|
+
case 'function':
|
|
6015
|
+
return typeof val.name === 'string' && val.name !== ''
|
|
6016
|
+
? `Function(${val.name})`
|
|
6017
|
+
: 'Function';
|
|
6018
|
+
case 'object': {
|
|
6019
|
+
if (val === null) {
|
|
6020
|
+
return 'null';
|
|
6021
|
+
}
|
|
6022
|
+
// objects
|
|
6023
|
+
if (Array.isArray(val)) {
|
|
6024
|
+
return '[' + Array.from(val, debugString).join(', ') + ']';
|
|
6025
|
+
}
|
|
6026
|
+
// errors
|
|
6027
|
+
if (val instanceof Error) {
|
|
6028
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
6029
|
+
}
|
|
6030
|
+
|
|
6031
|
+
const toStringOutput = toString.call(val);
|
|
6032
|
+
// Test for built-in
|
|
6033
|
+
const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
|
|
6034
|
+
|
|
6035
|
+
// Failed to match the standard '[object ClassName]'
|
|
6036
|
+
if (className === undefined) {
|
|
6037
|
+
return toStringOutput;
|
|
6038
|
+
}
|
|
6039
|
+
if (className === 'Object') {
|
|
6040
|
+
// we're a user defined class or Object
|
|
6041
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
6042
|
+
// easier than looping through ownProperties of `val`.
|
|
6043
|
+
try {
|
|
6044
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
6045
|
+
} catch (_) {
|
|
6046
|
+
return 'Object';
|
|
6047
|
+
}
|
|
6048
|
+
}
|
|
6049
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
6050
|
+
return className;
|
|
5608
6051
|
}
|
|
6052
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
6053
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
5609
6054
|
}
|
|
5610
|
-
// errors
|
|
5611
|
-
if (val instanceof Error) {
|
|
5612
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
5613
|
-
}
|
|
5614
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
5615
|
-
return className;
|
|
5616
6055
|
}
|
|
5617
6056
|
|
|
5618
6057
|
function getArrayF32FromWasm0(ptr, len) {
|
|
@@ -5660,7 +6099,8 @@ function getFloat64ArrayMemory0() {
|
|
|
5660
6099
|
}
|
|
5661
6100
|
|
|
5662
6101
|
function getStringFromWasm0(ptr, len) {
|
|
5663
|
-
|
|
6102
|
+
ptr = ptr >>> 0;
|
|
6103
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
5664
6104
|
}
|
|
5665
6105
|
|
|
5666
6106
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -5756,10 +6196,10 @@ function takeFromExternrefTable0(idx) {
|
|
|
5756
6196
|
return value;
|
|
5757
6197
|
}
|
|
5758
6198
|
|
|
5759
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
6199
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
5760
6200
|
cachedTextDecoder.decode();
|
|
5761
|
-
function decodeText(
|
|
5762
|
-
return cachedTextDecoder.decode(
|
|
6201
|
+
function decodeText(bytes) {
|
|
6202
|
+
return cachedTextDecoder.decode(bytes);
|
|
5763
6203
|
}
|
|
5764
6204
|
|
|
5765
6205
|
const cachedTextEncoder = new TextEncoder();
|