okgeometry-api 1.16.0 → 1.17.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/dist/Brep.d.ts +84 -6
- package/dist/Brep.d.ts.map +1 -1
- package/dist/Brep.js +101 -4
- package/dist/Brep.js.map +1 -1
- package/dist/Circle.d.ts +5 -2
- package/dist/Circle.d.ts.map +1 -1
- package/dist/Circle.js +5 -2
- package/dist/Circle.js.map +1 -1
- package/dist/GeometryBoolean.d.ts +136 -0
- package/dist/GeometryBoolean.d.ts.map +1 -0
- package/dist/GeometryBoolean.js +632 -0
- package/dist/GeometryBoolean.js.map +1 -0
- package/dist/Mesh.d.ts +21 -1
- package/dist/Mesh.d.ts.map +1 -1
- package/dist/Mesh.js +73 -5
- package/dist/Mesh.js.map +1 -1
- package/dist/NurbsCurve.d.ts +66 -0
- package/dist/NurbsCurve.d.ts.map +1 -1
- package/dist/NurbsCurve.js +101 -0
- package/dist/NurbsCurve.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/wasm-base64.d.ts +1 -1
- package/dist/wasm-base64.d.ts.map +1 -1
- package/dist/wasm-base64.js +1 -1
- package/dist/wasm-base64.js.map +1 -1
- package/dist/wasm-bindings.d.ts +103 -1
- package/dist/wasm-bindings.d.ts.map +1 -1
- package/dist/wasm-bindings.js +164 -1
- package/dist/wasm-bindings.js.map +1 -1
- package/package.json +7 -3
- package/src/Brep.ts +130 -8
- package/src/Circle.ts +24 -21
- package/src/GeometryBoolean.ts +863 -0
- package/src/Mesh.ts +85 -5
- package/src/NurbsCurve.ts +110 -0
- package/src/index.ts +88 -79
- package/src/wasm-base64.ts +1 -1
- package/src/wasm-bindings.d.ts +92 -1
- package/src/wasm-bindings.js +167 -1
package/src/wasm-bindings.d.ts
CHANGED
|
@@ -14,7 +14,20 @@ export function arc_point_at(cx: number, cy: number, cz: number, nx: number, ny:
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Parametric BREP boolean: exact surface–surface intersection curves with
|
|
17
|
-
* trimmed-surface output.
|
|
17
|
+
* trimmed-surface output. Operands may be closed solids OR open sheets —
|
|
18
|
+
* the kernel dispatches on closedness (oriented-sheet convention: a sheet's
|
|
19
|
+
* "inside" is the FRONT of its normal):
|
|
20
|
+
* - closed × closed: full volumetric boolean.
|
|
21
|
+
* - sheet × solid: subtract keeps the sheet outside the solid, intersect
|
|
22
|
+
* keeps the inside.
|
|
23
|
+
* - solid × sheet: subtract keeps the capped half BEHIND the sheet normal,
|
|
24
|
+
* intersect the front half.
|
|
25
|
+
* - sheet × sheet: a sheet's material is its FRONT half-space, so union
|
|
26
|
+
* stitches A-BACK + B-BACK at the intersection edges (front pieces are
|
|
27
|
+
* interior to the union material; uncut pieces are kept, coincident
|
|
28
|
+
* overlaps keep A's copy); subtract keeps A's back pieces; intersect
|
|
29
|
+
* A's front pieces.
|
|
30
|
+
* - union of a solid and a sheet is not defined and returns an error.
|
|
18
31
|
* op: "union" | "intersect" | "subtract".
|
|
19
32
|
* Returns the result BREP as JSON, or {"error": "..."} on failure.
|
|
20
33
|
*/
|
|
@@ -227,6 +240,24 @@ export function brep_revolve_curve(curve_data: Float64Array, ox: number, oy: num
|
|
|
227
240
|
*/
|
|
228
241
|
export function brep_sheet_from_surface(surface_data: Float64Array): string;
|
|
229
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Split an OPEN sheet BREP `a` by another OPEN sheet BREP `b`.
|
|
245
|
+
* Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
|
|
246
|
+
* `inside` = a's pieces in FRONT of b's oriented normal, `outside` = the
|
|
247
|
+
* pieces behind it (matching the oriented-sheet convention of
|
|
248
|
+
* `mesh_clip_polyline` and the sheet boolean dispatch).
|
|
249
|
+
*/
|
|
250
|
+
export function brep_split_sheet_by_sheet_op(a_json: string, b_json: string, tolerance: number): string;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Split an OPEN sheet BREP by a CLOSED solid BREP into containment sides.
|
|
254
|
+
* Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
|
|
255
|
+
* `inside` = the sheet pieces contained in the solid (ON-boundary pieces
|
|
256
|
+
* count as inside), `outside` = the rest. Both preserve the sheet's exact
|
|
257
|
+
* trimmed faces, pcurves and edges.
|
|
258
|
+
*/
|
|
259
|
+
export function brep_split_sheet_by_solid_op(sheet_json: string, solid_json: string, tolerance: number): string;
|
|
260
|
+
|
|
230
261
|
/**
|
|
231
262
|
* Split a closed solid BREP by a sheet BREP into BOTH capped halves.
|
|
232
263
|
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
@@ -321,6 +352,49 @@ export function create_line(x1: number, y1: number, z1: number, x2: number, y2:
|
|
|
321
352
|
*/
|
|
322
353
|
export function create_polyline(coords: Float64Array, samples_per_segment: number): Float64Array;
|
|
323
354
|
|
|
355
|
+
/**
|
|
356
|
+
* 2D REGION boolean between two CLOSED, COPLANAR curves (Rhino CurveBoolean).
|
|
357
|
+
*
|
|
358
|
+
* Both inputs are standard NURBS curve encodings (the TS layer coerces
|
|
359
|
+
* circles/arcs/polylines/polycurves to exact NURBS first). The curves are
|
|
360
|
+
* projected onto a common plane (fitted from A, coplanarity verified),
|
|
361
|
+
* tessellated to polygons, arranged in 2D, classified by inside-A/inside-B
|
|
362
|
+
* (nonzero winding), and the result loops emitted per op. CLOSURE is
|
|
363
|
+
* verified kernel-side: each curve's endpoints must coincide within a
|
|
364
|
+
* scale-relative tolerance, open curves error out (never silently
|
|
365
|
+
* chord-closed).
|
|
366
|
+
*
|
|
367
|
+
* `op`: 0 = union, 1 = subtract (A − B), 2 = intersect.
|
|
368
|
+
*
|
|
369
|
+
* Result loops are POLYLINE (degree-1 NURBS) closed curves — Rhino-parity
|
|
370
|
+
* fidelity. Tessellation samples include every distinct interior knot value,
|
|
371
|
+
* so degree-1 polygon corners and C0 kinks are preserved EXACTLY, and
|
|
372
|
+
* consecutive collinear points are collapsed so straight runs come back as
|
|
373
|
+
* single segments. Outer boundaries are CCW (positive plane-signed area),
|
|
374
|
+
* holes CW. CCW is measured about a DETERMINISTIC plane normal: the normal
|
|
375
|
+
* fitted from curve A, flipped so its dominant world-axis component is
|
|
376
|
+
* positive (for XY-plane curves the reference is +Z). The orientation is
|
|
377
|
+
* therefore independent of the inputs' drawing direction. Callers
|
|
378
|
+
* reconstruct nesting from the winding sign.
|
|
379
|
+
*
|
|
380
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (same multi-curve
|
|
381
|
+
* packing as `nurbs_curve_split_at_params`). An EMPTY buffer signals an error
|
|
382
|
+
* (non-coplanar / open input / malformed input); a valid but EMPTY result
|
|
383
|
+
* (e.g. disjoint intersect) is the non-empty `[0]` packing.
|
|
384
|
+
*/
|
|
385
|
+
export function curve_region_boolean(a_data: Float64Array, b_data: Float64Array, op: number): Float64Array;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* SPLIT two CLOSED, COPLANAR curves into ALL region boundaries (Rhino
|
|
389
|
+
* "region split"): the arrangement of A and B partitions the plane into the
|
|
390
|
+
* pieces inside-A-only, inside-B-only and inside-both; each bounded region's
|
|
391
|
+
* outer and hole loops are returned as their own closed curves.
|
|
392
|
+
*
|
|
393
|
+
* Inputs, plane/coplanarity handling, fidelity and orientation follow
|
|
394
|
+
* `curve_region_boolean`. Same multi-curve packing; empty buffer on error.
|
|
395
|
+
*/
|
|
396
|
+
export function curve_region_split(a_data: Float64Array, b_data: Float64Array): Float64Array;
|
|
397
|
+
|
|
324
398
|
/**
|
|
325
399
|
* Serialize a curve to a list of points for Three.js rendering
|
|
326
400
|
* Returns a flat array of coordinates: [x1, y1, z1, x2, y2, z2, ...]
|
|
@@ -879,6 +953,18 @@ export function mesh_rotate(vertex_count: number, buffer: Float64Array, ax: numb
|
|
|
879
953
|
*/
|
|
880
954
|
export function mesh_scale(vertex_count: number, buffer: Float64Array, sx: number, sy: number, sz: number): Float64Array;
|
|
881
955
|
|
|
956
|
+
/**
|
|
957
|
+
* Union of two OPEN oriented sheets (mesh A ∪ mesh B): mutual trim + join.
|
|
958
|
+
* A sheet's material is its FRONT half-space, so the union boundary keeps
|
|
959
|
+
* A's pieces BEHIND B and B's pieces BEHIND A (pieces in front of the other
|
|
960
|
+
* sheet are interior to the union material and are dropped), stitched at
|
|
961
|
+
* the shared intersection seam; regions the other operand never cuts are
|
|
962
|
+
* kept wholesale (coincident-overlap regions keep A's copy only). Rejects
|
|
963
|
+
* closed operands — those belong to the solid boolean. Returns one mesh
|
|
964
|
+
* buffer in the standard `[vertexCount, positions…, indices…]` layout.
|
|
965
|
+
*/
|
|
966
|
+
export function mesh_sheet_union(vertex_count_a: number, buffer_a: Float64Array, vertex_count_b: number, buffer_b: Float64Array, flags: string): Float64Array;
|
|
967
|
+
|
|
882
968
|
/**
|
|
883
969
|
* Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
|
|
884
970
|
* `outside` = the solid on the negative side of the surface, `inside` = the
|
|
@@ -1295,6 +1381,8 @@ export interface InitOutput {
|
|
|
1295
1381
|
readonly brep_primitive: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1296
1382
|
readonly brep_revolve_curve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
1297
1383
|
readonly brep_sheet_from_surface: (a: number, b: number) => [number, number];
|
|
1384
|
+
readonly brep_split_sheet_by_sheet_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1385
|
+
readonly brep_split_sheet_by_solid_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1298
1386
|
readonly brep_split_solid_by_sheet_op: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1299
1387
|
readonly brep_tessellate: (a: number, b: number, c: number) => [number, number];
|
|
1300
1388
|
readonly brep_tessellate_with_face_ranges: (a: number, b: number, c: number) => [number, number];
|
|
@@ -1309,6 +1397,8 @@ export interface InitOutput {
|
|
|
1309
1397
|
readonly create_circle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
1310
1398
|
readonly create_line: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1311
1399
|
readonly create_polyline: (a: number, b: number, c: number) => [number, number];
|
|
1400
|
+
readonly curve_region_boolean: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1401
|
+
readonly curve_region_split: (a: number, b: number, c: number, d: number) => [number, number];
|
|
1312
1402
|
readonly curve_to_points: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
1313
1403
|
readonly evaluate_nurbs_curve_at: (a: number, b: number, c: number) => [number, number];
|
|
1314
1404
|
readonly extrude_circle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => [number, number];
|
|
@@ -1401,6 +1491,7 @@ export interface InitOutput {
|
|
|
1401
1491
|
readonly mesh_raycast_many: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
1402
1492
|
readonly mesh_rotate: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
1403
1493
|
readonly mesh_scale: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
|
|
1494
|
+
readonly mesh_sheet_union: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
1404
1495
|
readonly mesh_solid_split_by_surface: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
|
1405
1496
|
readonly mesh_solid_split_plane: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => [number, number];
|
|
1406
1497
|
readonly mesh_split_by_surface_to_brep: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
|
package/src/wasm-bindings.js
CHANGED
|
@@ -36,7 +36,20 @@ export function arc_point_at(cx, cy, cz, nx, ny, nz, radius, start_angle, end_an
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Parametric BREP boolean: exact surface–surface intersection curves with
|
|
39
|
-
* trimmed-surface output.
|
|
39
|
+
* trimmed-surface output. Operands may be closed solids OR open sheets —
|
|
40
|
+
* the kernel dispatches on closedness (oriented-sheet convention: a sheet's
|
|
41
|
+
* "inside" is the FRONT of its normal):
|
|
42
|
+
* - closed × closed: full volumetric boolean.
|
|
43
|
+
* - sheet × solid: subtract keeps the sheet outside the solid, intersect
|
|
44
|
+
* keeps the inside.
|
|
45
|
+
* - solid × sheet: subtract keeps the capped half BEHIND the sheet normal,
|
|
46
|
+
* intersect the front half.
|
|
47
|
+
* - sheet × sheet: a sheet's material is its FRONT half-space, so union
|
|
48
|
+
* stitches A-BACK + B-BACK at the intersection edges (front pieces are
|
|
49
|
+
* interior to the union material; uncut pieces are kept, coincident
|
|
50
|
+
* overlaps keep A's copy); subtract keeps A's back pieces; intersect
|
|
51
|
+
* A's front pieces.
|
|
52
|
+
* - union of a solid and a sheet is not defined and returns an error.
|
|
40
53
|
* op: "union" | "intersect" | "subtract".
|
|
41
54
|
* Returns the result BREP as JSON, or {"error": "..."} on failure.
|
|
42
55
|
* @param {string} a_json
|
|
@@ -603,6 +616,62 @@ export function brep_sheet_from_surface(surface_data) {
|
|
|
603
616
|
}
|
|
604
617
|
}
|
|
605
618
|
|
|
619
|
+
/**
|
|
620
|
+
* Split an OPEN sheet BREP `a` by another OPEN sheet BREP `b`.
|
|
621
|
+
* Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
|
|
622
|
+
* `inside` = a's pieces in FRONT of b's oriented normal, `outside` = the
|
|
623
|
+
* pieces behind it (matching the oriented-sheet convention of
|
|
624
|
+
* `mesh_clip_polyline` and the sheet boolean dispatch).
|
|
625
|
+
* @param {string} a_json
|
|
626
|
+
* @param {string} b_json
|
|
627
|
+
* @param {number} tolerance
|
|
628
|
+
* @returns {string}
|
|
629
|
+
*/
|
|
630
|
+
export function brep_split_sheet_by_sheet_op(a_json, b_json, tolerance) {
|
|
631
|
+
let deferred3_0;
|
|
632
|
+
let deferred3_1;
|
|
633
|
+
try {
|
|
634
|
+
const ptr0 = passStringToWasm0(a_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
635
|
+
const len0 = WASM_VECTOR_LEN;
|
|
636
|
+
const ptr1 = passStringToWasm0(b_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
637
|
+
const len1 = WASM_VECTOR_LEN;
|
|
638
|
+
const ret = wasm.brep_split_sheet_by_sheet_op(ptr0, len0, ptr1, len1, tolerance);
|
|
639
|
+
deferred3_0 = ret[0];
|
|
640
|
+
deferred3_1 = ret[1];
|
|
641
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
642
|
+
} finally {
|
|
643
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Split an OPEN sheet BREP by a CLOSED solid BREP into containment sides.
|
|
649
|
+
* Returns {"inside": <brep|null>, "outside": <brep|null>} or {"error":...}:
|
|
650
|
+
* `inside` = the sheet pieces contained in the solid (ON-boundary pieces
|
|
651
|
+
* count as inside), `outside` = the rest. Both preserve the sheet's exact
|
|
652
|
+
* trimmed faces, pcurves and edges.
|
|
653
|
+
* @param {string} sheet_json
|
|
654
|
+
* @param {string} solid_json
|
|
655
|
+
* @param {number} tolerance
|
|
656
|
+
* @returns {string}
|
|
657
|
+
*/
|
|
658
|
+
export function brep_split_sheet_by_solid_op(sheet_json, solid_json, tolerance) {
|
|
659
|
+
let deferred3_0;
|
|
660
|
+
let deferred3_1;
|
|
661
|
+
try {
|
|
662
|
+
const ptr0 = passStringToWasm0(sheet_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
663
|
+
const len0 = WASM_VECTOR_LEN;
|
|
664
|
+
const ptr1 = passStringToWasm0(solid_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
665
|
+
const len1 = WASM_VECTOR_LEN;
|
|
666
|
+
const ret = wasm.brep_split_sheet_by_solid_op(ptr0, len0, ptr1, len1, tolerance);
|
|
667
|
+
deferred3_0 = ret[0];
|
|
668
|
+
deferred3_1 = ret[1];
|
|
669
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
670
|
+
} finally {
|
|
671
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
|
|
606
675
|
/**
|
|
607
676
|
* Split a closed solid BREP by a sheet BREP into BOTH capped halves.
|
|
608
677
|
* Returns {"negative": <brep|null>, "positive": <brep|null>} or {"error":...}.
|
|
@@ -873,6 +942,74 @@ export function create_polyline(coords, samples_per_segment) {
|
|
|
873
942
|
return v2;
|
|
874
943
|
}
|
|
875
944
|
|
|
945
|
+
/**
|
|
946
|
+
* 2D REGION boolean between two CLOSED, COPLANAR curves (Rhino CurveBoolean).
|
|
947
|
+
*
|
|
948
|
+
* Both inputs are standard NURBS curve encodings (the TS layer coerces
|
|
949
|
+
* circles/arcs/polylines/polycurves to exact NURBS first). The curves are
|
|
950
|
+
* projected onto a common plane (fitted from A, coplanarity verified),
|
|
951
|
+
* tessellated to polygons, arranged in 2D, classified by inside-A/inside-B
|
|
952
|
+
* (nonzero winding), and the result loops emitted per op. CLOSURE is
|
|
953
|
+
* verified kernel-side: each curve's endpoints must coincide within a
|
|
954
|
+
* scale-relative tolerance, open curves error out (never silently
|
|
955
|
+
* chord-closed).
|
|
956
|
+
*
|
|
957
|
+
* `op`: 0 = union, 1 = subtract (A − B), 2 = intersect.
|
|
958
|
+
*
|
|
959
|
+
* Result loops are POLYLINE (degree-1 NURBS) closed curves — Rhino-parity
|
|
960
|
+
* fidelity. Tessellation samples include every distinct interior knot value,
|
|
961
|
+
* so degree-1 polygon corners and C0 kinks are preserved EXACTLY, and
|
|
962
|
+
* consecutive collinear points are collapsed so straight runs come back as
|
|
963
|
+
* single segments. Outer boundaries are CCW (positive plane-signed area),
|
|
964
|
+
* holes CW. CCW is measured about a DETERMINISTIC plane normal: the normal
|
|
965
|
+
* fitted from curve A, flipped so its dominant world-axis component is
|
|
966
|
+
* positive (for XY-plane curves the reference is +Z). The orientation is
|
|
967
|
+
* therefore independent of the inputs' drawing direction. Callers
|
|
968
|
+
* reconstruct nesting from the winding sign.
|
|
969
|
+
*
|
|
970
|
+
* Packing: `[curveCount, (bufLen, curveData…)·curveCount]` (same multi-curve
|
|
971
|
+
* packing as `nurbs_curve_split_at_params`). An EMPTY buffer signals an error
|
|
972
|
+
* (non-coplanar / open input / malformed input); a valid but EMPTY result
|
|
973
|
+
* (e.g. disjoint intersect) is the non-empty `[0]` packing.
|
|
974
|
+
* @param {Float64Array} a_data
|
|
975
|
+
* @param {Float64Array} b_data
|
|
976
|
+
* @param {number} op
|
|
977
|
+
* @returns {Float64Array}
|
|
978
|
+
*/
|
|
979
|
+
export function curve_region_boolean(a_data, b_data, op) {
|
|
980
|
+
const ptr0 = passArrayF64ToWasm0(a_data, wasm.__wbindgen_malloc);
|
|
981
|
+
const len0 = WASM_VECTOR_LEN;
|
|
982
|
+
const ptr1 = passArrayF64ToWasm0(b_data, wasm.__wbindgen_malloc);
|
|
983
|
+
const len1 = WASM_VECTOR_LEN;
|
|
984
|
+
const ret = wasm.curve_region_boolean(ptr0, len0, ptr1, len1, op);
|
|
985
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
986
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
987
|
+
return v3;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* SPLIT two CLOSED, COPLANAR curves into ALL region boundaries (Rhino
|
|
992
|
+
* "region split"): the arrangement of A and B partitions the plane into the
|
|
993
|
+
* pieces inside-A-only, inside-B-only and inside-both; each bounded region's
|
|
994
|
+
* outer and hole loops are returned as their own closed curves.
|
|
995
|
+
*
|
|
996
|
+
* Inputs, plane/coplanarity handling, fidelity and orientation follow
|
|
997
|
+
* `curve_region_boolean`. Same multi-curve packing; empty buffer on error.
|
|
998
|
+
* @param {Float64Array} a_data
|
|
999
|
+
* @param {Float64Array} b_data
|
|
1000
|
+
* @returns {Float64Array}
|
|
1001
|
+
*/
|
|
1002
|
+
export function curve_region_split(a_data, b_data) {
|
|
1003
|
+
const ptr0 = passArrayF64ToWasm0(a_data, wasm.__wbindgen_malloc);
|
|
1004
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1005
|
+
const ptr1 = passArrayF64ToWasm0(b_data, wasm.__wbindgen_malloc);
|
|
1006
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1007
|
+
const ret = wasm.curve_region_split(ptr0, len0, ptr1, len1);
|
|
1008
|
+
var v3 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
1009
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
1010
|
+
return v3;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
876
1013
|
/**
|
|
877
1014
|
* Serialize a curve to a list of points for Three.js rendering
|
|
878
1015
|
* Returns a flat array of coordinates: [x1, y1, z1, x2, y2, z2, ...]
|
|
@@ -2800,6 +2937,35 @@ export function mesh_scale(vertex_count, buffer, sx, sy, sz) {
|
|
|
2800
2937
|
return v2;
|
|
2801
2938
|
}
|
|
2802
2939
|
|
|
2940
|
+
/**
|
|
2941
|
+
* Union of two OPEN oriented sheets (mesh A ∪ mesh B): mutual trim + join.
|
|
2942
|
+
* A sheet's material is its FRONT half-space, so the union boundary keeps
|
|
2943
|
+
* A's pieces BEHIND B and B's pieces BEHIND A (pieces in front of the other
|
|
2944
|
+
* sheet are interior to the union material and are dropped), stitched at
|
|
2945
|
+
* the shared intersection seam; regions the other operand never cuts are
|
|
2946
|
+
* kept wholesale (coincident-overlap regions keep A's copy only). Rejects
|
|
2947
|
+
* closed operands — those belong to the solid boolean. Returns one mesh
|
|
2948
|
+
* buffer in the standard `[vertexCount, positions…, indices…]` layout.
|
|
2949
|
+
* @param {number} vertex_count_a
|
|
2950
|
+
* @param {Float64Array} buffer_a
|
|
2951
|
+
* @param {number} vertex_count_b
|
|
2952
|
+
* @param {Float64Array} buffer_b
|
|
2953
|
+
* @param {string} flags
|
|
2954
|
+
* @returns {Float64Array}
|
|
2955
|
+
*/
|
|
2956
|
+
export function mesh_sheet_union(vertex_count_a, buffer_a, vertex_count_b, buffer_b, flags) {
|
|
2957
|
+
const ptr0 = passArrayF64ToWasm0(buffer_a, wasm.__wbindgen_malloc);
|
|
2958
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2959
|
+
const ptr1 = passArrayF64ToWasm0(buffer_b, wasm.__wbindgen_malloc);
|
|
2960
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2961
|
+
const ptr2 = passStringToWasm0(flags, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2962
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2963
|
+
const ret = wasm.mesh_sheet_union(vertex_count_a, ptr0, len0, vertex_count_b, ptr1, len1, ptr2, len2);
|
|
2964
|
+
var v4 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
2965
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
2966
|
+
return v4;
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2803
2969
|
/**
|
|
2804
2970
|
* Split a closed solid (mesh A) by a surface (mesh B) into BOTH capped solids.
|
|
2805
2971
|
* `outside` = the solid on the negative side of the surface, `inside` = the
|