brepkit-wasm 3.3.9 → 3.4.1
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 +217 -216
- package/brepkit_wasm_bg.js +411 -410
- package/brepkit_wasm_bg.wasm +0 -0
- package/brepkit_wasm_node.cjs +411 -410
- package/package.json +1 -1
package/brepkit_wasm_node.cjs
CHANGED
|
@@ -53,38 +53,38 @@ class BrepKernel {
|
|
|
53
53
|
return v1;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Approximate a curve through points (
|
|
56
|
+
* Approximate a curve through points using LSPIA (progressive iteration).
|
|
57
57
|
*
|
|
58
58
|
* Returns an edge handle.
|
|
59
59
|
* @param {Float64Array} coords
|
|
60
60
|
* @param {number} degree
|
|
61
61
|
* @param {number} num_control_points
|
|
62
|
+
* @param {number} tolerance
|
|
63
|
+
* @param {number} max_iterations
|
|
62
64
|
* @returns {number}
|
|
63
65
|
*/
|
|
64
|
-
|
|
66
|
+
approximateCurveLspia(coords, degree, num_control_points, tolerance, max_iterations) {
|
|
65
67
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
66
68
|
const len0 = WASM_VECTOR_LEN;
|
|
67
|
-
const ret = wasm.
|
|
69
|
+
const ret = wasm.brepkernel_approximateCurveLspia(this.__wbg_ptr, ptr0, len0, degree, num_control_points, tolerance, max_iterations);
|
|
68
70
|
if (ret[2]) {
|
|
69
71
|
throw takeFromExternrefTable0(ret[1]);
|
|
70
72
|
}
|
|
71
73
|
return ret[0] >>> 0;
|
|
72
74
|
}
|
|
73
75
|
/**
|
|
74
|
-
* Approximate a curve through points
|
|
76
|
+
* Approximate a curve through points (least-squares).
|
|
75
77
|
*
|
|
76
78
|
* Returns an edge handle.
|
|
77
79
|
* @param {Float64Array} coords
|
|
78
80
|
* @param {number} degree
|
|
79
81
|
* @param {number} num_control_points
|
|
80
|
-
* @param {number} tolerance
|
|
81
|
-
* @param {number} max_iterations
|
|
82
82
|
* @returns {number}
|
|
83
83
|
*/
|
|
84
|
-
|
|
84
|
+
approximateCurve(coords, degree, num_control_points) {
|
|
85
85
|
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
86
86
|
const len0 = WASM_VECTOR_LEN;
|
|
87
|
-
const ret = wasm.
|
|
87
|
+
const ret = wasm.brepkernel_approximateCurve(this.__wbg_ptr, ptr0, len0, degree, num_control_points);
|
|
88
88
|
if (ret[2]) {
|
|
89
89
|
throw takeFromExternrefTable0(ret[1]);
|
|
90
90
|
}
|
|
@@ -259,28 +259,6 @@ class BrepKernel {
|
|
|
259
259
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
260
260
|
return v1;
|
|
261
261
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Chamfer edges of a solid.
|
|
264
|
-
*
|
|
265
|
-
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
266
|
-
*
|
|
267
|
-
* # Errors
|
|
268
|
-
*
|
|
269
|
-
* Returns an error if distance is non-positive or edges are invalid.
|
|
270
|
-
* @param {number} solid
|
|
271
|
-
* @param {Uint32Array} edge_handles
|
|
272
|
-
* @param {number} distance
|
|
273
|
-
* @returns {number}
|
|
274
|
-
*/
|
|
275
|
-
chamfer(solid, edge_handles, distance) {
|
|
276
|
-
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
277
|
-
const len0 = WASM_VECTOR_LEN;
|
|
278
|
-
const ret = wasm.brepkernel_chamfer(this.__wbg_ptr, solid, ptr0, len0, distance);
|
|
279
|
-
if (ret[2]) {
|
|
280
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
281
|
-
}
|
|
282
|
-
return ret[0] >>> 0;
|
|
283
|
-
}
|
|
284
262
|
/**
|
|
285
263
|
* Cut corners of a 2D polygon with flat bevels.
|
|
286
264
|
*
|
|
@@ -351,18 +329,26 @@ class BrepKernel {
|
|
|
351
329
|
return ret[0] >>> 0;
|
|
352
330
|
}
|
|
353
331
|
/**
|
|
354
|
-
*
|
|
332
|
+
* Chamfer edges of a solid.
|
|
355
333
|
*
|
|
356
|
-
*
|
|
357
|
-
* `restore` or `discardCheckpoint`.
|
|
334
|
+
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
358
335
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
336
|
+
* # Errors
|
|
337
|
+
*
|
|
338
|
+
* Returns an error if distance is non-positive or edges are invalid.
|
|
339
|
+
* @param {number} solid
|
|
340
|
+
* @param {Uint32Array} edge_handles
|
|
341
|
+
* @param {number} distance
|
|
361
342
|
* @returns {number}
|
|
362
343
|
*/
|
|
363
|
-
|
|
364
|
-
const
|
|
365
|
-
|
|
344
|
+
chamfer(solid, edge_handles, distance) {
|
|
345
|
+
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
346
|
+
const len0 = WASM_VECTOR_LEN;
|
|
347
|
+
const ret = wasm.brepkernel_chamfer(this.__wbg_ptr, solid, ptr0, len0, distance);
|
|
348
|
+
if (ret[2]) {
|
|
349
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
350
|
+
}
|
|
351
|
+
return ret[0] >>> 0;
|
|
366
352
|
}
|
|
367
353
|
/**
|
|
368
354
|
* Returns the number of saved checkpoints.
|
|
@@ -372,6 +358,20 @@ class BrepKernel {
|
|
|
372
358
|
const ret = wasm.brepkernel_checkpointCount(this.__wbg_ptr);
|
|
373
359
|
return ret >>> 0;
|
|
374
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Save a snapshot of the current kernel state.
|
|
363
|
+
*
|
|
364
|
+
* Returns a checkpoint ID (zero-based index) that can be passed to
|
|
365
|
+
* `restore` or `discardCheckpoint`.
|
|
366
|
+
*
|
|
367
|
+
* The snapshot is a clone of all topology, assembly, and sketch state.
|
|
368
|
+
* Existing entity handles remain valid after restore.
|
|
369
|
+
* @returns {number}
|
|
370
|
+
*/
|
|
371
|
+
checkpoint() {
|
|
372
|
+
const ret = wasm.brepkernel_checkpoint(this.__wbg_ptr);
|
|
373
|
+
return ret >>> 0;
|
|
374
|
+
}
|
|
375
375
|
/**
|
|
376
376
|
* Create a circular pattern of a solid around an axis.
|
|
377
377
|
*
|
|
@@ -391,13 +391,9 @@ class BrepKernel {
|
|
|
391
391
|
return ret[0] >>> 0;
|
|
392
392
|
}
|
|
393
393
|
/**
|
|
394
|
-
* Classify a point
|
|
395
|
-
*
|
|
396
|
-
* Returns `"inside"`, `"outside"`, or `"boundary"`.
|
|
397
|
-
*
|
|
398
|
-
* # Errors
|
|
394
|
+
* Classify a point using robust dual-method (winding + ray casting).
|
|
399
395
|
*
|
|
400
|
-
* Returns
|
|
396
|
+
* Returns "inside", "outside", or "boundary".
|
|
401
397
|
* @param {number} solid
|
|
402
398
|
* @param {number} x
|
|
403
399
|
* @param {number} y
|
|
@@ -405,11 +401,11 @@ class BrepKernel {
|
|
|
405
401
|
* @param {number} tolerance
|
|
406
402
|
* @returns {string}
|
|
407
403
|
*/
|
|
408
|
-
|
|
404
|
+
classifyPointRobust(solid, x, y, z, tolerance) {
|
|
409
405
|
let deferred2_0;
|
|
410
406
|
let deferred2_1;
|
|
411
407
|
try {
|
|
412
|
-
const ret = wasm.
|
|
408
|
+
const ret = wasm.brepkernel_classifyPointRobust(this.__wbg_ptr, solid, x, y, z, tolerance);
|
|
413
409
|
var ptr1 = ret[0];
|
|
414
410
|
var len1 = ret[1];
|
|
415
411
|
if (ret[3]) {
|
|
@@ -424,7 +420,7 @@ class BrepKernel {
|
|
|
424
420
|
}
|
|
425
421
|
}
|
|
426
422
|
/**
|
|
427
|
-
* Classify a point
|
|
423
|
+
* Classify a point relative to a solid using generalized winding numbers.
|
|
428
424
|
*
|
|
429
425
|
* Returns "inside", "outside", or "boundary".
|
|
430
426
|
* @param {number} solid
|
|
@@ -434,11 +430,11 @@ class BrepKernel {
|
|
|
434
430
|
* @param {number} tolerance
|
|
435
431
|
* @returns {string}
|
|
436
432
|
*/
|
|
437
|
-
|
|
433
|
+
classifyPointWinding(solid, x, y, z, tolerance) {
|
|
438
434
|
let deferred2_0;
|
|
439
435
|
let deferred2_1;
|
|
440
436
|
try {
|
|
441
|
-
const ret = wasm.
|
|
437
|
+
const ret = wasm.brepkernel_classifyPointWinding(this.__wbg_ptr, solid, x, y, z, tolerance);
|
|
442
438
|
var ptr1 = ret[0];
|
|
443
439
|
var len1 = ret[1];
|
|
444
440
|
if (ret[3]) {
|
|
@@ -453,9 +449,13 @@ class BrepKernel {
|
|
|
453
449
|
}
|
|
454
450
|
}
|
|
455
451
|
/**
|
|
456
|
-
* Classify a point relative to a solid
|
|
452
|
+
* Classify a point relative to a solid: inside, outside, or on boundary.
|
|
457
453
|
*
|
|
458
|
-
* Returns "inside"
|
|
454
|
+
* Returns `"inside"`, `"outside"`, or `"boundary"`.
|
|
455
|
+
*
|
|
456
|
+
* # Errors
|
|
457
|
+
*
|
|
458
|
+
* Returns an error if the solid handle is invalid.
|
|
459
459
|
* @param {number} solid
|
|
460
460
|
* @param {number} x
|
|
461
461
|
* @param {number} y
|
|
@@ -463,11 +463,11 @@ class BrepKernel {
|
|
|
463
463
|
* @param {number} tolerance
|
|
464
464
|
* @returns {string}
|
|
465
465
|
*/
|
|
466
|
-
|
|
466
|
+
classifyPoint(solid, x, y, z, tolerance) {
|
|
467
467
|
let deferred2_0;
|
|
468
468
|
let deferred2_1;
|
|
469
469
|
try {
|
|
470
|
-
const ret = wasm.
|
|
470
|
+
const ret = wasm.brepkernel_classifyPoint(this.__wbg_ptr, solid, x, y, z, tolerance);
|
|
471
471
|
var ptr1 = ret[0];
|
|
472
472
|
var len1 = ret[1];
|
|
473
473
|
if (ret[3]) {
|
|
@@ -763,9 +763,9 @@ class BrepKernel {
|
|
|
763
763
|
return v1;
|
|
764
764
|
}
|
|
765
765
|
/**
|
|
766
|
-
* Cut (subtract) solid `b` from solid `a
|
|
766
|
+
* Cut (subtract) solid `b` from solid `a` and return evolution tracking data.
|
|
767
767
|
*
|
|
768
|
-
* Returns a
|
|
768
|
+
* Returns a JSON string: `{"solid": <u32>, "evolution": {...}}`.
|
|
769
769
|
*
|
|
770
770
|
* # Errors
|
|
771
771
|
*
|
|
@@ -773,19 +773,17 @@ class BrepKernel {
|
|
|
773
773
|
* produces an empty or non-manifold result.
|
|
774
774
|
* @param {number} a
|
|
775
775
|
* @param {number} b
|
|
776
|
-
* @returns {
|
|
776
|
+
* @returns {any}
|
|
777
777
|
*/
|
|
778
|
-
|
|
779
|
-
const ret = wasm.
|
|
778
|
+
cutWithEvolution(a, b) {
|
|
779
|
+
const ret = wasm.brepkernel_cutWithEvolution(this.__wbg_ptr, a, b);
|
|
780
780
|
if (ret[2]) {
|
|
781
781
|
throw takeFromExternrefTable0(ret[1]);
|
|
782
782
|
}
|
|
783
|
-
return ret[0]
|
|
783
|
+
return takeFromExternrefTable0(ret[0]);
|
|
784
784
|
}
|
|
785
785
|
/**
|
|
786
|
-
* Cut (subtract) solid `b` from solid `a`
|
|
787
|
-
*
|
|
788
|
-
* Returns a JSON string: `{"solid": <u32>, "evolution": {...}}`.
|
|
786
|
+
* Cut (subtract) solid `b` from solid `a` with post-processing options.
|
|
789
787
|
*
|
|
790
788
|
* # Errors
|
|
791
789
|
*
|
|
@@ -793,17 +791,20 @@ class BrepKernel {
|
|
|
793
791
|
* produces an empty or non-manifold result.
|
|
794
792
|
* @param {number} a
|
|
795
793
|
* @param {number} b
|
|
796
|
-
* @
|
|
794
|
+
* @param {boolean} simplify
|
|
795
|
+
* @returns {number}
|
|
797
796
|
*/
|
|
798
|
-
|
|
799
|
-
const ret = wasm.
|
|
797
|
+
cutWithOptions(a, b, simplify) {
|
|
798
|
+
const ret = wasm.brepkernel_cutWithOptions(this.__wbg_ptr, a, b, simplify);
|
|
800
799
|
if (ret[2]) {
|
|
801
800
|
throw takeFromExternrefTable0(ret[1]);
|
|
802
801
|
}
|
|
803
|
-
return
|
|
802
|
+
return ret[0] >>> 0;
|
|
804
803
|
}
|
|
805
804
|
/**
|
|
806
|
-
* Cut (subtract) solid `b` from solid `a
|
|
805
|
+
* Cut (subtract) solid `b` from solid `a`.
|
|
806
|
+
*
|
|
807
|
+
* Returns a new solid handle (`u32`).
|
|
807
808
|
*
|
|
808
809
|
* # Errors
|
|
809
810
|
*
|
|
@@ -811,11 +812,10 @@ class BrepKernel {
|
|
|
811
812
|
* produces an empty or non-manifold result.
|
|
812
813
|
* @param {number} a
|
|
813
814
|
* @param {number} b
|
|
814
|
-
* @param {boolean} simplify
|
|
815
815
|
* @returns {number}
|
|
816
816
|
*/
|
|
817
|
-
|
|
818
|
-
const ret = wasm.
|
|
817
|
+
cut(a, b) {
|
|
818
|
+
const ret = wasm.brepkernel_cut(this.__wbg_ptr, a, b);
|
|
819
819
|
if (ret[2]) {
|
|
820
820
|
throw takeFromExternrefTable0(ret[1]);
|
|
821
821
|
}
|
|
@@ -1000,15 +1000,15 @@ class BrepKernel {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
/**
|
|
1003
|
-
* Evaluate a point on an edge curve at parameter `t`.
|
|
1003
|
+
* Evaluate a point and tangent on an edge curve at parameter `t`.
|
|
1004
1004
|
*
|
|
1005
|
-
* Returns `[
|
|
1005
|
+
* Returns `[px, py, pz, tx, ty, tz]`.
|
|
1006
1006
|
* @param {number} edge
|
|
1007
1007
|
* @param {number} t
|
|
1008
1008
|
* @returns {Float64Array}
|
|
1009
1009
|
*/
|
|
1010
|
-
|
|
1011
|
-
const ret = wasm.
|
|
1010
|
+
evaluateEdgeCurveD1(edge, t) {
|
|
1011
|
+
const ret = wasm.brepkernel_evaluateEdgeCurveD1(this.__wbg_ptr, edge, t);
|
|
1012
1012
|
if (ret[3]) {
|
|
1013
1013
|
throw takeFromExternrefTable0(ret[2]);
|
|
1014
1014
|
}
|
|
@@ -1017,15 +1017,15 @@ class BrepKernel {
|
|
|
1017
1017
|
return v1;
|
|
1018
1018
|
}
|
|
1019
1019
|
/**
|
|
1020
|
-
* Evaluate a point
|
|
1020
|
+
* Evaluate a point on an edge curve at parameter `t`.
|
|
1021
1021
|
*
|
|
1022
|
-
* Returns `[
|
|
1022
|
+
* Returns `[x, y, z]`.
|
|
1023
1023
|
* @param {number} edge
|
|
1024
1024
|
* @param {number} t
|
|
1025
1025
|
* @returns {Float64Array}
|
|
1026
1026
|
*/
|
|
1027
|
-
|
|
1028
|
-
const ret = wasm.
|
|
1027
|
+
evaluateEdgeCurve(edge, t) {
|
|
1028
|
+
const ret = wasm.brepkernel_evaluateEdgeCurve(this.__wbg_ptr, edge, t);
|
|
1029
1029
|
if (ret[3]) {
|
|
1030
1030
|
throw takeFromExternrefTable0(ret[2]);
|
|
1031
1031
|
}
|
|
@@ -1034,16 +1034,16 @@ class BrepKernel {
|
|
|
1034
1034
|
return v1;
|
|
1035
1035
|
}
|
|
1036
1036
|
/**
|
|
1037
|
-
* Evaluate a
|
|
1037
|
+
* Evaluate a surface normal at (u, v) on a face.
|
|
1038
1038
|
*
|
|
1039
|
-
* Returns `[
|
|
1039
|
+
* Returns `[nx, ny, nz]`.
|
|
1040
1040
|
* @param {number} face
|
|
1041
1041
|
* @param {number} u
|
|
1042
1042
|
* @param {number} v
|
|
1043
1043
|
* @returns {Float64Array}
|
|
1044
1044
|
*/
|
|
1045
|
-
|
|
1046
|
-
const ret = wasm.
|
|
1045
|
+
evaluateSurfaceNormal(face, u, v) {
|
|
1046
|
+
const ret = wasm.brepkernel_evaluateSurfaceNormal(this.__wbg_ptr, face, u, v);
|
|
1047
1047
|
if (ret[3]) {
|
|
1048
1048
|
throw takeFromExternrefTable0(ret[2]);
|
|
1049
1049
|
}
|
|
@@ -1052,16 +1052,16 @@ class BrepKernel {
|
|
|
1052
1052
|
return v1;
|
|
1053
1053
|
}
|
|
1054
1054
|
/**
|
|
1055
|
-
* Evaluate a surface
|
|
1055
|
+
* Evaluate a point on a face surface at (u, v).
|
|
1056
1056
|
*
|
|
1057
|
-
* Returns `[
|
|
1057
|
+
* Returns `[x, y, z]`.
|
|
1058
1058
|
* @param {number} face
|
|
1059
1059
|
* @param {number} u
|
|
1060
1060
|
* @param {number} v
|
|
1061
1061
|
* @returns {Float64Array}
|
|
1062
1062
|
*/
|
|
1063
|
-
|
|
1064
|
-
const ret = wasm.
|
|
1063
|
+
evaluateSurface(face, u, v) {
|
|
1064
|
+
const ret = wasm.brepkernel_evaluateSurface(this.__wbg_ptr, face, u, v);
|
|
1065
1065
|
if (ret[3]) {
|
|
1066
1066
|
throw takeFromExternrefTable0(ret[2]);
|
|
1067
1067
|
}
|
|
@@ -1228,9 +1228,9 @@ class BrepKernel {
|
|
|
1228
1228
|
return v1;
|
|
1229
1229
|
}
|
|
1230
1230
|
/**
|
|
1231
|
-
* Export a solid to
|
|
1231
|
+
* Export a solid to STL ASCII format.
|
|
1232
1232
|
*
|
|
1233
|
-
* Returns
|
|
1233
|
+
* Returns the ASCII STL as UTF-8 bytes.
|
|
1234
1234
|
*
|
|
1235
1235
|
* # Errors
|
|
1236
1236
|
*
|
|
@@ -1239,8 +1239,8 @@ class BrepKernel {
|
|
|
1239
1239
|
* @param {number} deflection
|
|
1240
1240
|
* @returns {Uint8Array}
|
|
1241
1241
|
*/
|
|
1242
|
-
|
|
1243
|
-
const ret = wasm.
|
|
1242
|
+
exportStlAscii(solid, deflection) {
|
|
1243
|
+
const ret = wasm.brepkernel_exportStlAscii(this.__wbg_ptr, solid, deflection);
|
|
1244
1244
|
if (ret[3]) {
|
|
1245
1245
|
throw takeFromExternrefTable0(ret[2]);
|
|
1246
1246
|
}
|
|
@@ -1249,9 +1249,9 @@ class BrepKernel {
|
|
|
1249
1249
|
return v1;
|
|
1250
1250
|
}
|
|
1251
1251
|
/**
|
|
1252
|
-
* Export a solid to STL
|
|
1252
|
+
* Export a solid to binary STL format.
|
|
1253
1253
|
*
|
|
1254
|
-
* Returns
|
|
1254
|
+
* Returns a `Uint8Array` containing the `.stl` file.
|
|
1255
1255
|
*
|
|
1256
1256
|
* # Errors
|
|
1257
1257
|
*
|
|
@@ -1260,8 +1260,8 @@ class BrepKernel {
|
|
|
1260
1260
|
* @param {number} deflection
|
|
1261
1261
|
* @returns {Uint8Array}
|
|
1262
1262
|
*/
|
|
1263
|
-
|
|
1264
|
-
const ret = wasm.
|
|
1263
|
+
exportStl(solid, deflection) {
|
|
1264
|
+
const ret = wasm.brepkernel_exportStl(this.__wbg_ptr, solid, deflection);
|
|
1265
1265
|
if (ret[3]) {
|
|
1266
1266
|
throw takeFromExternrefTable0(ret[2]);
|
|
1267
1267
|
}
|
|
@@ -1361,28 +1361,6 @@ class BrepKernel {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
return ret[0] >>> 0;
|
|
1363
1363
|
}
|
|
1364
|
-
/**
|
|
1365
|
-
* Fillet (round) edges of a solid.
|
|
1366
|
-
*
|
|
1367
|
-
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
1368
|
-
*
|
|
1369
|
-
* # Errors
|
|
1370
|
-
*
|
|
1371
|
-
* Returns an error if radius is non-positive or edges are invalid.
|
|
1372
|
-
* @param {number} solid
|
|
1373
|
-
* @param {Uint32Array} edge_handles
|
|
1374
|
-
* @param {number} radius
|
|
1375
|
-
* @returns {number}
|
|
1376
|
-
*/
|
|
1377
|
-
fillet(solid, edge_handles, radius) {
|
|
1378
|
-
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1379
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1380
|
-
const ret = wasm.brepkernel_fillet(this.__wbg_ptr, solid, ptr0, len0, radius);
|
|
1381
|
-
if (ret[2]) {
|
|
1382
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1383
|
-
}
|
|
1384
|
-
return ret[0] >>> 0;
|
|
1385
|
-
}
|
|
1386
1364
|
/**
|
|
1387
1365
|
* Round corners of a 2D polygon by inserting arc-approximation vertices.
|
|
1388
1366
|
*
|
|
@@ -1476,6 +1454,29 @@ class BrepKernel {
|
|
|
1476
1454
|
}
|
|
1477
1455
|
return takeFromExternrefTable0(ret[0]);
|
|
1478
1456
|
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Fillet (round) edges of a solid.
|
|
1459
|
+
*
|
|
1460
|
+
* `edge_handles` is an array of edge handles. Returns a solid handle.
|
|
1461
|
+
*
|
|
1462
|
+
* # Errors
|
|
1463
|
+
*
|
|
1464
|
+
* Returns an error if radius is non-positive, edges are invalid, or no
|
|
1465
|
+
* fillet engine can produce a valid changed solid.
|
|
1466
|
+
* @param {number} solid
|
|
1467
|
+
* @param {Uint32Array} edge_handles
|
|
1468
|
+
* @param {number} radius
|
|
1469
|
+
* @returns {number}
|
|
1470
|
+
*/
|
|
1471
|
+
fillet(solid, edge_handles, radius) {
|
|
1472
|
+
const ptr0 = passArray32ToWasm0(edge_handles, wasm.__wbindgen_malloc);
|
|
1473
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1474
|
+
const ret = wasm.brepkernel_fillet(this.__wbg_ptr, solid, ptr0, len0, radius);
|
|
1475
|
+
if (ret[2]) {
|
|
1476
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1477
|
+
}
|
|
1478
|
+
return ret[0] >>> 0;
|
|
1479
|
+
}
|
|
1479
1480
|
/**
|
|
1480
1481
|
* Fix face orientations to ensure consistent outward normals.
|
|
1481
1482
|
*
|
|
@@ -1515,26 +1516,6 @@ class BrepKernel {
|
|
|
1515
1516
|
}
|
|
1516
1517
|
return ret[0] >>> 0;
|
|
1517
1518
|
}
|
|
1518
|
-
/**
|
|
1519
|
-
* Fuse (union) two solids into one.
|
|
1520
|
-
*
|
|
1521
|
-
* Returns a new solid handle (`u32`).
|
|
1522
|
-
*
|
|
1523
|
-
* # Errors
|
|
1524
|
-
*
|
|
1525
|
-
* Returns an error if either solid handle is invalid or the operation
|
|
1526
|
-
* produces an empty or non-manifold result.
|
|
1527
|
-
* @param {number} a
|
|
1528
|
-
* @param {number} b
|
|
1529
|
-
* @returns {number}
|
|
1530
|
-
*/
|
|
1531
|
-
fuse(a, b) {
|
|
1532
|
-
const ret = wasm.brepkernel_fuse(this.__wbg_ptr, a, b);
|
|
1533
|
-
if (ret[2]) {
|
|
1534
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
1535
|
-
}
|
|
1536
|
-
return ret[0] >>> 0;
|
|
1537
|
-
}
|
|
1538
1519
|
/**
|
|
1539
1520
|
* Fuse (union) many solids into one in a single call.
|
|
1540
1521
|
*
|
|
@@ -1603,12 +1584,32 @@ class BrepKernel {
|
|
|
1603
1584
|
return ret[0] >>> 0;
|
|
1604
1585
|
}
|
|
1605
1586
|
/**
|
|
1606
|
-
*
|
|
1587
|
+
* Fuse (union) two solids into one.
|
|
1607
1588
|
*
|
|
1608
|
-
* Returns a
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1611
|
-
|
|
1589
|
+
* Returns a new solid handle (`u32`).
|
|
1590
|
+
*
|
|
1591
|
+
* # Errors
|
|
1592
|
+
*
|
|
1593
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
1594
|
+
* produces an empty or non-manifold result.
|
|
1595
|
+
* @param {number} a
|
|
1596
|
+
* @param {number} b
|
|
1597
|
+
* @returns {number}
|
|
1598
|
+
*/
|
|
1599
|
+
fuse(a, b) {
|
|
1600
|
+
const ret = wasm.brepkernel_fuse(this.__wbg_ptr, a, b);
|
|
1601
|
+
if (ret[2]) {
|
|
1602
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1603
|
+
}
|
|
1604
|
+
return ret[0] >>> 0;
|
|
1605
|
+
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Get the analytic surface parameters of a face.
|
|
1608
|
+
*
|
|
1609
|
+
* Returns a JSON string with surface-type-specific parameters.
|
|
1610
|
+
* @param {number} face
|
|
1611
|
+
* @returns {string}
|
|
1612
|
+
*/
|
|
1612
1613
|
getAnalyticSurfaceParams(face) {
|
|
1613
1614
|
let deferred2_0;
|
|
1614
1615
|
let deferred2_1;
|
|
@@ -1879,22 +1880,23 @@ class BrepKernel {
|
|
|
1879
1880
|
}
|
|
1880
1881
|
}
|
|
1881
1882
|
/**
|
|
1882
|
-
*
|
|
1883
|
+
* Type-gated read-only B-Spline/NURBS surface data for a face.
|
|
1883
1884
|
*
|
|
1884
|
-
*
|
|
1885
|
-
*
|
|
1886
|
-
*
|
|
1887
|
-
*
|
|
1888
|
-
*
|
|
1889
|
-
* `
|
|
1885
|
+
* Unlike `getNurbsSurfaceData`, this never converts analytic surfaces:
|
|
1886
|
+
* faces backed by a plane, cylinder, cone, sphere, or torus return the
|
|
1887
|
+
* JSON literal `null`. Only intrinsically free-form (B-Spline/NURBS) faces
|
|
1888
|
+
* yield a record with `degreeU`/`degreeV`, `nbPolesU`/`nbPolesV`, the
|
|
1889
|
+
* row-major `poles` grid (u-major, v-minor) with the matching `weights`
|
|
1890
|
+
* grid, distinct `knotsU`/`knotsV` paired with `multiplicitiesU`/
|
|
1891
|
+
* `multiplicitiesV`, `isPeriodicU`/`isPeriodicV`, and `isRational`.
|
|
1890
1892
|
* @param {number} face
|
|
1891
1893
|
* @returns {string}
|
|
1892
1894
|
*/
|
|
1893
|
-
|
|
1895
|
+
getNurbsSurfaceDataParity(face) {
|
|
1894
1896
|
let deferred2_0;
|
|
1895
1897
|
let deferred2_1;
|
|
1896
1898
|
try {
|
|
1897
|
-
const ret = wasm.
|
|
1899
|
+
const ret = wasm.brepkernel_getNurbsSurfaceDataParity(this.__wbg_ptr, face);
|
|
1898
1900
|
var ptr1 = ret[0];
|
|
1899
1901
|
var len1 = ret[1];
|
|
1900
1902
|
if (ret[3]) {
|
|
@@ -1909,23 +1911,22 @@ class BrepKernel {
|
|
|
1909
1911
|
}
|
|
1910
1912
|
}
|
|
1911
1913
|
/**
|
|
1912
|
-
*
|
|
1914
|
+
* Read-only canonical NURBS data for the surface underlying a face.
|
|
1913
1915
|
*
|
|
1914
|
-
*
|
|
1915
|
-
*
|
|
1916
|
-
*
|
|
1917
|
-
*
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
* `multiplicitiesV`, `isPeriodicU`/`isPeriodicV`, and `isRational`.
|
|
1916
|
+
* Analytic surfaces are converted to NURBS (planes/cylinders exact;
|
|
1917
|
+
* cones/spheres/tori via the exact rational forms). Returns a JSON
|
|
1918
|
+
* string with `degreeU`/`degreeV`, the row-major `controlPoints` grid,
|
|
1919
|
+
* the matching `weights` grid, flat `knotsU`/`knotsV`, compressed
|
|
1920
|
+
* distinct-knots/multiplicities per direction, `rational`,
|
|
1921
|
+
* `periodicU`/`periodicV`, and `domainU`/`domainV`.
|
|
1921
1922
|
* @param {number} face
|
|
1922
1923
|
* @returns {string}
|
|
1923
1924
|
*/
|
|
1924
|
-
|
|
1925
|
+
getNurbsSurfaceData(face) {
|
|
1925
1926
|
let deferred2_0;
|
|
1926
1927
|
let deferred2_1;
|
|
1927
1928
|
try {
|
|
1928
|
-
const ret = wasm.
|
|
1929
|
+
const ret = wasm.brepkernel_getNurbsSurfaceData(this.__wbg_ptr, face);
|
|
1929
1930
|
var ptr1 = ret[0];
|
|
1930
1931
|
var len1 = ret[1];
|
|
1931
1932
|
if (ret[3]) {
|
|
@@ -2440,26 +2441,6 @@ class BrepKernel {
|
|
|
2440
2441
|
}
|
|
2441
2442
|
return ret[0] >>> 0;
|
|
2442
2443
|
}
|
|
2443
|
-
/**
|
|
2444
|
-
* Intersect two solids, keeping only their common volume.
|
|
2445
|
-
*
|
|
2446
|
-
* Returns a new solid handle (`u32`).
|
|
2447
|
-
*
|
|
2448
|
-
* # Errors
|
|
2449
|
-
*
|
|
2450
|
-
* Returns an error if either solid handle is invalid or the operation
|
|
2451
|
-
* produces an empty result.
|
|
2452
|
-
* @param {number} a
|
|
2453
|
-
* @param {number} b
|
|
2454
|
-
* @returns {number}
|
|
2455
|
-
*/
|
|
2456
|
-
intersect(a, b) {
|
|
2457
|
-
const ret = wasm.brepkernel_intersect(this.__wbg_ptr, a, b);
|
|
2458
|
-
if (ret[2]) {
|
|
2459
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
2460
|
-
}
|
|
2461
|
-
return ret[0] >>> 0;
|
|
2462
|
-
}
|
|
2463
2444
|
/**
|
|
2464
2445
|
* Compute the boolean intersection of two 2D polygons.
|
|
2465
2446
|
*
|
|
@@ -2524,6 +2505,26 @@ class BrepKernel {
|
|
|
2524
2505
|
}
|
|
2525
2506
|
return ret[0] >>> 0;
|
|
2526
2507
|
}
|
|
2508
|
+
/**
|
|
2509
|
+
* Intersect two solids, keeping only their common volume.
|
|
2510
|
+
*
|
|
2511
|
+
* Returns a new solid handle (`u32`).
|
|
2512
|
+
*
|
|
2513
|
+
* # Errors
|
|
2514
|
+
*
|
|
2515
|
+
* Returns an error if either solid handle is invalid or the operation
|
|
2516
|
+
* produces an empty result.
|
|
2517
|
+
* @param {number} a
|
|
2518
|
+
* @param {number} b
|
|
2519
|
+
* @returns {number}
|
|
2520
|
+
*/
|
|
2521
|
+
intersect(a, b) {
|
|
2522
|
+
const ret = wasm.brepkernel_intersect(this.__wbg_ptr, a, b);
|
|
2523
|
+
if (ret[2]) {
|
|
2524
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2525
|
+
}
|
|
2526
|
+
return ret[0] >>> 0;
|
|
2527
|
+
}
|
|
2527
2528
|
/**
|
|
2528
2529
|
* Check if an edge is forward-oriented in a given wire.
|
|
2529
2530
|
*
|
|
@@ -2607,27 +2608,6 @@ class BrepKernel {
|
|
|
2607
2608
|
}
|
|
2608
2609
|
return ret[0] >>> 0;
|
|
2609
2610
|
}
|
|
2610
|
-
/**
|
|
2611
|
-
* Loft two or more profile faces into a solid.
|
|
2612
|
-
*
|
|
2613
|
-
* Takes an array of face handles. Returns a solid handle (`u32`).
|
|
2614
|
-
*
|
|
2615
|
-
* # Errors
|
|
2616
|
-
*
|
|
2617
|
-
* Returns an error if fewer than 2 faces or profiles have
|
|
2618
|
-
* different vertex counts.
|
|
2619
|
-
* @param {Uint32Array} faces
|
|
2620
|
-
* @returns {number}
|
|
2621
|
-
*/
|
|
2622
|
-
loft(faces) {
|
|
2623
|
-
const ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
|
|
2624
|
-
const len0 = WASM_VECTOR_LEN;
|
|
2625
|
-
const ret = wasm.brepkernel_loft(this.__wbg_ptr, ptr0, len0);
|
|
2626
|
-
if (ret[2]) {
|
|
2627
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
2628
|
-
}
|
|
2629
|
-
return ret[0] >>> 0;
|
|
2630
|
-
}
|
|
2631
2611
|
/**
|
|
2632
2612
|
* Loft profiles with smooth NURBS interpolation.
|
|
2633
2613
|
*
|
|
@@ -2676,41 +2656,41 @@ class BrepKernel {
|
|
|
2676
2656
|
return ret[0] >>> 0;
|
|
2677
2657
|
}
|
|
2678
2658
|
/**
|
|
2679
|
-
*
|
|
2659
|
+
* Loft two or more profile faces into a solid.
|
|
2680
2660
|
*
|
|
2681
|
-
* Returns a solid handle (`u32`).
|
|
2661
|
+
* Takes an array of face handles. Returns a solid handle (`u32`).
|
|
2682
2662
|
*
|
|
2683
2663
|
* # Errors
|
|
2684
2664
|
*
|
|
2685
|
-
* Returns an error if
|
|
2686
|
-
*
|
|
2687
|
-
* @param {
|
|
2688
|
-
* @param {number} dz
|
|
2665
|
+
* Returns an error if fewer than 2 faces or profiles have
|
|
2666
|
+
* different vertex counts.
|
|
2667
|
+
* @param {Uint32Array} faces
|
|
2689
2668
|
* @returns {number}
|
|
2690
2669
|
*/
|
|
2691
|
-
|
|
2692
|
-
const
|
|
2670
|
+
loft(faces) {
|
|
2671
|
+
const ptr0 = passArray32ToWasm0(faces, wasm.__wbindgen_malloc);
|
|
2672
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2673
|
+
const ret = wasm.brepkernel_loft(this.__wbg_ptr, ptr0, len0);
|
|
2693
2674
|
if (ret[2]) {
|
|
2694
2675
|
throw takeFromExternrefTable0(ret[1]);
|
|
2695
2676
|
}
|
|
2696
2677
|
return ret[0] >>> 0;
|
|
2697
2678
|
}
|
|
2698
2679
|
/**
|
|
2699
|
-
* Create a
|
|
2680
|
+
* Create a box solid with the given dimensions, centered at the origin.
|
|
2700
2681
|
*
|
|
2701
|
-
*
|
|
2702
|
-
* approximated by `segments` straight edges.
|
|
2703
|
-
* Returns a face handle (`u32`).
|
|
2682
|
+
* Returns a solid handle (`u32`).
|
|
2704
2683
|
*
|
|
2705
2684
|
* # Errors
|
|
2706
2685
|
*
|
|
2707
|
-
* Returns an error if
|
|
2708
|
-
* @param {number}
|
|
2709
|
-
* @param {number}
|
|
2686
|
+
* Returns an error if any dimension is non-positive or non-finite.
|
|
2687
|
+
* @param {number} dx
|
|
2688
|
+
* @param {number} dy
|
|
2689
|
+
* @param {number} dz
|
|
2710
2690
|
* @returns {number}
|
|
2711
2691
|
*/
|
|
2712
|
-
|
|
2713
|
-
const ret = wasm.
|
|
2692
|
+
makeBox(dx, dy, dz) {
|
|
2693
|
+
const ret = wasm.brepkernel_makeBox(this.__wbg_ptr, dx, dy, dz);
|
|
2714
2694
|
if (ret[2]) {
|
|
2715
2695
|
throw takeFromExternrefTable0(ret[1]);
|
|
2716
2696
|
}
|
|
@@ -2746,19 +2726,25 @@ class BrepKernel {
|
|
|
2746
2726
|
return ret[0] >>> 0;
|
|
2747
2727
|
}
|
|
2748
2728
|
/**
|
|
2749
|
-
* Create a closed circular edge with
|
|
2729
|
+
* Create a closed circular edge with a caller-supplied reference x-direction.
|
|
2750
2730
|
*
|
|
2751
|
-
*
|
|
2752
|
-
*
|
|
2753
|
-
*
|
|
2754
|
-
*
|
|
2731
|
+
* Like [`makeCircleEdge`](Self::make_circle_edge), but `ref_dir = (rx, ry, rz)`
|
|
2732
|
+
* is projected onto the plane perpendicular to the normal to fix the
|
|
2733
|
+
* circle's `u_axis` — which controls the seam vertex position at
|
|
2734
|
+
* `circle.evaluate(0.0)`. Use when downstream code (PCurve computation,
|
|
2735
|
+
* extrusion frame) depends on a specific seam placement.
|
|
2736
|
+
*
|
|
2737
|
+
* `ref_dir` must be non-zero (rejected at this boundary) and ideally
|
|
2738
|
+
* not parallel to the normal — `Frame3::from_normal_and_ref` falls
|
|
2739
|
+
* back to an arbitrary perpendicular when the projection of `ref_dir`
|
|
2740
|
+
* onto the plane is degenerate, defeating the purpose of this call.
|
|
2755
2741
|
*
|
|
2756
2742
|
* Returns an edge handle (`u32`).
|
|
2757
2743
|
*
|
|
2758
2744
|
* # Errors
|
|
2759
2745
|
*
|
|
2760
2746
|
* Returns an error if any coordinate is NaN/infinite, `radius` is
|
|
2761
|
-
* non-positive, or the normal vector is zero.
|
|
2747
|
+
* non-positive, or the normal vector or `ref_dir` is zero.
|
|
2762
2748
|
* @param {number} cx
|
|
2763
2749
|
* @param {number} cy
|
|
2764
2750
|
* @param {number} cz
|
|
@@ -2766,35 +2752,32 @@ class BrepKernel {
|
|
|
2766
2752
|
* @param {number} ny
|
|
2767
2753
|
* @param {number} nz
|
|
2768
2754
|
* @param {number} radius
|
|
2755
|
+
* @param {number} rx
|
|
2756
|
+
* @param {number} ry
|
|
2757
|
+
* @param {number} rz
|
|
2769
2758
|
* @returns {number}
|
|
2770
2759
|
*/
|
|
2771
|
-
|
|
2772
|
-
const ret = wasm.
|
|
2760
|
+
makeCircleEdgeWithRef(cx, cy, cz, nx, ny, nz, radius, rx, ry, rz) {
|
|
2761
|
+
const ret = wasm.brepkernel_makeCircleEdgeWithRef(this.__wbg_ptr, cx, cy, cz, nx, ny, nz, radius, rx, ry, rz);
|
|
2773
2762
|
if (ret[2]) {
|
|
2774
2763
|
throw takeFromExternrefTable0(ret[1]);
|
|
2775
2764
|
}
|
|
2776
2765
|
return ret[0] >>> 0;
|
|
2777
2766
|
}
|
|
2778
2767
|
/**
|
|
2779
|
-
* Create a closed circular edge with
|
|
2780
|
-
*
|
|
2781
|
-
* Like [`makeCircleEdge`](Self::make_circle_edge), but `ref_dir = (rx, ry, rz)`
|
|
2782
|
-
* is projected onto the plane perpendicular to the normal to fix the
|
|
2783
|
-
* circle's `u_axis` — which controls the seam vertex position at
|
|
2784
|
-
* `circle.evaluate(0.0)`. Use when downstream code (PCurve computation,
|
|
2785
|
-
* extrusion frame) depends on a specific seam placement.
|
|
2768
|
+
* Create a closed circular edge with true `Circle` curve geometry.
|
|
2786
2769
|
*
|
|
2787
|
-
* `
|
|
2788
|
-
*
|
|
2789
|
-
*
|
|
2790
|
-
*
|
|
2770
|
+
* Unlike `makeCircle` (which returns a polygon face approximation),
|
|
2771
|
+
* this creates a single closed edge with an [`EdgeCurve::Circle`]
|
|
2772
|
+
* backing curve and parameter domain `[0, 2π]`. The start and end
|
|
2773
|
+
* vertex are shared at the seam point `circle.evaluate(0.0)`.
|
|
2791
2774
|
*
|
|
2792
2775
|
* Returns an edge handle (`u32`).
|
|
2793
2776
|
*
|
|
2794
2777
|
* # Errors
|
|
2795
2778
|
*
|
|
2796
2779
|
* Returns an error if any coordinate is NaN/infinite, `radius` is
|
|
2797
|
-
* non-positive, or the normal vector
|
|
2780
|
+
* non-positive, or the normal vector is zero.
|
|
2798
2781
|
* @param {number} cx
|
|
2799
2782
|
* @param {number} cy
|
|
2800
2783
|
* @param {number} cz
|
|
@@ -2802,13 +2785,10 @@ class BrepKernel {
|
|
|
2802
2785
|
* @param {number} ny
|
|
2803
2786
|
* @param {number} nz
|
|
2804
2787
|
* @param {number} radius
|
|
2805
|
-
* @param {number} rx
|
|
2806
|
-
* @param {number} ry
|
|
2807
|
-
* @param {number} rz
|
|
2808
2788
|
* @returns {number}
|
|
2809
2789
|
*/
|
|
2810
|
-
|
|
2811
|
-
const ret = wasm.
|
|
2790
|
+
makeCircleEdge(cx, cy, cz, nx, ny, nz, radius) {
|
|
2791
|
+
const ret = wasm.brepkernel_makeCircleEdge(this.__wbg_ptr, cx, cy, cz, nx, ny, nz, radius);
|
|
2812
2792
|
if (ret[2]) {
|
|
2813
2793
|
throw takeFromExternrefTable0(ret[1]);
|
|
2814
2794
|
}
|
|
@@ -2829,6 +2809,27 @@ class BrepKernel {
|
|
|
2829
2809
|
}
|
|
2830
2810
|
return ret[0] >>> 0;
|
|
2831
2811
|
}
|
|
2812
|
+
/**
|
|
2813
|
+
* Create a circular polygon approximation on the XY plane.
|
|
2814
|
+
*
|
|
2815
|
+
* The circle is centered at the origin with the given `radius`,
|
|
2816
|
+
* approximated by `segments` straight edges.
|
|
2817
|
+
* Returns a face handle (`u32`).
|
|
2818
|
+
*
|
|
2819
|
+
* # Errors
|
|
2820
|
+
*
|
|
2821
|
+
* Returns an error if fewer than 3 segments are specified.
|
|
2822
|
+
* @param {number} radius
|
|
2823
|
+
* @param {number} segments
|
|
2824
|
+
* @returns {number}
|
|
2825
|
+
*/
|
|
2826
|
+
makeCircle(radius, segments) {
|
|
2827
|
+
const ret = wasm.brepkernel_makeCircle(this.__wbg_ptr, radius, segments);
|
|
2828
|
+
if (ret[2]) {
|
|
2829
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2830
|
+
}
|
|
2831
|
+
return ret[0] >>> 0;
|
|
2832
|
+
}
|
|
2832
2833
|
/**
|
|
2833
2834
|
* Create a compound from multiple solid handles.
|
|
2834
2835
|
*
|
|
@@ -2927,11 +2928,20 @@ class BrepKernel {
|
|
|
2927
2928
|
return ret[0] >>> 0;
|
|
2928
2929
|
}
|
|
2929
2930
|
/**
|
|
2930
|
-
* Create a closed elliptical edge with
|
|
2931
|
+
* Create a closed elliptical edge with a caller-supplied reference major-axis.
|
|
2931
2932
|
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2934
|
-
*
|
|
2933
|
+
* Like [`makeEllipseEdge`](Self::make_ellipse_edge), but `ref_dir = (rx, ry, rz)`
|
|
2934
|
+
* is projected onto the plane perpendicular to the normal to fix the
|
|
2935
|
+
* ellipse's major-axis direction (`u_axis`, carrying `semi_major`).
|
|
2936
|
+
* Use this when the caller has an intended major-axis orientation —
|
|
2937
|
+
* otherwise the default-frame variant chooses an arbitrary
|
|
2938
|
+
* perpendicular, which can cause adapters to fall back to NURBS
|
|
2939
|
+
* approximations to preserve their requested orientation.
|
|
2940
|
+
*
|
|
2941
|
+
* `ref_dir` must be non-zero (rejected at this boundary) and ideally
|
|
2942
|
+
* not parallel to the normal — `Frame3::from_normal_and_ref` falls
|
|
2943
|
+
* back to an arbitrary perpendicular when the projection of `ref_dir`
|
|
2944
|
+
* onto the plane is degenerate, defeating the purpose of this call.
|
|
2935
2945
|
*
|
|
2936
2946
|
* Returns an edge handle (`u32`).
|
|
2937
2947
|
*
|
|
@@ -2939,7 +2949,7 @@ class BrepKernel {
|
|
|
2939
2949
|
*
|
|
2940
2950
|
* Returns an error if any coordinate is NaN/infinite, either
|
|
2941
2951
|
* semi-axis is non-positive, `semi_minor` exceeds `semi_major`, or
|
|
2942
|
-
* the normal vector is zero.
|
|
2952
|
+
* the normal vector or `ref_dir` is zero.
|
|
2943
2953
|
* @param {number} cx
|
|
2944
2954
|
* @param {number} cy
|
|
2945
2955
|
* @param {number} cz
|
|
@@ -2948,30 +2958,24 @@ class BrepKernel {
|
|
|
2948
2958
|
* @param {number} nz
|
|
2949
2959
|
* @param {number} semi_major
|
|
2950
2960
|
* @param {number} semi_minor
|
|
2961
|
+
* @param {number} rx
|
|
2962
|
+
* @param {number} ry
|
|
2963
|
+
* @param {number} rz
|
|
2951
2964
|
* @returns {number}
|
|
2952
2965
|
*/
|
|
2953
|
-
|
|
2954
|
-
const ret = wasm.
|
|
2966
|
+
makeEllipseEdgeWithRef(cx, cy, cz, nx, ny, nz, semi_major, semi_minor, rx, ry, rz) {
|
|
2967
|
+
const ret = wasm.brepkernel_makeEllipseEdgeWithRef(this.__wbg_ptr, cx, cy, cz, nx, ny, nz, semi_major, semi_minor, rx, ry, rz);
|
|
2955
2968
|
if (ret[2]) {
|
|
2956
2969
|
throw takeFromExternrefTable0(ret[1]);
|
|
2957
2970
|
}
|
|
2958
2971
|
return ret[0] >>> 0;
|
|
2959
2972
|
}
|
|
2960
2973
|
/**
|
|
2961
|
-
* Create a closed elliptical edge with
|
|
2962
|
-
*
|
|
2963
|
-
* Like [`makeEllipseEdge`](Self::make_ellipse_edge), but `ref_dir = (rx, ry, rz)`
|
|
2964
|
-
* is projected onto the plane perpendicular to the normal to fix the
|
|
2965
|
-
* ellipse's major-axis direction (`u_axis`, carrying `semi_major`).
|
|
2966
|
-
* Use this when the caller has an intended major-axis orientation —
|
|
2967
|
-
* otherwise the default-frame variant chooses an arbitrary
|
|
2968
|
-
* perpendicular, which can cause adapters to fall back to NURBS
|
|
2969
|
-
* approximations to preserve their requested orientation.
|
|
2974
|
+
* Create a closed elliptical edge with true `Ellipse` curve geometry.
|
|
2970
2975
|
*
|
|
2971
|
-
*
|
|
2972
|
-
*
|
|
2973
|
-
*
|
|
2974
|
-
* onto the plane is degenerate, defeating the purpose of this call.
|
|
2976
|
+
* Creates a single closed edge with an [`EdgeCurve::Ellipse`] backing
|
|
2977
|
+
* curve and parameter domain `[0, 2π]`. The start and end vertex are
|
|
2978
|
+
* shared at the seam point `ellipse.evaluate(0.0)`.
|
|
2975
2979
|
*
|
|
2976
2980
|
* Returns an edge handle (`u32`).
|
|
2977
2981
|
*
|
|
@@ -2979,7 +2983,7 @@ class BrepKernel {
|
|
|
2979
2983
|
*
|
|
2980
2984
|
* Returns an error if any coordinate is NaN/infinite, either
|
|
2981
2985
|
* semi-axis is non-positive, `semi_minor` exceeds `semi_major`, or
|
|
2982
|
-
* the normal vector
|
|
2986
|
+
* the normal vector is zero.
|
|
2983
2987
|
* @param {number} cx
|
|
2984
2988
|
* @param {number} cy
|
|
2985
2989
|
* @param {number} cz
|
|
@@ -2988,13 +2992,10 @@ class BrepKernel {
|
|
|
2988
2992
|
* @param {number} nz
|
|
2989
2993
|
* @param {number} semi_major
|
|
2990
2994
|
* @param {number} semi_minor
|
|
2991
|
-
* @param {number} rx
|
|
2992
|
-
* @param {number} ry
|
|
2993
|
-
* @param {number} rz
|
|
2994
2995
|
* @returns {number}
|
|
2995
2996
|
*/
|
|
2996
|
-
|
|
2997
|
-
const ret = wasm.
|
|
2997
|
+
makeEllipseEdge(cx, cy, cz, nx, ny, nz, semi_major, semi_minor) {
|
|
2998
|
+
const ret = wasm.brepkernel_makeEllipseEdge(this.__wbg_ptr, cx, cy, cz, nx, ny, nz, semi_major, semi_minor);
|
|
2998
2999
|
if (ret[2]) {
|
|
2999
3000
|
throw takeFromExternrefTable0(ret[1]);
|
|
3000
3001
|
}
|
|
@@ -3098,8 +3099,24 @@ class BrepKernel {
|
|
|
3098
3099
|
* @param {number} wire
|
|
3099
3100
|
* @returns {number}
|
|
3100
3101
|
*/
|
|
3101
|
-
makePlanarFaceFromWire(wire) {
|
|
3102
|
-
const ret = wasm.brepkernel_makePlanarFaceFromWire(this.__wbg_ptr, wire);
|
|
3102
|
+
makePlanarFaceFromWire(wire) {
|
|
3103
|
+
const ret = wasm.brepkernel_makePlanarFaceFromWire(this.__wbg_ptr, wire);
|
|
3104
|
+
if (ret[2]) {
|
|
3105
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3106
|
+
}
|
|
3107
|
+
return ret[0] >>> 0;
|
|
3108
|
+
}
|
|
3109
|
+
/**
|
|
3110
|
+
* Create a closed polygon wire from flat coordinates.
|
|
3111
|
+
*
|
|
3112
|
+
* Returns a wire handle.
|
|
3113
|
+
* @param {Float64Array} coords
|
|
3114
|
+
* @returns {number}
|
|
3115
|
+
*/
|
|
3116
|
+
makePolygonWire(coords) {
|
|
3117
|
+
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
3118
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3119
|
+
const ret = wasm.brepkernel_makePolygonWire(this.__wbg_ptr, ptr0, len0);
|
|
3103
3120
|
if (ret[2]) {
|
|
3104
3121
|
throw takeFromExternrefTable0(ret[1]);
|
|
3105
3122
|
}
|
|
@@ -3127,22 +3144,6 @@ class BrepKernel {
|
|
|
3127
3144
|
}
|
|
3128
3145
|
return ret[0] >>> 0;
|
|
3129
3146
|
}
|
|
3130
|
-
/**
|
|
3131
|
-
* Create a closed polygon wire from flat coordinates.
|
|
3132
|
-
*
|
|
3133
|
-
* Returns a wire handle.
|
|
3134
|
-
* @param {Float64Array} coords
|
|
3135
|
-
* @returns {number}
|
|
3136
|
-
*/
|
|
3137
|
-
makePolygonWire(coords) {
|
|
3138
|
-
const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_malloc);
|
|
3139
|
-
const len0 = WASM_VECTOR_LEN;
|
|
3140
|
-
const ret = wasm.brepkernel_makePolygonWire(this.__wbg_ptr, ptr0, len0);
|
|
3141
|
-
if (ret[2]) {
|
|
3142
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
3143
|
-
}
|
|
3144
|
-
return ret[0] >>> 0;
|
|
3145
|
-
}
|
|
3146
3147
|
/**
|
|
3147
3148
|
* Create a rectangular face on the XY plane centered at the origin.
|
|
3148
3149
|
*
|
|
@@ -3375,38 +3376,38 @@ class BrepKernel {
|
|
|
3375
3376
|
return JsMesh.__wrap(ret[0]);
|
|
3376
3377
|
}
|
|
3377
3378
|
/**
|
|
3378
|
-
* Sample edges of a solid
|
|
3379
|
-
*
|
|
3380
|
-
* Returns a `JsEdgeLines` containing flattened positions and per-edge
|
|
3381
|
-
* offset indices. The `deflection` parameter controls sampling density.
|
|
3379
|
+
* Sample ALL edges of a solid (no smooth-edge filtering).
|
|
3382
3380
|
*
|
|
3383
|
-
*
|
|
3384
|
-
*
|
|
3385
|
-
* arise from boolean face-splitting and don't represent visible creases.
|
|
3381
|
+
* Same as `meshEdges` but includes edges between co-surface faces.
|
|
3382
|
+
* Useful for debugging topology.
|
|
3386
3383
|
* @param {number} solid
|
|
3387
3384
|
* @param {number} deflection
|
|
3388
3385
|
* @param {number | null} [angular_tolerance]
|
|
3389
3386
|
* @returns {JsEdgeLines}
|
|
3390
3387
|
*/
|
|
3391
|
-
|
|
3392
|
-
const ret = wasm.
|
|
3388
|
+
meshEdgesAll(solid, deflection, angular_tolerance) {
|
|
3389
|
+
const ret = wasm.brepkernel_meshEdgesAll(this.__wbg_ptr, solid, deflection, !isLikeNone(angular_tolerance), isLikeNone(angular_tolerance) ? 0 : angular_tolerance);
|
|
3393
3390
|
if (ret[2]) {
|
|
3394
3391
|
throw takeFromExternrefTable0(ret[1]);
|
|
3395
3392
|
}
|
|
3396
3393
|
return JsEdgeLines.__wrap(ret[0]);
|
|
3397
3394
|
}
|
|
3398
3395
|
/**
|
|
3399
|
-
* Sample
|
|
3396
|
+
* Sample edges of a solid into polylines for wireframe rendering.
|
|
3400
3397
|
*
|
|
3401
|
-
*
|
|
3402
|
-
*
|
|
3398
|
+
* Returns a `JsEdgeLines` containing flattened positions and per-edge
|
|
3399
|
+
* offset indices. The `deflection` parameter controls sampling density.
|
|
3400
|
+
*
|
|
3401
|
+
* Smooth edges (between faces on the same underlying surface) are
|
|
3402
|
+
* automatically filtered out to reduce wireframe clutter. These edges
|
|
3403
|
+
* arise from boolean face-splitting and don't represent visible creases.
|
|
3403
3404
|
* @param {number} solid
|
|
3404
3405
|
* @param {number} deflection
|
|
3405
3406
|
* @param {number | null} [angular_tolerance]
|
|
3406
3407
|
* @returns {JsEdgeLines}
|
|
3407
3408
|
*/
|
|
3408
|
-
|
|
3409
|
-
const ret = wasm.
|
|
3409
|
+
meshEdges(solid, deflection, angular_tolerance) {
|
|
3410
|
+
const ret = wasm.brepkernel_meshEdges(this.__wbg_ptr, solid, deflection, !isLikeNone(angular_tolerance), isLikeNone(angular_tolerance) ? 0 : angular_tolerance);
|
|
3410
3411
|
if (ret[2]) {
|
|
3411
3412
|
throw takeFromExternrefTable0(ret[1]);
|
|
3412
3413
|
}
|
|
@@ -3565,25 +3566,6 @@ class BrepKernel {
|
|
|
3565
3566
|
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
3566
3567
|
return v2;
|
|
3567
3568
|
}
|
|
3568
|
-
/**
|
|
3569
|
-
* Offset (shell) a solid by a distance.
|
|
3570
|
-
*
|
|
3571
|
-
* Returns a new solid handle.
|
|
3572
|
-
*
|
|
3573
|
-
* # Errors
|
|
3574
|
-
*
|
|
3575
|
-
* Returns an error if the distance is zero or the solid is invalid.
|
|
3576
|
-
* @param {number} solid
|
|
3577
|
-
* @param {number} distance
|
|
3578
|
-
* @returns {number}
|
|
3579
|
-
*/
|
|
3580
|
-
offsetSolid(solid, distance) {
|
|
3581
|
-
const ret = wasm.brepkernel_offsetSolid(this.__wbg_ptr, solid, distance);
|
|
3582
|
-
if (ret[2]) {
|
|
3583
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
3584
|
-
}
|
|
3585
|
-
return ret[0] >>> 0;
|
|
3586
|
-
}
|
|
3587
3569
|
/**
|
|
3588
3570
|
* Offset all faces of a solid outward or inward (V2 pipeline).
|
|
3589
3571
|
*
|
|
@@ -3604,15 +3586,19 @@ class BrepKernel {
|
|
|
3604
3586
|
return ret[0] >>> 0;
|
|
3605
3587
|
}
|
|
3606
3588
|
/**
|
|
3607
|
-
* Offset a
|
|
3589
|
+
* Offset (shell) a solid by a distance.
|
|
3608
3590
|
*
|
|
3609
|
-
* Returns a new
|
|
3610
|
-
*
|
|
3591
|
+
* Returns a new solid handle.
|
|
3592
|
+
*
|
|
3593
|
+
* # Errors
|
|
3594
|
+
*
|
|
3595
|
+
* Returns an error if the distance is zero or the solid is invalid.
|
|
3596
|
+
* @param {number} solid
|
|
3611
3597
|
* @param {number} distance
|
|
3612
3598
|
* @returns {number}
|
|
3613
3599
|
*/
|
|
3614
|
-
|
|
3615
|
-
const ret = wasm.
|
|
3600
|
+
offsetSolid(solid, distance) {
|
|
3601
|
+
const ret = wasm.brepkernel_offsetSolid(this.__wbg_ptr, solid, distance);
|
|
3616
3602
|
if (ret[2]) {
|
|
3617
3603
|
throw takeFromExternrefTable0(ret[1]);
|
|
3618
3604
|
}
|
|
@@ -3674,6 +3660,21 @@ class BrepKernel {
|
|
|
3674
3660
|
}
|
|
3675
3661
|
return ret[0] >>> 0;
|
|
3676
3662
|
}
|
|
3663
|
+
/**
|
|
3664
|
+
* Offset a wire on a planar face.
|
|
3665
|
+
*
|
|
3666
|
+
* Returns a new wire handle.
|
|
3667
|
+
* @param {number} face
|
|
3668
|
+
* @param {number} distance
|
|
3669
|
+
* @returns {number}
|
|
3670
|
+
*/
|
|
3671
|
+
offsetWire(face, distance) {
|
|
3672
|
+
const ret = wasm.brepkernel_offsetWire(this.__wbg_ptr, face, distance);
|
|
3673
|
+
if (ret[2]) {
|
|
3674
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
3675
|
+
}
|
|
3676
|
+
return ret[0] >>> 0;
|
|
3677
|
+
}
|
|
3677
3678
|
/**
|
|
3678
3679
|
* Pipe sweep: sweep a profile along a NURBS path (no guide).
|
|
3679
3680
|
*
|
|
@@ -4321,41 +4322,6 @@ class BrepKernel {
|
|
|
4321
4322
|
}
|
|
4322
4323
|
return ret[0];
|
|
4323
4324
|
}
|
|
4324
|
-
/**
|
|
4325
|
-
* Sweep a planar face along a NURBS curve path to create a solid.
|
|
4326
|
-
*
|
|
4327
|
-
* The path is specified as flat arrays for JS interop:
|
|
4328
|
-
* - `path_degree` — polynomial degree of the path curve
|
|
4329
|
-
* - `path_knots` — knot vector
|
|
4330
|
-
* - `path_control_points` — flat `[x,y,z, ...]` control point coordinates
|
|
4331
|
-
* - `path_weights` — per-control-point weights
|
|
4332
|
-
*
|
|
4333
|
-
* Returns a solid handle (`u32`).
|
|
4334
|
-
*
|
|
4335
|
-
* # Errors
|
|
4336
|
-
*
|
|
4337
|
-
* Returns an error if the face handle is invalid, the NURBS arrays have
|
|
4338
|
-
* inconsistent lengths, or the sweep operation fails.
|
|
4339
|
-
* @param {number} face
|
|
4340
|
-
* @param {number} path_degree
|
|
4341
|
-
* @param {Float64Array} path_knots
|
|
4342
|
-
* @param {Float64Array} path_control_points
|
|
4343
|
-
* @param {Float64Array} path_weights
|
|
4344
|
-
* @returns {number}
|
|
4345
|
-
*/
|
|
4346
|
-
sweep(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4347
|
-
const ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4348
|
-
const len0 = WASM_VECTOR_LEN;
|
|
4349
|
-
const ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4350
|
-
const len1 = WASM_VECTOR_LEN;
|
|
4351
|
-
const ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4352
|
-
const len2 = WASM_VECTOR_LEN;
|
|
4353
|
-
const ret = wasm.brepkernel_sweep(this.__wbg_ptr, face, path_degree, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4354
|
-
if (ret[2]) {
|
|
4355
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4356
|
-
}
|
|
4357
|
-
return ret[0] >>> 0;
|
|
4358
|
-
}
|
|
4359
4325
|
/**
|
|
4360
4326
|
* Sweep a face along a path defined by a chain of edges.
|
|
4361
4327
|
*
|
|
@@ -4442,6 +4408,41 @@ class BrepKernel {
|
|
|
4442
4408
|
}
|
|
4443
4409
|
return ret[0] >>> 0;
|
|
4444
4410
|
}
|
|
4411
|
+
/**
|
|
4412
|
+
* Sweep a planar face along a NURBS curve path to create a solid.
|
|
4413
|
+
*
|
|
4414
|
+
* The path is specified as flat arrays for JS interop:
|
|
4415
|
+
* - `path_degree` — polynomial degree of the path curve
|
|
4416
|
+
* - `path_knots` — knot vector
|
|
4417
|
+
* - `path_control_points` — flat `[x,y,z, ...]` control point coordinates
|
|
4418
|
+
* - `path_weights` — per-control-point weights
|
|
4419
|
+
*
|
|
4420
|
+
* Returns a solid handle (`u32`).
|
|
4421
|
+
*
|
|
4422
|
+
* # Errors
|
|
4423
|
+
*
|
|
4424
|
+
* Returns an error if the face handle is invalid, the NURBS arrays have
|
|
4425
|
+
* inconsistent lengths, or the sweep operation fails.
|
|
4426
|
+
* @param {number} face
|
|
4427
|
+
* @param {number} path_degree
|
|
4428
|
+
* @param {Float64Array} path_knots
|
|
4429
|
+
* @param {Float64Array} path_control_points
|
|
4430
|
+
* @param {Float64Array} path_weights
|
|
4431
|
+
* @returns {number}
|
|
4432
|
+
*/
|
|
4433
|
+
sweep(face, path_degree, path_knots, path_control_points, path_weights) {
|
|
4434
|
+
const ptr0 = passArrayF64ToWasm0(path_knots, wasm.__wbindgen_malloc);
|
|
4435
|
+
const len0 = WASM_VECTOR_LEN;
|
|
4436
|
+
const ptr1 = passArrayF64ToWasm0(path_control_points, wasm.__wbindgen_malloc);
|
|
4437
|
+
const len1 = WASM_VECTOR_LEN;
|
|
4438
|
+
const ptr2 = passArrayF64ToWasm0(path_weights, wasm.__wbindgen_malloc);
|
|
4439
|
+
const len2 = WASM_VECTOR_LEN;
|
|
4440
|
+
const ret = wasm.brepkernel_sweep(this.__wbg_ptr, face, path_degree, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
4441
|
+
if (ret[2]) {
|
|
4442
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4443
|
+
}
|
|
4444
|
+
return ret[0] >>> 0;
|
|
4445
|
+
}
|
|
4445
4446
|
/**
|
|
4446
4447
|
* Tessellate an edge curve into polyline segments.
|
|
4447
4448
|
*
|
|
@@ -4481,9 +4482,13 @@ class BrepKernel {
|
|
|
4481
4482
|
return JsMesh.__wrap(ret[0]);
|
|
4482
4483
|
}
|
|
4483
4484
|
/**
|
|
4484
|
-
* Tessellate
|
|
4485
|
+
* Tessellate a solid with per-face grouping, returned as packed binary
|
|
4486
|
+
* buffers ([`JsGroupedMesh`]) instead of a JSON string.
|
|
4485
4487
|
*
|
|
4486
|
-
*
|
|
4488
|
+
* Identical geometry to [`tessellate_solid_grouped`](Self::tessellate_solid_grouped),
|
|
4489
|
+
* but the mesh crosses the WASM boundary as `Float32Array`/`Uint32Array`
|
|
4490
|
+
* bulk copies rather than a (potentially multi-megabyte) JSON string that
|
|
4491
|
+
* the caller must `JSON.parse` and re-pack — far cheaper for large meshes.
|
|
4487
4492
|
*
|
|
4488
4493
|
* # Errors
|
|
4489
4494
|
*
|
|
@@ -4491,14 +4496,14 @@ class BrepKernel {
|
|
|
4491
4496
|
* @param {number} solid
|
|
4492
4497
|
* @param {number} deflection
|
|
4493
4498
|
* @param {number | null} [angular_tolerance]
|
|
4494
|
-
* @returns {
|
|
4499
|
+
* @returns {JsGroupedMesh}
|
|
4495
4500
|
*/
|
|
4496
|
-
|
|
4497
|
-
const ret = wasm.
|
|
4501
|
+
tessellateSolidGroupedBinary(solid, deflection, angular_tolerance) {
|
|
4502
|
+
const ret = wasm.brepkernel_tessellateSolidGroupedBinary(this.__wbg_ptr, solid, deflection, !isLikeNone(angular_tolerance), isLikeNone(angular_tolerance) ? 0 : angular_tolerance);
|
|
4498
4503
|
if (ret[2]) {
|
|
4499
4504
|
throw takeFromExternrefTable0(ret[1]);
|
|
4500
4505
|
}
|
|
4501
|
-
return
|
|
4506
|
+
return JsGroupedMesh.__wrap(ret[0]);
|
|
4502
4507
|
}
|
|
4503
4508
|
/**
|
|
4504
4509
|
* Tessellate a solid with per-face triangle grouping.
|
|
@@ -4523,13 +4528,12 @@ class BrepKernel {
|
|
|
4523
4528
|
return takeFromExternrefTable0(ret[0]);
|
|
4524
4529
|
}
|
|
4525
4530
|
/**
|
|
4526
|
-
* Tessellate a solid
|
|
4527
|
-
* buffers ([`JsGroupedMesh`]) instead of a JSON string.
|
|
4531
|
+
* Tessellate a solid and include per-vertex UV coordinates.
|
|
4528
4532
|
*
|
|
4529
|
-
*
|
|
4530
|
-
*
|
|
4531
|
-
*
|
|
4532
|
-
*
|
|
4533
|
+
* Returns a JSON string containing `{ positions, normals, indices, uvs }`.
|
|
4534
|
+
* `uvs` is a flat array of `[u0, v0, u1, v1, ...]` values, two per vertex.
|
|
4535
|
+
* For analytic and NURBS surfaces, these are the parametric (u, v) values.
|
|
4536
|
+
* For planar faces, UVs are computed by projection onto the face plane.
|
|
4533
4537
|
*
|
|
4534
4538
|
* # Errors
|
|
4535
4539
|
*
|
|
@@ -4537,22 +4541,19 @@ class BrepKernel {
|
|
|
4537
4541
|
* @param {number} solid
|
|
4538
4542
|
* @param {number} deflection
|
|
4539
4543
|
* @param {number | null} [angular_tolerance]
|
|
4540
|
-
* @returns {
|
|
4544
|
+
* @returns {any}
|
|
4541
4545
|
*/
|
|
4542
|
-
|
|
4543
|
-
const ret = wasm.
|
|
4546
|
+
tessellateSolidUV(solid, deflection, angular_tolerance) {
|
|
4547
|
+
const ret = wasm.brepkernel_tessellateSolidUV(this.__wbg_ptr, solid, deflection, !isLikeNone(angular_tolerance), isLikeNone(angular_tolerance) ? 0 : angular_tolerance);
|
|
4544
4548
|
if (ret[2]) {
|
|
4545
4549
|
throw takeFromExternrefTable0(ret[1]);
|
|
4546
4550
|
}
|
|
4547
|
-
return
|
|
4551
|
+
return takeFromExternrefTable0(ret[0]);
|
|
4548
4552
|
}
|
|
4549
4553
|
/**
|
|
4550
|
-
* Tessellate a solid
|
|
4554
|
+
* Tessellate all faces of a solid into a single merged triangle mesh.
|
|
4551
4555
|
*
|
|
4552
|
-
*
|
|
4553
|
-
* `uvs` is a flat array of `[u0, v0, u1, v1, ...]` values, two per vertex.
|
|
4554
|
-
* For analytic and NURBS surfaces, these are the parametric (u, v) values.
|
|
4555
|
-
* For planar faces, UVs are computed by projection onto the face plane.
|
|
4556
|
+
* Includes both the outer shell and any inner shells (voids).
|
|
4556
4557
|
*
|
|
4557
4558
|
* # Errors
|
|
4558
4559
|
*
|
|
@@ -4560,14 +4561,14 @@ class BrepKernel {
|
|
|
4560
4561
|
* @param {number} solid
|
|
4561
4562
|
* @param {number} deflection
|
|
4562
4563
|
* @param {number | null} [angular_tolerance]
|
|
4563
|
-
* @returns {
|
|
4564
|
+
* @returns {JsMesh}
|
|
4564
4565
|
*/
|
|
4565
|
-
|
|
4566
|
-
const ret = wasm.
|
|
4566
|
+
tessellateSolid(solid, deflection, angular_tolerance) {
|
|
4567
|
+
const ret = wasm.brepkernel_tessellateSolid(this.__wbg_ptr, solid, deflection, !isLikeNone(angular_tolerance), isLikeNone(angular_tolerance) ? 0 : angular_tolerance);
|
|
4567
4568
|
if (ret[2]) {
|
|
4568
4569
|
throw takeFromExternrefTable0(ret[1]);
|
|
4569
4570
|
}
|
|
4570
|
-
return
|
|
4571
|
+
return JsMesh.__wrap(ret[0]);
|
|
4571
4572
|
}
|
|
4572
4573
|
/**
|
|
4573
4574
|
* Thicken a face into a solid by offsetting it by the given distance.
|
|
@@ -4717,24 +4718,6 @@ class BrepKernel {
|
|
|
4717
4718
|
}
|
|
4718
4719
|
return ret[0] >>> 0;
|
|
4719
4720
|
}
|
|
4720
|
-
/**
|
|
4721
|
-
* Validate a solid, returning the number of errors found.
|
|
4722
|
-
*
|
|
4723
|
-
* Returns 0 if the solid is valid.
|
|
4724
|
-
*
|
|
4725
|
-
* # Errors
|
|
4726
|
-
*
|
|
4727
|
-
* Returns an error if the solid handle is invalid.
|
|
4728
|
-
* @param {number} solid
|
|
4729
|
-
* @returns {number}
|
|
4730
|
-
*/
|
|
4731
|
-
validateSolid(solid) {
|
|
4732
|
-
const ret = wasm.brepkernel_validateSolid(this.__wbg_ptr, solid);
|
|
4733
|
-
if (ret[2]) {
|
|
4734
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
4735
|
-
}
|
|
4736
|
-
return ret[0] >>> 0;
|
|
4737
|
-
}
|
|
4738
4721
|
/**
|
|
4739
4722
|
* Validate a solid with relaxed checks suitable for assembled geometry.
|
|
4740
4723
|
*
|
|
@@ -4782,6 +4765,24 @@ class BrepKernel {
|
|
|
4782
4765
|
}
|
|
4783
4766
|
return ret[0] >>> 0;
|
|
4784
4767
|
}
|
|
4768
|
+
/**
|
|
4769
|
+
* Validate a solid, returning the number of errors found.
|
|
4770
|
+
*
|
|
4771
|
+
* Returns 0 if the solid is valid.
|
|
4772
|
+
*
|
|
4773
|
+
* # Errors
|
|
4774
|
+
*
|
|
4775
|
+
* Returns an error if the solid handle is invalid.
|
|
4776
|
+
* @param {number} solid
|
|
4777
|
+
* @returns {number}
|
|
4778
|
+
*/
|
|
4779
|
+
validateSolid(solid) {
|
|
4780
|
+
const ret = wasm.brepkernel_validateSolid(this.__wbg_ptr, solid);
|
|
4781
|
+
if (ret[2]) {
|
|
4782
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
4783
|
+
}
|
|
4784
|
+
return ret[0] >>> 0;
|
|
4785
|
+
}
|
|
4785
4786
|
/**
|
|
4786
4787
|
* Compute the volume of a solid.
|
|
4787
4788
|
*
|
|
@@ -5281,30 +5282,30 @@ exports.setLogLevel = setLogLevel;
|
|
|
5281
5282
|
function __wbg_get_imports() {
|
|
5282
5283
|
const import0 = {
|
|
5283
5284
|
__proto__: null,
|
|
5284
|
-
|
|
5285
|
+
__wbg_Error_67e7344beaa85059: function(arg0, arg1) {
|
|
5285
5286
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
5286
5287
|
return ret;
|
|
5287
5288
|
},
|
|
5288
|
-
|
|
5289
|
+
__wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
|
|
5289
5290
|
const ret = debugString(arg1);
|
|
5290
5291
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
5291
5292
|
const len1 = WASM_VECTOR_LEN;
|
|
5292
5293
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
5293
5294
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
5294
5295
|
},
|
|
5295
|
-
|
|
5296
|
+
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
5296
5297
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
5297
5298
|
},
|
|
5298
|
-
|
|
5299
|
+
__wbg_error_9a7c95a53b5089ee: function(arg0, arg1) {
|
|
5299
5300
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
5300
5301
|
},
|
|
5301
|
-
|
|
5302
|
+
__wbg_log_de93bbd8cd4c6d40: function(arg0, arg1) {
|
|
5302
5303
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5303
5304
|
},
|
|
5304
|
-
|
|
5305
|
+
__wbg_warn_9f576b1eee065769: function(arg0, arg1) {
|
|
5305
5306
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
5306
5307
|
},
|
|
5307
|
-
|
|
5308
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
5308
5309
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
5309
5310
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
5310
5311
|
return ret;
|