@ifc-lite/wasm 4.5.1 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "4.5.1",
8
+ "version": "4.6.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -1,6 +1,67 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
 
4
+ /**
5
+ * The overlap solid of one clashing pair, or the reason there is none.
6
+ */
7
+ export class ClashIntersectionSolidJs {
8
+ private constructor();
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * `""` when `isSolid`, otherwise one of:
13
+ * - `"empty-operand"` — an operand had no triangles.
14
+ * - `"no-overlap"` — the exact intersection is empty. Covers a disjoint
15
+ * pair AND a *touching* pair, including any graze below the kernel's
16
+ * `2^-16 m ≈ 15.26 µm` snap grid (both faces snap flush).
17
+ * - `"below-kernel-resolution"` — the pair overlaps, but too shallowly for
18
+ * the kernel to resolve as a solid rather than a coplanar contact. See
19
+ * `thicknessM` / `requiredM`.
20
+ * - `"budget-exhausted"` — the escalation budget tripped; the arrangement
21
+ * is partial and nothing about it is trustworthy.
22
+ */
23
+ readonly degenerateReason: string;
24
+ /**
25
+ * Triangle indices into `positions / 3`.
26
+ */
27
+ readonly indices: Uint32Array;
28
+ /**
29
+ * True when a trustworthy overlap solid was produced. When false, every
30
+ * geometry getter is empty and `degenerateReason` says why.
31
+ */
32
+ readonly isSolid: boolean;
33
+ /**
34
+ * World-space vertex positions, flat `[x, y, z, …]`, f64.
35
+ *
36
+ * f64 rather than the f32 the rest of the mesh pipeline uses because the
37
+ * caller reports this solid's volume: the f32 round-trip costs ~1e-7
38
+ * relative, a thousand times the exactness the kernel actually delivers.
39
+ * Downcast to f32 at the GPU upload if the renderer wants it.
40
+ */
41
+ readonly positions: Float64Array;
42
+ /**
43
+ * For `"below-kernel-resolution"`: the depth this pair would have needed
44
+ * for the kernel to resolve a solid, in metres. `0` otherwise. Grows with
45
+ * distance from the world origin, as the kernel's own tolerance does.
46
+ */
47
+ readonly requiredM: number;
48
+ /**
49
+ * For `"below-kernel-resolution"`: the overlap's measured thinnest extent,
50
+ * in metres. `0` otherwise. Useful to tell the user how shallow the clash
51
+ * is even though no solid can be drawn.
52
+ */
53
+ readonly thicknessM: number;
54
+ /**
55
+ * Triangle count of the solid; `0` when degenerate.
56
+ */
57
+ readonly triangleCount: number;
58
+ /**
59
+ * Enclosed volume in m³. `0` when not a solid — check `isSolid` first;
60
+ * "no measurable overlap" and "an overlap of zero" are different claims.
61
+ */
62
+ readonly volumeM3: number;
63
+ }
64
+
4
65
  /**
5
66
  * Packed result of one rule run. Parallel arrays, one entry per clash record;
6
67
  * `points` has 3 per record and `bounds` has 6 per record.
@@ -1600,6 +1661,24 @@ export class ZoneSplitJs {
1600
1661
  readonly wholeVolume: number;
1601
1662
  }
1602
1663
 
1664
+ /**
1665
+ * Compute the intersection solid of one clashing pair.
1666
+ *
1667
+ * `positionsA` / `positionsB` are flat world-space XYZ; `indicesA` /
1668
+ * `indicesB` are flat triangle indices into their own operand.
1669
+ *
1670
+ * ```javascript
1671
+ * const solid = clashIntersectionSolid(posA, idxA, posB, idxB);
1672
+ * if (solid.isSolid) {
1673
+ * draw(solid.positions, solid.indices, solid.volumeM3);
1674
+ * } else {
1675
+ * keepContactMarker(solid.degenerateReason); // e.g. "no-overlap"
1676
+ * }
1677
+ * solid.free();
1678
+ * ```
1679
+ */
1680
+ export function clashIntersectionSolid(positions_a: Float32Array, indices_a: Uint32Array, positions_b: Float32Array, indices_b: Uint32Array): ClashIntersectionSolidJs;
1681
+
1603
1682
  /**
1604
1683
  * `a - b`, keeping EVERY disjoint remnant.
1605
1684
  *
@@ -1724,6 +1803,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1724
1803
 
1725
1804
  export interface InitOutput {
1726
1805
  readonly memory: WebAssembly.Memory;
1806
+ readonly __wbg_clashintersectionsolidjs_free: (a: number, b: number) => void;
1727
1807
  readonly __wbg_clashrunresult_free: (a: number, b: number) => void;
1728
1808
  readonly __wbg_clashsession_free: (a: number, b: number) => void;
1729
1809
  readonly __wbg_contours2d_free: (a: number, b: number) => void;
@@ -1745,6 +1825,15 @@ export interface InitOutput {
1745
1825
  readonly __wbg_symbolictext_free: (a: number, b: number) => void;
1746
1826
  readonly __wbg_zonepiecejs_free: (a: number, b: number) => void;
1747
1827
  readonly __wbg_zonesplitjs_free: (a: number, b: number) => void;
1828
+ readonly clashIntersectionSolid: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
1829
+ readonly clashintersectionsolidjs_degenerateReason: (a: number, b: number) => void;
1830
+ readonly clashintersectionsolidjs_indices: (a: number, b: number) => void;
1831
+ readonly clashintersectionsolidjs_isSolid: (a: number) => number;
1832
+ readonly clashintersectionsolidjs_positions: (a: number, b: number) => void;
1833
+ readonly clashintersectionsolidjs_requiredM: (a: number) => number;
1834
+ readonly clashintersectionsolidjs_thicknessM: (a: number) => number;
1835
+ readonly clashintersectionsolidjs_triangleCount: (a: number) => number;
1836
+ readonly clashintersectionsolidjs_volumeM3: (a: number) => number;
1748
1837
  readonly clashrunresult_a: (a: number, b: number) => void;
1749
1838
  readonly clashrunresult_b: (a: number, b: number) => void;
1750
1839
  readonly clashrunresult_bounds: (a: number, b: number) => void;
@@ -1974,12 +2063,10 @@ export interface InitOutput {
1974
2063
  readonly version: (a: number) => void;
1975
2064
  readonly zonepiecejs_indices: (a: number) => number;
1976
2065
  readonly zonepiecejs_positions: (a: number) => number;
1977
- readonly zonepiecejs_volume: (a: number) => number;
1978
2066
  readonly zonepiecejs_zoneIndex: (a: number) => number;
1979
2067
  readonly zonesplitjs_piece: (a: number, b: number) => number;
1980
2068
  readonly zonesplitjs_pieceCount: (a: number) => number;
1981
2069
  readonly zonesplitjs_remainderFailed: (a: number) => number;
1982
- readonly zonesplitjs_sumErrorRel: (a: number) => number;
1983
2070
  readonly init: () => void;
1984
2071
  readonly meshoutlinejs_contourCount: (a: number) => number;
1985
2072
  readonly symbolicpolyline_pointCount: (a: number) => number;
@@ -1996,6 +2083,8 @@ export interface InitOutput {
1996
2083
  readonly symbolictext_worldY: (a: number) => number;
1997
2084
  readonly symbolictext_x: (a: number) => number;
1998
2085
  readonly symbolictext_y: (a: number) => number;
2086
+ readonly zonepiecejs_volume: (a: number) => number;
2087
+ readonly zonesplitjs_sumErrorRel: (a: number) => number;
1999
2088
  readonly zonesplitjs_wholeVolume: (a: number) => number;
2000
2089
  readonly __wbindgen_export: (a: number, b: number) => number;
2001
2090
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -1,5 +1,142 @@
1
1
  /* @ts-self-types="./ifc-lite.d.ts" */
2
2
 
3
+ /**
4
+ * The overlap solid of one clashing pair, or the reason there is none.
5
+ */
6
+ export class ClashIntersectionSolidJs {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(ClashIntersectionSolidJs.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ ClashIntersectionSolidJsFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ ClashIntersectionSolidJsFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_clashintersectionsolidjs_free(ptr, 0);
22
+ }
23
+ /**
24
+ * `""` when `isSolid`, otherwise one of:
25
+ * - `"empty-operand"` — an operand had no triangles.
26
+ * - `"no-overlap"` — the exact intersection is empty. Covers a disjoint
27
+ * pair AND a *touching* pair, including any graze below the kernel's
28
+ * `2^-16 m ≈ 15.26 µm` snap grid (both faces snap flush).
29
+ * - `"below-kernel-resolution"` — the pair overlaps, but too shallowly for
30
+ * the kernel to resolve as a solid rather than a coplanar contact. See
31
+ * `thicknessM` / `requiredM`.
32
+ * - `"budget-exhausted"` — the escalation budget tripped; the arrangement
33
+ * is partial and nothing about it is trustworthy.
34
+ * @returns {string}
35
+ */
36
+ get degenerateReason() {
37
+ let deferred1_0;
38
+ let deferred1_1;
39
+ try {
40
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
41
+ wasm.clashintersectionsolidjs_degenerateReason(retptr, this.__wbg_ptr);
42
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
43
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
44
+ deferred1_0 = r0;
45
+ deferred1_1 = r1;
46
+ return getStringFromWasm0(r0, r1);
47
+ } finally {
48
+ wasm.__wbindgen_add_to_stack_pointer(16);
49
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
50
+ }
51
+ }
52
+ /**
53
+ * Triangle indices into `positions / 3`.
54
+ * @returns {Uint32Array}
55
+ */
56
+ get indices() {
57
+ try {
58
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
59
+ wasm.clashintersectionsolidjs_indices(retptr, this.__wbg_ptr);
60
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
61
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
62
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
63
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
64
+ return v1;
65
+ } finally {
66
+ wasm.__wbindgen_add_to_stack_pointer(16);
67
+ }
68
+ }
69
+ /**
70
+ * True when a trustworthy overlap solid was produced. When false, every
71
+ * geometry getter is empty and `degenerateReason` says why.
72
+ * @returns {boolean}
73
+ */
74
+ get isSolid() {
75
+ const ret = wasm.clashintersectionsolidjs_isSolid(this.__wbg_ptr);
76
+ return ret !== 0;
77
+ }
78
+ /**
79
+ * World-space vertex positions, flat `[x, y, z, …]`, f64.
80
+ *
81
+ * f64 rather than the f32 the rest of the mesh pipeline uses because the
82
+ * caller reports this solid's volume: the f32 round-trip costs ~1e-7
83
+ * relative, a thousand times the exactness the kernel actually delivers.
84
+ * Downcast to f32 at the GPU upload if the renderer wants it.
85
+ * @returns {Float64Array}
86
+ */
87
+ get positions() {
88
+ try {
89
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
90
+ wasm.clashintersectionsolidjs_positions(retptr, this.__wbg_ptr);
91
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
92
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
93
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
94
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
95
+ return v1;
96
+ } finally {
97
+ wasm.__wbindgen_add_to_stack_pointer(16);
98
+ }
99
+ }
100
+ /**
101
+ * For `"below-kernel-resolution"`: the depth this pair would have needed
102
+ * for the kernel to resolve a solid, in metres. `0` otherwise. Grows with
103
+ * distance from the world origin, as the kernel's own tolerance does.
104
+ * @returns {number}
105
+ */
106
+ get requiredM() {
107
+ const ret = wasm.clashintersectionsolidjs_requiredM(this.__wbg_ptr);
108
+ return ret;
109
+ }
110
+ /**
111
+ * For `"below-kernel-resolution"`: the overlap's measured thinnest extent,
112
+ * in metres. `0` otherwise. Useful to tell the user how shallow the clash
113
+ * is even though no solid can be drawn.
114
+ * @returns {number}
115
+ */
116
+ get thicknessM() {
117
+ const ret = wasm.clashintersectionsolidjs_thicknessM(this.__wbg_ptr);
118
+ return ret;
119
+ }
120
+ /**
121
+ * Triangle count of the solid; `0` when degenerate.
122
+ * @returns {number}
123
+ */
124
+ get triangleCount() {
125
+ const ret = wasm.clashintersectionsolidjs_triangleCount(this.__wbg_ptr);
126
+ return ret >>> 0;
127
+ }
128
+ /**
129
+ * Enclosed volume in m³. `0` when not a solid — check `isSolid` first;
130
+ * "no measurable overlap" and "an overlap of zero" are different claims.
131
+ * @returns {number}
132
+ */
133
+ get volumeM3() {
134
+ const ret = wasm.clashintersectionsolidjs_volumeM3(this.__wbg_ptr);
135
+ return ret;
136
+ }
137
+ }
138
+ if (Symbol.dispose) ClashIntersectionSolidJs.prototype[Symbol.dispose] = ClashIntersectionSolidJs.prototype.free;
139
+
3
140
  /**
4
141
  * Packed result of one rule run. Parallel arrays, one entry per clash record;
5
142
  * `points` has 3 per record and `bounds` has 6 per record.
@@ -4400,6 +4537,40 @@ export class ZoneSplitJs {
4400
4537
  }
4401
4538
  if (Symbol.dispose) ZoneSplitJs.prototype[Symbol.dispose] = ZoneSplitJs.prototype.free;
4402
4539
 
4540
+ /**
4541
+ * Compute the intersection solid of one clashing pair.
4542
+ *
4543
+ * `positionsA` / `positionsB` are flat world-space XYZ; `indicesA` /
4544
+ * `indicesB` are flat triangle indices into their own operand.
4545
+ *
4546
+ * ```javascript
4547
+ * const solid = clashIntersectionSolid(posA, idxA, posB, idxB);
4548
+ * if (solid.isSolid) {
4549
+ * draw(solid.positions, solid.indices, solid.volumeM3);
4550
+ * } else {
4551
+ * keepContactMarker(solid.degenerateReason); // e.g. "no-overlap"
4552
+ * }
4553
+ * solid.free();
4554
+ * ```
4555
+ * @param {Float32Array} positions_a
4556
+ * @param {Uint32Array} indices_a
4557
+ * @param {Float32Array} positions_b
4558
+ * @param {Uint32Array} indices_b
4559
+ * @returns {ClashIntersectionSolidJs}
4560
+ */
4561
+ export function clashIntersectionSolid(positions_a, indices_a, positions_b, indices_b) {
4562
+ const ptr0 = passArrayF32ToWasm0(positions_a, wasm.__wbindgen_export);
4563
+ const len0 = WASM_VECTOR_LEN;
4564
+ const ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_export);
4565
+ const len1 = WASM_VECTOR_LEN;
4566
+ const ptr2 = passArrayF32ToWasm0(positions_b, wasm.__wbindgen_export);
4567
+ const len2 = WASM_VECTOR_LEN;
4568
+ const ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_export);
4569
+ const len3 = WASM_VECTOR_LEN;
4570
+ const ret = wasm.clashIntersectionSolid(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
4571
+ return ClashIntersectionSolidJs.__wrap(ret);
4572
+ }
4573
+
4403
4574
  /**
4404
4575
  * `a - b`, keeping EVERY disjoint remnant.
4405
4576
  *
@@ -4782,6 +4953,9 @@ function __wbg_get_imports() {
4782
4953
  };
4783
4954
  }
4784
4955
 
4956
+ const ClashIntersectionSolidJsFinalization = (typeof FinalizationRegistry === 'undefined')
4957
+ ? { register: () => {}, unregister: () => {} }
4958
+ : new FinalizationRegistry(ptr => wasm.__wbg_clashintersectionsolidjs_free(ptr, 1));
4785
4959
  const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
4786
4960
  ? { register: () => {}, unregister: () => {} }
4787
4961
  : new FinalizationRegistry(ptr => wasm.__wbg_clashrunresult_free(ptr, 1));
Binary file