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_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) {
|
|
@@ -2477,19 +2683,55 @@ export class BrepKernel {
|
|
|
2477
2683
|
}
|
|
2478
2684
|
return ret[0] >>> 0;
|
|
2479
2685
|
}
|
|
2686
|
+
/**
|
|
2687
|
+
* A copy of a solid with its faces split where the given faces and edges
|
|
2688
|
+
* meet them.
|
|
2689
|
+
*
|
|
2690
|
+
* Returns a solid handle. The copy has the solid's volume.
|
|
2691
|
+
*
|
|
2692
|
+
* # Errors
|
|
2693
|
+
*
|
|
2694
|
+
* Returns an error if a handle does not resolve, a face cannot be split
|
|
2695
|
+
* along its marks, or the result would not be a valid solid of the same
|
|
2696
|
+
* volume.
|
|
2697
|
+
* @param {number} solid
|
|
2698
|
+
* @param {Uint32Array | number[]} face_handles
|
|
2699
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
2700
|
+
* @returns {number}
|
|
2701
|
+
*/
|
|
2702
|
+
imprintFaces(solid, face_handles, edge_handles) {
|
|
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);
|
|
2716
|
+
if (ret[2]) {
|
|
2717
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2718
|
+
}
|
|
2719
|
+
return ret[0] >>> 0;
|
|
2720
|
+
}
|
|
2480
2721
|
/**
|
|
2481
2722
|
* Interpolate a NURBS curve through points and create an edge.
|
|
2482
2723
|
*
|
|
2483
2724
|
* Uses chord-length parameterization with the given degree.
|
|
2484
2725
|
* Returns an edge handle (`u32`).
|
|
2485
|
-
* @param {Float64Array} coords
|
|
2726
|
+
* @param {Float64Array | number[]} coords
|
|
2486
2727
|
* @param {number} degree
|
|
2487
2728
|
* @returns {number}
|
|
2488
2729
|
*/
|
|
2489
2730
|
interpolatePoints(coords, degree) {
|
|
2731
|
+
const val2 = +degree;
|
|
2490
2732
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2491
2733
|
const len0 = WASM_VECTOR_LEN;
|
|
2492
|
-
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0,
|
|
2734
|
+
const ret = wasm.brepkernel_interpolatePoints(this.__wbg_ptr, ptr0, len0, val2);
|
|
2493
2735
|
if (ret[2]) {
|
|
2494
2736
|
throw takeFromExternrefTable0(ret[1]);
|
|
2495
2737
|
}
|
|
@@ -2500,7 +2742,7 @@ export class BrepKernel {
|
|
|
2500
2742
|
*
|
|
2501
2743
|
* `coords` is a flat array `[x,y,z, ...]` of `rows * cols` points.
|
|
2502
2744
|
* Returns a face handle.
|
|
2503
|
-
* @param {Float64Array} coords
|
|
2745
|
+
* @param {Float64Array | number[]} coords
|
|
2504
2746
|
* @param {number} rows
|
|
2505
2747
|
* @param {number} cols
|
|
2506
2748
|
* @param {number} degree_u
|
|
@@ -2508,9 +2750,13 @@ export class BrepKernel {
|
|
|
2508
2750
|
* @returns {number}
|
|
2509
2751
|
*/
|
|
2510
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;
|
|
2511
2757
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
2512
2758
|
const len0 = WASM_VECTOR_LEN;
|
|
2513
|
-
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);
|
|
2514
2760
|
if (ret[2]) {
|
|
2515
2761
|
throw takeFromExternrefTable0(ret[1]);
|
|
2516
2762
|
}
|
|
@@ -2524,15 +2770,22 @@ export class BrepKernel {
|
|
|
2524
2770
|
* or an empty array if they don't intersect.
|
|
2525
2771
|
*
|
|
2526
2772
|
* Uses the Sutherland-Hodgman algorithm (convex clipper).
|
|
2527
|
-
* @param {Float64Array} coords_a
|
|
2528
|
-
* @param {Float64Array} coords_b
|
|
2773
|
+
* @param {Float64Array | number[]} coords_a
|
|
2774
|
+
* @param {Float64Array | number[]} coords_b
|
|
2529
2775
|
* @returns {Float64Array}
|
|
2530
2776
|
*/
|
|
2531
2777
|
intersectPolygons2d(coords_a, coords_b) {
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
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
|
+
}
|
|
2536
2789
|
const ret = wasm.brepkernel_intersectPolygons2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2537
2790
|
if (ret[3]) {
|
|
2538
2791
|
throw takeFromExternrefTable0(ret[2]);
|
|
@@ -2637,7 +2890,7 @@ export class BrepKernel {
|
|
|
2637
2890
|
*
|
|
2638
2891
|
* Returns an edge handle (`u32`).
|
|
2639
2892
|
* @param {number} curve_type
|
|
2640
|
-
* @param {Float64Array} curve_params
|
|
2893
|
+
* @param {Float64Array | number[]} curve_params
|
|
2641
2894
|
* @param {number} origin_x
|
|
2642
2895
|
* @param {number} origin_y
|
|
2643
2896
|
* @param {number} origin_z
|
|
@@ -2652,9 +2905,21 @@ export class BrepKernel {
|
|
|
2652
2905
|
* @returns {number}
|
|
2653
2906
|
*/
|
|
2654
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;
|
|
2655
2920
|
const ptr0 = passArrayF64ToWasm0(curve_params, wasm.__wbindgen_malloc);
|
|
2656
2921
|
const len0 = WASM_VECTOR_LEN;
|
|
2657
|
-
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);
|
|
2658
2923
|
if (ret[2]) {
|
|
2659
2924
|
throw takeFromExternrefTable0(ret[1]);
|
|
2660
2925
|
}
|
|
@@ -2696,7 +2961,7 @@ export class BrepKernel {
|
|
|
2696
2961
|
*
|
|
2697
2962
|
* Returns an error if fewer than 2 profiles are given, profiles have
|
|
2698
2963
|
* different vertex counts, or surface fitting fails.
|
|
2699
|
-
* @param {Uint32Array} faces
|
|
2964
|
+
* @param {Uint32Array | number[]} faces
|
|
2700
2965
|
* @returns {number}
|
|
2701
2966
|
*/
|
|
2702
2967
|
loftSmooth(faces) {
|
|
@@ -2718,7 +2983,7 @@ export class BrepKernel {
|
|
|
2718
2983
|
* Returns an error if a handle is invalid, fewer than two wires are given,
|
|
2719
2984
|
* their edge counts differ, a wire is closed, meets itself or breaks, two
|
|
2720
2985
|
* wires touch where they would be joined, or two lines cross or fold over.
|
|
2721
|
-
* @param {Uint32Array} wires
|
|
2986
|
+
* @param {Uint32Array | number[]} wires
|
|
2722
2987
|
* @returns {number}
|
|
2723
2988
|
*/
|
|
2724
2989
|
loftWires(wires) {
|
|
@@ -2740,15 +3005,22 @@ export class BrepKernel {
|
|
|
2740
3005
|
* - `solid: bool` — true (default) returns a solid handle; false returns
|
|
2741
3006
|
* a shell handle holding the loft's faces without the caps on its end
|
|
2742
3007
|
* profiles
|
|
2743
|
-
* @param {Uint32Array} faces
|
|
3008
|
+
* @param {Uint32Array | number[]} faces
|
|
2744
3009
|
* @param {string} options
|
|
2745
3010
|
* @returns {number}
|
|
2746
3011
|
*/
|
|
2747
3012
|
loftWithOptions(faces, options) {
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
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
|
+
}
|
|
2752
3024
|
const ret = wasm.brepkernel_loftWithOptions(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
2753
3025
|
if (ret[2]) {
|
|
2754
3026
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -2764,7 +3036,7 @@ export class BrepKernel {
|
|
|
2764
3036
|
*
|
|
2765
3037
|
* Returns an error if fewer than 2 faces or profiles have
|
|
2766
3038
|
* different vertex counts.
|
|
2767
|
-
* @param {Uint32Array} faces
|
|
3039
|
+
* @param {Uint32Array | number[]} faces
|
|
2768
3040
|
* @returns {number}
|
|
2769
3041
|
*/
|
|
2770
3042
|
loft(faces) {
|
|
@@ -2934,7 +3206,7 @@ export class BrepKernel {
|
|
|
2934
3206
|
* Create a compound from multiple solid handles.
|
|
2935
3207
|
*
|
|
2936
3208
|
* Returns a compound handle (stored as `u32`).
|
|
2937
|
-
* @param {Uint32Array} solid_handles
|
|
3209
|
+
* @param {Uint32Array | number[]} solid_handles
|
|
2938
3210
|
* @returns {number}
|
|
2939
3211
|
*/
|
|
2940
3212
|
makeCompound(solid_handles) {
|
|
@@ -3170,19 +3442,34 @@ export class BrepKernel {
|
|
|
3170
3442
|
* @param {number} end_y
|
|
3171
3443
|
* @param {number} end_z
|
|
3172
3444
|
* @param {number} degree
|
|
3173
|
-
* @param {Float64Array} knots
|
|
3174
|
-
* @param {Float64Array} control_points
|
|
3175
|
-
* @param {Float64Array} weights
|
|
3445
|
+
* @param {Float64Array | number[]} knots
|
|
3446
|
+
* @param {Float64Array | number[]} control_points
|
|
3447
|
+
* @param {Float64Array | number[]} weights
|
|
3176
3448
|
* @returns {number}
|
|
3177
3449
|
*/
|
|
3178
3450
|
makeNurbsEdge(start_x, start_y, start_z, end_x, end_y, end_z, degree, knots, control_points, weights) {
|
|
3179
|
-
const
|
|
3180
|
-
const
|
|
3181
|
-
const
|
|
3182
|
-
const
|
|
3183
|
-
const
|
|
3184
|
-
const
|
|
3185
|
-
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);
|
|
3186
3473
|
if (ret[2]) {
|
|
3187
3474
|
throw takeFromExternrefTable0(ret[1]);
|
|
3188
3475
|
}
|
|
@@ -3210,7 +3497,7 @@ export class BrepKernel {
|
|
|
3210
3497
|
* Create a closed polygon wire from flat coordinates.
|
|
3211
3498
|
*
|
|
3212
3499
|
* Returns a wire handle.
|
|
3213
|
-
* @param {Float64Array} coords
|
|
3500
|
+
* @param {Float64Array | number[]} coords
|
|
3214
3501
|
* @returns {number}
|
|
3215
3502
|
*/
|
|
3216
3503
|
makePolygonWire(coords) {
|
|
@@ -3232,7 +3519,7 @@ export class BrepKernel {
|
|
|
3232
3519
|
*
|
|
3233
3520
|
* Returns an error if `coords` length is not a multiple of 3,
|
|
3234
3521
|
* fewer than 3 points are provided, or the face normal is degenerate.
|
|
3235
|
-
* @param {Float64Array} coords
|
|
3522
|
+
* @param {Float64Array | number[]} coords
|
|
3236
3523
|
* @returns {number}
|
|
3237
3524
|
*/
|
|
3238
3525
|
makePolygon(coords) {
|
|
@@ -3284,7 +3571,7 @@ export class BrepKernel {
|
|
|
3284
3571
|
*
|
|
3285
3572
|
* Alias for `sewFaces` with a default tolerance. This is the equivalent
|
|
3286
3573
|
* of sewing faces into a closed shell and building a solid.
|
|
3287
|
-
* @param {Uint32Array} face_handles
|
|
3574
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3288
3575
|
* @returns {number}
|
|
3289
3576
|
*/
|
|
3290
3577
|
makeSolid(face_handles) {
|
|
@@ -3381,14 +3668,46 @@ export class BrepKernel {
|
|
|
3381
3668
|
* Create a closed wire from an ordered array of edge handles.
|
|
3382
3669
|
*
|
|
3383
3670
|
* Returns a wire handle (`u32`).
|
|
3384
|
-
* @param {Uint32Array} edge_handles
|
|
3671
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
3385
3672
|
* @param {boolean} closed
|
|
3386
3673
|
* @returns {number}
|
|
3387
3674
|
*/
|
|
3388
3675
|
makeWire(edge_handles, closed) {
|
|
3676
|
+
const val2 = +closed;
|
|
3389
3677
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
3390
3678
|
const len0 = WASM_VECTOR_LEN;
|
|
3391
|
-
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);
|
|
3392
3711
|
if (ret[2]) {
|
|
3393
3712
|
throw takeFromExternrefTable0(ret[1]);
|
|
3394
3713
|
}
|
|
@@ -3450,26 +3769,37 @@ export class BrepKernel {
|
|
|
3450
3769
|
* Perform a mesh boolean on raw triangle data.
|
|
3451
3770
|
*
|
|
3452
3771
|
* Returns a `JsMesh` with the result.
|
|
3453
|
-
* @param {Float64Array} positions_a
|
|
3454
|
-
* @param {Uint32Array} indices_a
|
|
3455
|
-
* @param {Float64Array} positions_b
|
|
3456
|
-
* @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
|
|
3457
3776
|
* @param {string} op
|
|
3458
3777
|
* @param {number} tolerance
|
|
3459
3778
|
* @returns {JsMesh}
|
|
3460
3779
|
*/
|
|
3461
3780
|
meshBoolean(positions_a, indices_a, positions_b, indices_b, op, tolerance) {
|
|
3462
|
-
const
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
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);
|
|
3473
3803
|
if (ret[2]) {
|
|
3474
3804
|
throw takeFromExternrefTable0(ret[1]);
|
|
3475
3805
|
}
|
|
@@ -3590,27 +3920,39 @@ export class BrepKernel {
|
|
|
3590
3920
|
*
|
|
3591
3921
|
* Returns an error for fewer than two sections, mismatched array lengths, a
|
|
3592
3922
|
* non-finite or out-of-range value, a non-planar profile, or loft failure.
|
|
3593
|
-
* @param {Uint32Array} face_handles
|
|
3594
|
-
* @param {Float64Array} params
|
|
3923
|
+
* @param {Uint32Array | number[]} face_handles
|
|
3924
|
+
* @param {Float64Array | number[]} params
|
|
3595
3925
|
* @param {number} spine_degree
|
|
3596
|
-
* @param {Float64Array} spine_knots
|
|
3597
|
-
* @param {Float64Array} spine_control_points
|
|
3598
|
-
* @param {Float64Array} spine_weights
|
|
3926
|
+
* @param {Float64Array | number[]} spine_knots
|
|
3927
|
+
* @param {Float64Array | number[]} spine_control_points
|
|
3928
|
+
* @param {Float64Array | number[]} spine_weights
|
|
3599
3929
|
* @param {boolean} ruled
|
|
3600
3930
|
* @returns {number}
|
|
3601
3931
|
*/
|
|
3602
3932
|
multiSectionSweep(face_handles, params, spine_degree, spine_knots, spine_control_points, spine_weights, ruled) {
|
|
3603
|
-
const
|
|
3604
|
-
const
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
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);
|
|
3614
3956
|
if (ret[2]) {
|
|
3615
3957
|
throw takeFromExternrefTable0(ret[1]);
|
|
3616
3958
|
}
|
|
@@ -3650,21 +3992,23 @@ export class BrepKernel {
|
|
|
3650
3992
|
*
|
|
3651
3993
|
* `coords` is a flat array `[x,y, x,y, ...]` of 2D points.
|
|
3652
3994
|
* Returns a flat array of offset polygon coordinates.
|
|
3653
|
-
* @param {Float64Array} coords
|
|
3995
|
+
* @param {Float64Array | number[]} coords
|
|
3654
3996
|
* @param {number} distance
|
|
3655
3997
|
* @param {number} tolerance
|
|
3656
3998
|
* @returns {Float64Array}
|
|
3657
3999
|
*/
|
|
3658
4000
|
offsetPolygon2d(coords, distance, tolerance) {
|
|
4001
|
+
const val2 = +distance;
|
|
4002
|
+
const val3 = +tolerance;
|
|
3659
4003
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
3660
4004
|
const len0 = WASM_VECTOR_LEN;
|
|
3661
|
-
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4005
|
+
const ret = wasm.brepkernel_offsetPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3662
4006
|
if (ret[3]) {
|
|
3663
4007
|
throw takeFromExternrefTable0(ret[2]);
|
|
3664
4008
|
}
|
|
3665
|
-
var
|
|
4009
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
3666
4010
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3667
|
-
return
|
|
4011
|
+
return v4;
|
|
3668
4012
|
}
|
|
3669
4013
|
/**
|
|
3670
4014
|
* Offset all faces of a solid outward or inward (V2 pipeline).
|
|
@@ -3728,9 +4072,11 @@ export class BrepKernel {
|
|
|
3728
4072
|
* @returns {number}
|
|
3729
4073
|
*/
|
|
3730
4074
|
offsetWire2DWithJoin(wire, distance, join_type) {
|
|
4075
|
+
const val2 = +wire;
|
|
4076
|
+
const val3 = +distance;
|
|
3731
4077
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3732
4078
|
const len0 = WASM_VECTOR_LEN;
|
|
3733
|
-
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr,
|
|
4079
|
+
const ret = wasm.brepkernel_offsetWire2DWithJoin(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3734
4080
|
if (ret[2]) {
|
|
3735
4081
|
throw takeFromExternrefTable0(ret[1]);
|
|
3736
4082
|
}
|
|
@@ -3752,9 +4098,11 @@ export class BrepKernel {
|
|
|
3752
4098
|
* @returns {number}
|
|
3753
4099
|
*/
|
|
3754
4100
|
offsetWireWithJoinType(face, distance, join_type) {
|
|
4101
|
+
const val2 = +face;
|
|
4102
|
+
const val3 = +distance;
|
|
3755
4103
|
const ptr0 = passStringToWasm0(join_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3756
4104
|
const len0 = WASM_VECTOR_LEN;
|
|
3757
|
-
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr,
|
|
4105
|
+
const ret = wasm.brepkernel_offsetWireWithJoinType(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
3758
4106
|
if (ret[2]) {
|
|
3759
4107
|
throw takeFromExternrefTable0(ret[1]);
|
|
3760
4108
|
}
|
|
@@ -3785,19 +4133,29 @@ export class BrepKernel {
|
|
|
3785
4133
|
* Returns an error if the face or path is invalid.
|
|
3786
4134
|
* @param {number} face
|
|
3787
4135
|
* @param {number} path_degree
|
|
3788
|
-
* @param {Float64Array} path_knots
|
|
3789
|
-
* @param {Float64Array} path_control_points
|
|
3790
|
-
* @param {Float64Array} path_weights
|
|
4136
|
+
* @param {Float64Array | number[]} path_knots
|
|
4137
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4138
|
+
* @param {Float64Array | number[]} path_weights
|
|
3791
4139
|
* @returns {number}
|
|
3792
4140
|
*/
|
|
3793
4141
|
pipe(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
3794
|
-
const
|
|
3795
|
-
const
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
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);
|
|
3801
4159
|
if (ret[2]) {
|
|
3802
4160
|
throw takeFromExternrefTable0(ret[1]);
|
|
3803
4161
|
}
|
|
@@ -3808,15 +4166,17 @@ export class BrepKernel {
|
|
|
3808
4166
|
*
|
|
3809
4167
|
* `polygon_coords` is a flat array `[x,y, x,y, ...]`.
|
|
3810
4168
|
* Returns `true` if the point is inside the polygon (winding number test).
|
|
3811
|
-
* @param {Float64Array} polygon_coords
|
|
4169
|
+
* @param {Float64Array | number[]} polygon_coords
|
|
3812
4170
|
* @param {number} px
|
|
3813
4171
|
* @param {number} py
|
|
3814
4172
|
* @returns {boolean}
|
|
3815
4173
|
*/
|
|
3816
4174
|
pointInPolygon2d(polygon_coords, px, py) {
|
|
4175
|
+
const val2 = +px;
|
|
4176
|
+
const val3 = +py;
|
|
3817
4177
|
const ptr0 = passArrayF64ToWasm0(polygon_coords, wasm.__wbindgen_malloc);
|
|
3818
4178
|
const len0 = WASM_VECTOR_LEN;
|
|
3819
|
-
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0,
|
|
4179
|
+
const ret = wasm.brepkernel_pointInPolygon2d(this.__wbg_ptr, ptr0, len0, val2, val3);
|
|
3820
4180
|
if (ret[2]) {
|
|
3821
4181
|
throw takeFromExternrefTable0(ret[1]);
|
|
3822
4182
|
}
|
|
@@ -3897,15 +4257,22 @@ export class BrepKernel {
|
|
|
3897
4257
|
* Both polygons are flat arrays `[x,y, x,y, ...]`.
|
|
3898
4258
|
* Returns `true` if any vertex of one polygon is inside the other
|
|
3899
4259
|
* or if any edges cross.
|
|
3900
|
-
* @param {Float64Array} coords_a
|
|
3901
|
-
* @param {Float64Array} coords_b
|
|
4260
|
+
* @param {Float64Array | number[]} coords_a
|
|
4261
|
+
* @param {Float64Array | number[]} coords_b
|
|
3902
4262
|
* @returns {boolean}
|
|
3903
4263
|
*/
|
|
3904
4264
|
polygonsIntersect2d(coords_a, coords_b) {
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
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
|
+
}
|
|
3909
4276
|
const ret = wasm.brepkernel_polygonsIntersect2d(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
3910
4277
|
if (ret[2]) {
|
|
3911
4278
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -3973,7 +4340,7 @@ export class BrepKernel {
|
|
|
3973
4340
|
*
|
|
3974
4341
|
* Returns an error for an empty list, an invalid handle, a non-positive
|
|
3975
4342
|
* `deflection`, or a degenerate `dir`/`x_axis`.
|
|
3976
|
-
* @param {Uint32Array} solids
|
|
4343
|
+
* @param {Uint32Array | number[]} solids
|
|
3977
4344
|
* @param {number} origin_x
|
|
3978
4345
|
* @param {number} origin_y
|
|
3979
4346
|
* @param {number} origin_z
|
|
@@ -3988,9 +4355,20 @@ export class BrepKernel {
|
|
|
3988
4355
|
* @returns {any}
|
|
3989
4356
|
*/
|
|
3990
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;
|
|
3991
4369
|
const ptr0 = passArray32ToWasm0(solids, wasm.__wbindgen_malloc);
|
|
3992
4370
|
const len0 = WASM_VECTOR_LEN;
|
|
3993
|
-
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);
|
|
3994
4372
|
if (ret[2]) {
|
|
3995
4373
|
throw takeFromExternrefTable0(ret[1]);
|
|
3996
4374
|
}
|
|
@@ -4227,14 +4605,15 @@ export class BrepKernel {
|
|
|
4227
4605
|
* # Errors
|
|
4228
4606
|
*
|
|
4229
4607
|
* Returns an error if fewer than 2 faces or sewing fails.
|
|
4230
|
-
* @param {Uint32Array} face_handles
|
|
4608
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4231
4609
|
* @param {number} tolerance
|
|
4232
4610
|
* @returns {number}
|
|
4233
4611
|
*/
|
|
4234
4612
|
sewFaces(face_handles, tolerance) {
|
|
4613
|
+
const val2 = +tolerance;
|
|
4235
4614
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4236
4615
|
const len0 = WASM_VECTOR_LEN;
|
|
4237
|
-
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0,
|
|
4616
|
+
const ret = wasm.brepkernel_sewFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
4238
4617
|
if (ret[2]) {
|
|
4239
4618
|
throw takeFromExternrefTable0(ret[1]);
|
|
4240
4619
|
}
|
|
@@ -4268,13 +4647,15 @@ export class BrepKernel {
|
|
|
4268
4647
|
* Returns an error if thickness is non-positive or the solid is invalid.
|
|
4269
4648
|
* @param {number} solid
|
|
4270
4649
|
* @param {number} thickness
|
|
4271
|
-
* @param {Uint32Array} open_faces
|
|
4650
|
+
* @param {Uint32Array | number[]} open_faces
|
|
4272
4651
|
* @returns {number}
|
|
4273
4652
|
*/
|
|
4274
4653
|
shell(solid, thickness, open_faces) {
|
|
4654
|
+
const val2 = +solid;
|
|
4655
|
+
const val3 = +thickness;
|
|
4275
4656
|
const ptr0 = passArray32ToWasm0(open_faces, wasm.__wbindgen_malloc);
|
|
4276
4657
|
const len0 = WASM_VECTOR_LEN;
|
|
4277
|
-
const ret = wasm.brepkernel_shell(this.__wbg_ptr,
|
|
4658
|
+
const ret = wasm.brepkernel_shell(this.__wbg_ptr, val2, val3, ptr0, len0);
|
|
4278
4659
|
if (ret[2]) {
|
|
4279
4660
|
throw takeFromExternrefTable0(ret[1]);
|
|
4280
4661
|
}
|
|
@@ -4323,9 +4704,10 @@ export class BrepKernel {
|
|
|
4323
4704
|
* @param {string} json
|
|
4324
4705
|
*/
|
|
4325
4706
|
sketchAddConstraint(sketch, json) {
|
|
4707
|
+
const val2 = +sketch;
|
|
4326
4708
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
4327
4709
|
const len0 = WASM_VECTOR_LEN;
|
|
4328
|
-
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr,
|
|
4710
|
+
const ret = wasm.brepkernel_sketchAddConstraint(this.__wbg_ptr, val2, ptr0, len0);
|
|
4329
4711
|
if (ret[1]) {
|
|
4330
4712
|
throw takeFromExternrefTable0(ret[0]);
|
|
4331
4713
|
}
|
|
@@ -4446,6 +4828,34 @@ export class BrepKernel {
|
|
|
4446
4828
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
4447
4829
|
return v1;
|
|
4448
4830
|
}
|
|
4831
|
+
/**
|
|
4832
|
+
* A solid in the pieces the given faces separate it into. A face that
|
|
4833
|
+
* walls nothing off imprints instead, so a face that only dips in returns
|
|
4834
|
+
* one solid.
|
|
4835
|
+
*
|
|
4836
|
+
* Returns solid handles.
|
|
4837
|
+
*
|
|
4838
|
+
* # Errors
|
|
4839
|
+
*
|
|
4840
|
+
* Returns an error if a handle does not resolve, a face cannot be split
|
|
4841
|
+
* along its marks, or the pieces would not be valid solids summing to the
|
|
4842
|
+
* solid's volume.
|
|
4843
|
+
* @param {number} solid
|
|
4844
|
+
* @param {Uint32Array | number[]} face_handles
|
|
4845
|
+
* @returns {Uint32Array}
|
|
4846
|
+
*/
|
|
4847
|
+
splitByFaces(solid, face_handles) {
|
|
4848
|
+
const val2 = +solid;
|
|
4849
|
+
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
4850
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4851
|
+
const ret = wasm.brepkernel_splitByFaces(this.__wbg_ptr, val2, ptr0, len0);
|
|
4852
|
+
if (ret[3]) {
|
|
4853
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
4854
|
+
}
|
|
4855
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
4856
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
4857
|
+
return v3;
|
|
4858
|
+
}
|
|
4449
4859
|
/**
|
|
4450
4860
|
* Split a solid into two halves along a plane.
|
|
4451
4861
|
*
|
|
@@ -4503,13 +4913,14 @@ export class BrepKernel {
|
|
|
4503
4913
|
*
|
|
4504
4914
|
* Returns an error if fewer than 2 edges or the fit fails.
|
|
4505
4915
|
* @param {number} face
|
|
4506
|
-
* @param {Uint32Array} edge_handles
|
|
4916
|
+
* @param {Uint32Array | number[]} edge_handles
|
|
4507
4917
|
* @returns {number}
|
|
4508
4918
|
*/
|
|
4509
4919
|
sweepAlongEdges(face, edge_handles) {
|
|
4920
|
+
const val2 = +face;
|
|
4510
4921
|
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
4511
4922
|
const len0 = WASM_VECTOR_LEN;
|
|
4512
|
-
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr,
|
|
4923
|
+
const ret = wasm.brepkernel_sweepAlongEdges(this.__wbg_ptr, val2, ptr0, len0);
|
|
4513
4924
|
if (ret[2]) {
|
|
4514
4925
|
throw takeFromExternrefTable0(ret[1]);
|
|
4515
4926
|
}
|
|
@@ -4529,19 +4940,29 @@ export class BrepKernel {
|
|
|
4529
4940
|
* Returns an error if the face or path is invalid, or surface fitting fails.
|
|
4530
4941
|
* @param {number} face
|
|
4531
4942
|
* @param {number} path_degree
|
|
4532
|
-
* @param {Float64Array} path_knots
|
|
4533
|
-
* @param {Float64Array} path_control_points
|
|
4534
|
-
* @param {Float64Array} path_weights
|
|
4943
|
+
* @param {Float64Array | number[]} path_knots
|
|
4944
|
+
* @param {Float64Array | number[]} path_control_points
|
|
4945
|
+
* @param {Float64Array | number[]} path_weights
|
|
4535
4946
|
* @returns {number}
|
|
4536
4947
|
*/
|
|
4537
4948
|
sweepSmooth(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4538
|
-
const
|
|
4539
|
-
const
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
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);
|
|
4545
4966
|
if (ret[2]) {
|
|
4546
4967
|
throw takeFromExternrefTable0(ret[1]);
|
|
4547
4968
|
}
|
|
@@ -4560,13 +4981,14 @@ export class BrepKernel {
|
|
|
4560
4981
|
* Returns an error if a handle is invalid, the chain has no edges, breaks,
|
|
4561
4982
|
* closes or has a kink, or the wire is closed.
|
|
4562
4983
|
* @param {number} wire
|
|
4563
|
-
* @param {Uint32Array} path_edges
|
|
4984
|
+
* @param {Uint32Array | number[]} path_edges
|
|
4564
4985
|
* @returns {number}
|
|
4565
4986
|
*/
|
|
4566
4987
|
sweepWire(wire, path_edges) {
|
|
4988
|
+
const val2 = +wire;
|
|
4567
4989
|
const ptr0 = passArray32ToWasm0(path_edges, wasm.__wbindgen_malloc);
|
|
4568
4990
|
const len0 = WASM_VECTOR_LEN;
|
|
4569
|
-
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr,
|
|
4991
|
+
const ret = wasm.brepkernel_sweepWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4570
4992
|
if (ret[2]) {
|
|
4571
4993
|
throw takeFromExternrefTable0(ret[1]);
|
|
4572
4994
|
}
|
|
@@ -4582,19 +5004,30 @@ export class BrepKernel {
|
|
|
4582
5004
|
* @param {number} profile
|
|
4583
5005
|
* @param {number} path_edge
|
|
4584
5006
|
* @param {string} contact_mode
|
|
4585
|
-
* @param {Float64Array} scale_values
|
|
5007
|
+
* @param {Float64Array | number[]} scale_values
|
|
4586
5008
|
* @param {number} segments
|
|
4587
5009
|
* @param {string} corner_mode
|
|
4588
5010
|
* @returns {number}
|
|
4589
5011
|
*/
|
|
4590
5012
|
sweepWithOptions(profile, path_edge, contact_mode, scale_values, segments, corner_mode) {
|
|
4591
|
-
const
|
|
4592
|
-
const
|
|
4593
|
-
const
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
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);
|
|
4598
5031
|
if (ret[2]) {
|
|
4599
5032
|
throw takeFromExternrefTable0(ret[1]);
|
|
4600
5033
|
}
|
|
@@ -4617,19 +5050,29 @@ export class BrepKernel {
|
|
|
4617
5050
|
* inconsistent lengths, or the sweep operation fails.
|
|
4618
5051
|
* @param {number} face
|
|
4619
5052
|
* @param {number} path_degree
|
|
4620
|
-
* @param {Float64Array} path_knots
|
|
4621
|
-
* @param {Float64Array} path_control_points
|
|
4622
|
-
* @param {Float64Array} path_weights
|
|
5053
|
+
* @param {Float64Array | number[]} path_knots
|
|
5054
|
+
* @param {Float64Array | number[]} path_control_points
|
|
5055
|
+
* @param {Float64Array | number[]} path_weights
|
|
4623
5056
|
* @returns {number}
|
|
4624
5057
|
*/
|
|
4625
5058
|
sweep(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4626
|
-
const
|
|
4627
|
-
const
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
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);
|
|
4633
5076
|
if (ret[2]) {
|
|
4634
5077
|
throw takeFromExternrefTable0(ret[1]);
|
|
4635
5078
|
}
|
|
@@ -4830,12 +5273,13 @@ export class BrepKernel {
|
|
|
4830
5273
|
* Returns an error if the face handle is invalid, the matrix doesn't
|
|
4831
5274
|
* have 16 elements, or the matrix is singular.
|
|
4832
5275
|
* @param {number} face
|
|
4833
|
-
* @param {Float64Array} matrix
|
|
5276
|
+
* @param {Float64Array | number[]} matrix
|
|
4834
5277
|
*/
|
|
4835
5278
|
transformFace(face, matrix) {
|
|
5279
|
+
const val2 = +face;
|
|
4836
5280
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4837
5281
|
const len0 = WASM_VECTOR_LEN;
|
|
4838
|
-
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr,
|
|
5282
|
+
const ret = wasm.brepkernel_transformFace(this.__wbg_ptr, val2, ptr0, len0);
|
|
4839
5283
|
if (ret[1]) {
|
|
4840
5284
|
throw takeFromExternrefTable0(ret[0]);
|
|
4841
5285
|
}
|
|
@@ -4850,12 +5294,13 @@ export class BrepKernel {
|
|
|
4850
5294
|
* Returns an error if the solid handle is invalid, the matrix doesn't
|
|
4851
5295
|
* have 16 elements, or the matrix is singular.
|
|
4852
5296
|
* @param {number} solid
|
|
4853
|
-
* @param {Float64Array} matrix
|
|
5297
|
+
* @param {Float64Array | number[]} matrix
|
|
4854
5298
|
*/
|
|
4855
5299
|
transformSolid(solid, matrix) {
|
|
5300
|
+
const val2 = +solid;
|
|
4856
5301
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4857
5302
|
const len0 = WASM_VECTOR_LEN;
|
|
4858
|
-
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr,
|
|
5303
|
+
const ret = wasm.brepkernel_transformSolid(this.__wbg_ptr, val2, ptr0, len0);
|
|
4859
5304
|
if (ret[1]) {
|
|
4860
5305
|
throw takeFromExternrefTable0(ret[0]);
|
|
4861
5306
|
}
|
|
@@ -4870,12 +5315,13 @@ export class BrepKernel {
|
|
|
4870
5315
|
* Returns an error if the wire handle is invalid, the matrix doesn't
|
|
4871
5316
|
* have 16 elements, or the matrix is singular.
|
|
4872
5317
|
* @param {number} wire
|
|
4873
|
-
* @param {Float64Array} matrix
|
|
5318
|
+
* @param {Float64Array | number[]} matrix
|
|
4874
5319
|
*/
|
|
4875
5320
|
transformWire(wire, matrix) {
|
|
5321
|
+
const val2 = +wire;
|
|
4876
5322
|
const ptr0 = passArrayF64ToWasm0(matrix, wasm.__wbindgen_malloc);
|
|
4877
5323
|
const len0 = WASM_VECTOR_LEN;
|
|
4878
|
-
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr,
|
|
5324
|
+
const ret = wasm.brepkernel_transformWire(this.__wbg_ptr, val2, ptr0, len0);
|
|
4879
5325
|
if (ret[1]) {
|
|
4880
5326
|
throw takeFromExternrefTable0(ret[0]);
|
|
4881
5327
|
}
|
|
@@ -4999,14 +5445,15 @@ export class BrepKernel {
|
|
|
4999
5445
|
*
|
|
5000
5446
|
* Accepts an array of face handles from potentially different shells.
|
|
5001
5447
|
* Sews all faces together into a single solid.
|
|
5002
|
-
* @param {Uint32Array} face_handles
|
|
5448
|
+
* @param {Uint32Array | number[]} face_handles
|
|
5003
5449
|
* @param {number} tolerance
|
|
5004
5450
|
* @returns {number}
|
|
5005
5451
|
*/
|
|
5006
5452
|
weldShellsAndFaces(face_handles, tolerance) {
|
|
5453
|
+
const val2 = +tolerance;
|
|
5007
5454
|
const ptr0 = passArray32ToWasm0(face_handles, wasm.__wbindgen_malloc);
|
|
5008
5455
|
const len0 = WASM_VECTOR_LEN;
|
|
5009
|
-
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0,
|
|
5456
|
+
const ret = wasm.brepkernel_weldShellsAndFaces(this.__wbg_ptr, ptr0, len0, val2);
|
|
5010
5457
|
if (ret[2]) {
|
|
5011
5458
|
throw takeFromExternrefTable0(ret[1]);
|
|
5012
5459
|
}
|
|
@@ -5464,30 +5911,30 @@ export function setLogLevel(level) {
|
|
|
5464
5911
|
throw takeFromExternrefTable0(ret[0]);
|
|
5465
5912
|
}
|
|
5466
5913
|
}
|
|
5467
|
-
export function
|
|
5914
|
+
export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
|
|
5468
5915
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5469
5916
|
return ret;
|
|
5470
5917
|
}
|
|
5471
|
-
export function
|
|
5918
|
+
export function __wbg___wbindgen_debug_string_f249a2a76caa9a55(arg0, arg1) {
|
|
5472
5919
|
const ret = debugString(arg1);
|
|
5473
5920
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5474
5921
|
const len1 = WASM_VECTOR_LEN;
|
|
5475
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5476
|
-
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);
|
|
5477
5924
|
}
|
|
5478
|
-
export function
|
|
5925
|
+
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
5479
5926
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
5480
5927
|
}
|
|
5481
|
-
export function
|
|
5928
|
+
export function __wbg_error_b693e3f4fbf3e888(arg0, arg1) {
|
|
5482
5929
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
5483
5930
|
}
|
|
5484
|
-
export function
|
|
5931
|
+
export function __wbg_getRandomValues_8b6f1f663e6f188d() { return handleError(function (arg0, arg1) {
|
|
5485
5932
|
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
5486
5933
|
}, arguments); }
|
|
5487
|
-
export function
|
|
5934
|
+
export function __wbg_log_85d5c5732049ef45(arg0, arg1) {
|
|
5488
5935
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5489
5936
|
}
|
|
5490
|
-
export function
|
|
5937
|
+
export function __wbg_warn_bc26df775fd739d9(arg0, arg1) {
|
|
5491
5938
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
5492
5939
|
}
|
|
5493
5940
|
export function __wbindgen_generic_0000000000000001(arg0, arg1) {
|
|
@@ -5497,12 +5944,11 @@ export function __wbindgen_generic_0000000000000001(arg0, arg1) {
|
|
|
5497
5944
|
}
|
|
5498
5945
|
export function __wbindgen_init_externref_table() {
|
|
5499
5946
|
const table = wasm.__wbindgen_externrefs;
|
|
5500
|
-
const offset = table.grow(4);
|
|
5501
5947
|
table.set(0, undefined);
|
|
5502
|
-
table.set(
|
|
5503
|
-
table.set(
|
|
5504
|
-
table.set(
|
|
5505
|
-
table.set(
|
|
5948
|
+
table.set(1024, undefined);
|
|
5949
|
+
table.set(1025, null);
|
|
5950
|
+
table.set(1026, true);
|
|
5951
|
+
table.set(1027, false);
|
|
5506
5952
|
}
|
|
5507
5953
|
const BrepKernelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
5508
5954
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -5530,68 +5976,61 @@ function addToExternrefTable0(obj) {
|
|
|
5530
5976
|
}
|
|
5531
5977
|
|
|
5532
5978
|
function debugString(val) {
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
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
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
5585
|
-
} catch (_) {
|
|
5586
|
-
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;
|
|
5587
6030
|
}
|
|
6031
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
6032
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
5588
6033
|
}
|
|
5589
|
-
// errors
|
|
5590
|
-
if (val instanceof Error) {
|
|
5591
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
5592
|
-
}
|
|
5593
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
5594
|
-
return className;
|
|
5595
6034
|
}
|
|
5596
6035
|
|
|
5597
6036
|
function getArrayF32FromWasm0(ptr, len) {
|
|
@@ -5639,7 +6078,8 @@ function getFloat64ArrayMemory0() {
|
|
|
5639
6078
|
}
|
|
5640
6079
|
|
|
5641
6080
|
function getStringFromWasm0(ptr, len) {
|
|
5642
|
-
|
|
6081
|
+
ptr = ptr >>> 0;
|
|
6082
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
5643
6083
|
}
|
|
5644
6084
|
|
|
5645
6085
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -5735,18 +6175,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
5735
6175
|
return value;
|
|
5736
6176
|
}
|
|
5737
6177
|
|
|
5738
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
6178
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
5739
6179
|
cachedTextDecoder.decode();
|
|
5740
6180
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
5741
6181
|
let numBytesDecoded = 0;
|
|
5742
|
-
function decodeText(
|
|
5743
|
-
numBytesDecoded +=
|
|
6182
|
+
function decodeText(bytes) {
|
|
6183
|
+
numBytesDecoded += bytes.length;
|
|
5744
6184
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
5745
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
6185
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
5746
6186
|
cachedTextDecoder.decode();
|
|
5747
|
-
numBytesDecoded =
|
|
6187
|
+
numBytesDecoded = bytes.length;
|
|
5748
6188
|
}
|
|
5749
|
-
return cachedTextDecoder.decode(
|
|
6189
|
+
return cachedTextDecoder.decode(bytes);
|
|
5750
6190
|
}
|
|
5751
6191
|
|
|
5752
6192
|
const cachedTextEncoder = new TextEncoder();
|