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