@ifc-lite/wasm 4.5.1 → 4.7.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.7.0",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -1,6 +1,84 @@
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
+ * - `"malformed-operand"` — any of FOUR malformations, all rejected
14
+ * before the boolean runs, because computing on them would silently
15
+ * drop the offending triangle (or worse) rather than report the true
16
+ * operand:
17
+ * 1. `positionsA`/`positionsB` is not a flat `[x, y, z, …]` triple
18
+ * (length not a multiple of 3);
19
+ * 2. `indicesA`/`indicesB` has a length that is not a multiple of 3,
20
+ * so it does not describe whole triangles;
21
+ * 3. `indicesA`/`indicesB` references a vertex past the end of its own
22
+ * operand's positions;
23
+ * 4. a position is **non-finite** (NaN or infinity). This one is worth
24
+ * calling out to callers: a NaN coordinate is caught by neither
25
+ * length check, and left alone it can be absorbed into a
26
+ * normal-looking answer or corrupt a face enough to report a
27
+ * genuinely overlapping pair as `"no-overlap"`. So if you are
28
+ * debugging an unexpected `"no-overlap"`, check your inputs for
29
+ * NaN — it surfaces here, not there.
30
+ * - `"empty-operand"` — an operand had no triangles.
31
+ * - `"no-overlap"` — the exact intersection is empty. Covers a disjoint
32
+ * pair AND a *touching* pair, including any graze below the kernel's
33
+ * `2^-16 m ≈ 15.26 µm` snap grid (both faces snap flush).
34
+ * - `"below-kernel-resolution"` — the pair overlaps, but too shallowly for
35
+ * the kernel to resolve as a solid rather than a coplanar contact. See
36
+ * `thicknessM` / `requiredM`.
37
+ * - `"budget-exhausted"` — the escalation budget tripped; the arrangement
38
+ * is partial and nothing about it is trustworthy.
39
+ */
40
+ readonly degenerateReason: string;
41
+ /**
42
+ * Triangle indices into `positions / 3`.
43
+ */
44
+ readonly indices: Uint32Array;
45
+ /**
46
+ * True when a trustworthy overlap solid was produced. When false, every
47
+ * geometry getter is empty and `degenerateReason` says why.
48
+ */
49
+ readonly isSolid: boolean;
50
+ /**
51
+ * World-space vertex positions, flat `[x, y, z, …]`, f64.
52
+ *
53
+ * f64 rather than the f32 the rest of the mesh pipeline uses because the
54
+ * caller reports this solid's volume: the f32 round-trip costs ~1e-7
55
+ * relative, a thousand times the exactness the kernel actually delivers.
56
+ * Downcast to f32 at the GPU upload if the renderer wants it.
57
+ */
58
+ readonly positions: Float64Array;
59
+ /**
60
+ * For `"below-kernel-resolution"`: the depth this pair would have needed
61
+ * for the kernel to resolve a solid, in metres. `0` otherwise. Grows with
62
+ * distance from the world origin, as the kernel's own tolerance does.
63
+ */
64
+ readonly requiredM: number;
65
+ /**
66
+ * For `"below-kernel-resolution"`: the overlap's measured thinnest extent,
67
+ * in metres. `0` otherwise. Useful to tell the user how shallow the clash
68
+ * is even though no solid can be drawn.
69
+ */
70
+ readonly thicknessM: number;
71
+ /**
72
+ * Triangle count of the solid; `0` when degenerate.
73
+ */
74
+ readonly triangleCount: number;
75
+ /**
76
+ * Enclosed volume in m³. `0` when not a solid — check `isSolid` first;
77
+ * "no measurable overlap" and "an overlap of zero" are different claims.
78
+ */
79
+ readonly volumeM3: number;
80
+ }
81
+
4
82
  /**
5
83
  * Packed result of one rule run. Parallel arrays, one entry per clash record;
6
84
  * `points` has 3 per record and `bounds` has 6 per record.
@@ -13,6 +91,7 @@ export class ClashRunResult {
13
91
  readonly b: Uint32Array;
14
92
  readonly bounds: Float64Array;
15
93
  readonly distance: Float64Array;
94
+ readonly distanceKind: Uint8Array;
16
95
  readonly points: Float64Array;
17
96
  readonly status: Uint8Array;
18
97
  }
@@ -1600,6 +1679,24 @@ export class ZoneSplitJs {
1600
1679
  readonly wholeVolume: number;
1601
1680
  }
1602
1681
 
1682
+ /**
1683
+ * Compute the intersection solid of one clashing pair.
1684
+ *
1685
+ * `positionsA` / `positionsB` are flat world-space XYZ; `indicesA` /
1686
+ * `indicesB` are flat triangle indices into their own operand.
1687
+ *
1688
+ * ```javascript
1689
+ * const solid = clashIntersectionSolid(posA, idxA, posB, idxB);
1690
+ * if (solid.isSolid) {
1691
+ * draw(solid.positions, solid.indices, solid.volumeM3);
1692
+ * } else {
1693
+ * keepContactMarker(solid.degenerateReason); // e.g. "no-overlap"
1694
+ * }
1695
+ * solid.free();
1696
+ * ```
1697
+ */
1698
+ export function clashIntersectionSolid(positions_a: Float32Array, indices_a: Uint32Array, positions_b: Float32Array, indices_b: Uint32Array): ClashIntersectionSolidJs;
1699
+
1603
1700
  /**
1604
1701
  * `a - b`, keeping EVERY disjoint remnant.
1605
1702
  *
@@ -1724,6 +1821,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1724
1821
 
1725
1822
  export interface InitOutput {
1726
1823
  readonly memory: WebAssembly.Memory;
1824
+ readonly __wbg_clashintersectionsolidjs_free: (a: number, b: number) => void;
1727
1825
  readonly __wbg_clashrunresult_free: (a: number, b: number) => void;
1728
1826
  readonly __wbg_clashsession_free: (a: number, b: number) => void;
1729
1827
  readonly __wbg_contours2d_free: (a: number, b: number) => void;
@@ -1745,10 +1843,20 @@ export interface InitOutput {
1745
1843
  readonly __wbg_symbolictext_free: (a: number, b: number) => void;
1746
1844
  readonly __wbg_zonepiecejs_free: (a: number, b: number) => void;
1747
1845
  readonly __wbg_zonesplitjs_free: (a: number, b: number) => void;
1846
+ readonly clashIntersectionSolid: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
1847
+ readonly clashintersectionsolidjs_degenerateReason: (a: number, b: number) => void;
1848
+ readonly clashintersectionsolidjs_indices: (a: number, b: number) => void;
1849
+ readonly clashintersectionsolidjs_isSolid: (a: number) => number;
1850
+ readonly clashintersectionsolidjs_positions: (a: number, b: number) => void;
1851
+ readonly clashintersectionsolidjs_requiredM: (a: number) => number;
1852
+ readonly clashintersectionsolidjs_thicknessM: (a: number) => number;
1853
+ readonly clashintersectionsolidjs_triangleCount: (a: number) => number;
1854
+ readonly clashintersectionsolidjs_volumeM3: (a: number) => number;
1748
1855
  readonly clashrunresult_a: (a: number, b: number) => void;
1749
1856
  readonly clashrunresult_b: (a: number, b: number) => void;
1750
1857
  readonly clashrunresult_bounds: (a: number, b: number) => void;
1751
1858
  readonly clashrunresult_distance: (a: number, b: number) => void;
1859
+ readonly clashrunresult_distanceKind: (a: number, b: number) => void;
1752
1860
  readonly clashrunresult_points: (a: number, b: number) => void;
1753
1861
  readonly clashrunresult_status: (a: number, b: number) => void;
1754
1862
  readonly clashsession_ingest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
@@ -1974,12 +2082,10 @@ export interface InitOutput {
1974
2082
  readonly version: (a: number) => void;
1975
2083
  readonly zonepiecejs_indices: (a: number) => number;
1976
2084
  readonly zonepiecejs_positions: (a: number) => number;
1977
- readonly zonepiecejs_volume: (a: number) => number;
1978
2085
  readonly zonepiecejs_zoneIndex: (a: number) => number;
1979
2086
  readonly zonesplitjs_piece: (a: number, b: number) => number;
1980
2087
  readonly zonesplitjs_pieceCount: (a: number) => number;
1981
2088
  readonly zonesplitjs_remainderFailed: (a: number) => number;
1982
- readonly zonesplitjs_sumErrorRel: (a: number) => number;
1983
2089
  readonly init: () => void;
1984
2090
  readonly meshoutlinejs_contourCount: (a: number) => number;
1985
2091
  readonly symbolicpolyline_pointCount: (a: number) => number;
@@ -1996,6 +2102,8 @@ export interface InitOutput {
1996
2102
  readonly symbolictext_worldY: (a: number) => number;
1997
2103
  readonly symbolictext_x: (a: number) => number;
1998
2104
  readonly symbolictext_y: (a: number) => number;
2105
+ readonly zonepiecejs_volume: (a: number) => number;
2106
+ readonly zonesplitjs_sumErrorRel: (a: number) => number;
1999
2107
  readonly zonesplitjs_wholeVolume: (a: number) => number;
2000
2108
  readonly __wbindgen_export: (a: number, b: number) => number;
2001
2109
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
package/pkg/ifc-lite.js CHANGED
@@ -1,5 +1,159 @@
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
+ * - `"malformed-operand"` — any of FOUR malformations, all rejected
26
+ * before the boolean runs, because computing on them would silently
27
+ * drop the offending triangle (or worse) rather than report the true
28
+ * operand:
29
+ * 1. `positionsA`/`positionsB` is not a flat `[x, y, z, …]` triple
30
+ * (length not a multiple of 3);
31
+ * 2. `indicesA`/`indicesB` has a length that is not a multiple of 3,
32
+ * so it does not describe whole triangles;
33
+ * 3. `indicesA`/`indicesB` references a vertex past the end of its own
34
+ * operand's positions;
35
+ * 4. a position is **non-finite** (NaN or infinity). This one is worth
36
+ * calling out to callers: a NaN coordinate is caught by neither
37
+ * length check, and left alone it can be absorbed into a
38
+ * normal-looking answer or corrupt a face enough to report a
39
+ * genuinely overlapping pair as `"no-overlap"`. So if you are
40
+ * debugging an unexpected `"no-overlap"`, check your inputs for
41
+ * NaN — it surfaces here, not there.
42
+ * - `"empty-operand"` — an operand had no triangles.
43
+ * - `"no-overlap"` — the exact intersection is empty. Covers a disjoint
44
+ * pair AND a *touching* pair, including any graze below the kernel's
45
+ * `2^-16 m ≈ 15.26 µm` snap grid (both faces snap flush).
46
+ * - `"below-kernel-resolution"` — the pair overlaps, but too shallowly for
47
+ * the kernel to resolve as a solid rather than a coplanar contact. See
48
+ * `thicknessM` / `requiredM`.
49
+ * - `"budget-exhausted"` — the escalation budget tripped; the arrangement
50
+ * is partial and nothing about it is trustworthy.
51
+ * @returns {string}
52
+ */
53
+ get degenerateReason() {
54
+ let deferred1_0;
55
+ let deferred1_1;
56
+ try {
57
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
58
+ wasm.clashintersectionsolidjs_degenerateReason(retptr, this.__wbg_ptr);
59
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
60
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
61
+ deferred1_0 = r0;
62
+ deferred1_1 = r1;
63
+ return getStringFromWasm0(r0, r1);
64
+ } finally {
65
+ wasm.__wbindgen_add_to_stack_pointer(16);
66
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
67
+ }
68
+ }
69
+ /**
70
+ * Triangle indices into `positions / 3`.
71
+ * @returns {Uint32Array}
72
+ */
73
+ get indices() {
74
+ try {
75
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
76
+ wasm.clashintersectionsolidjs_indices(retptr, this.__wbg_ptr);
77
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
78
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
79
+ var v1 = getArrayU32FromWasm0(r0, r1).slice();
80
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
81
+ return v1;
82
+ } finally {
83
+ wasm.__wbindgen_add_to_stack_pointer(16);
84
+ }
85
+ }
86
+ /**
87
+ * True when a trustworthy overlap solid was produced. When false, every
88
+ * geometry getter is empty and `degenerateReason` says why.
89
+ * @returns {boolean}
90
+ */
91
+ get isSolid() {
92
+ const ret = wasm.clashintersectionsolidjs_isSolid(this.__wbg_ptr);
93
+ return ret !== 0;
94
+ }
95
+ /**
96
+ * World-space vertex positions, flat `[x, y, z, …]`, f64.
97
+ *
98
+ * f64 rather than the f32 the rest of the mesh pipeline uses because the
99
+ * caller reports this solid's volume: the f32 round-trip costs ~1e-7
100
+ * relative, a thousand times the exactness the kernel actually delivers.
101
+ * Downcast to f32 at the GPU upload if the renderer wants it.
102
+ * @returns {Float64Array}
103
+ */
104
+ get positions() {
105
+ try {
106
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
107
+ wasm.clashintersectionsolidjs_positions(retptr, this.__wbg_ptr);
108
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
111
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
112
+ return v1;
113
+ } finally {
114
+ wasm.__wbindgen_add_to_stack_pointer(16);
115
+ }
116
+ }
117
+ /**
118
+ * For `"below-kernel-resolution"`: the depth this pair would have needed
119
+ * for the kernel to resolve a solid, in metres. `0` otherwise. Grows with
120
+ * distance from the world origin, as the kernel's own tolerance does.
121
+ * @returns {number}
122
+ */
123
+ get requiredM() {
124
+ const ret = wasm.clashintersectionsolidjs_requiredM(this.__wbg_ptr);
125
+ return ret;
126
+ }
127
+ /**
128
+ * For `"below-kernel-resolution"`: the overlap's measured thinnest extent,
129
+ * in metres. `0` otherwise. Useful to tell the user how shallow the clash
130
+ * is even though no solid can be drawn.
131
+ * @returns {number}
132
+ */
133
+ get thicknessM() {
134
+ const ret = wasm.clashintersectionsolidjs_thicknessM(this.__wbg_ptr);
135
+ return ret;
136
+ }
137
+ /**
138
+ * Triangle count of the solid; `0` when degenerate.
139
+ * @returns {number}
140
+ */
141
+ get triangleCount() {
142
+ const ret = wasm.clashintersectionsolidjs_triangleCount(this.__wbg_ptr);
143
+ return ret >>> 0;
144
+ }
145
+ /**
146
+ * Enclosed volume in m³. `0` when not a solid — check `isSolid` first;
147
+ * "no measurable overlap" and "an overlap of zero" are different claims.
148
+ * @returns {number}
149
+ */
150
+ get volumeM3() {
151
+ const ret = wasm.clashintersectionsolidjs_volumeM3(this.__wbg_ptr);
152
+ return ret;
153
+ }
154
+ }
155
+ if (Symbol.dispose) ClashIntersectionSolidJs.prototype[Symbol.dispose] = ClashIntersectionSolidJs.prototype.free;
156
+
3
157
  /**
4
158
  * Packed result of one rule run. Parallel arrays, one entry per clash record;
5
159
  * `points` has 3 per record and `bounds` has 6 per record.
@@ -85,6 +239,22 @@ export class ClashRunResult {
85
239
  wasm.__wbindgen_add_to_stack_pointer(16);
86
240
  }
87
241
  }
242
+ /**
243
+ * @returns {Uint8Array}
244
+ */
245
+ get distanceKind() {
246
+ try {
247
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
248
+ wasm.clashrunresult_distanceKind(retptr, this.__wbg_ptr);
249
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
250
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
251
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
252
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
253
+ return v1;
254
+ } finally {
255
+ wasm.__wbindgen_add_to_stack_pointer(16);
256
+ }
257
+ }
88
258
  /**
89
259
  * @returns {Float64Array}
90
260
  */
@@ -4400,6 +4570,40 @@ export class ZoneSplitJs {
4400
4570
  }
4401
4571
  if (Symbol.dispose) ZoneSplitJs.prototype[Symbol.dispose] = ZoneSplitJs.prototype.free;
4402
4572
 
4573
+ /**
4574
+ * Compute the intersection solid of one clashing pair.
4575
+ *
4576
+ * `positionsA` / `positionsB` are flat world-space XYZ; `indicesA` /
4577
+ * `indicesB` are flat triangle indices into their own operand.
4578
+ *
4579
+ * ```javascript
4580
+ * const solid = clashIntersectionSolid(posA, idxA, posB, idxB);
4581
+ * if (solid.isSolid) {
4582
+ * draw(solid.positions, solid.indices, solid.volumeM3);
4583
+ * } else {
4584
+ * keepContactMarker(solid.degenerateReason); // e.g. "no-overlap"
4585
+ * }
4586
+ * solid.free();
4587
+ * ```
4588
+ * @param {Float32Array} positions_a
4589
+ * @param {Uint32Array} indices_a
4590
+ * @param {Float32Array} positions_b
4591
+ * @param {Uint32Array} indices_b
4592
+ * @returns {ClashIntersectionSolidJs}
4593
+ */
4594
+ export function clashIntersectionSolid(positions_a, indices_a, positions_b, indices_b) {
4595
+ const ptr0 = passArrayF32ToWasm0(positions_a, wasm.__wbindgen_export);
4596
+ const len0 = WASM_VECTOR_LEN;
4597
+ const ptr1 = passArray32ToWasm0(indices_a, wasm.__wbindgen_export);
4598
+ const len1 = WASM_VECTOR_LEN;
4599
+ const ptr2 = passArrayF32ToWasm0(positions_b, wasm.__wbindgen_export);
4600
+ const len2 = WASM_VECTOR_LEN;
4601
+ const ptr3 = passArray32ToWasm0(indices_b, wasm.__wbindgen_export);
4602
+ const len3 = WASM_VECTOR_LEN;
4603
+ const ret = wasm.clashIntersectionSolid(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
4604
+ return ClashIntersectionSolidJs.__wrap(ret);
4605
+ }
4606
+
4403
4607
  /**
4404
4608
  * `a - b`, keeping EVERY disjoint remnant.
4405
4609
  *
@@ -4782,6 +4986,9 @@ function __wbg_get_imports() {
4782
4986
  };
4783
4987
  }
4784
4988
 
4989
+ const ClashIntersectionSolidJsFinalization = (typeof FinalizationRegistry === 'undefined')
4990
+ ? { register: () => {}, unregister: () => {} }
4991
+ : new FinalizationRegistry(ptr => wasm.__wbg_clashintersectionsolidjs_free(ptr, 1));
4785
4992
  const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
4786
4993
  ? { register: () => {}, unregister: () => {} }
4787
4994
  : new FinalizationRegistry(ptr => wasm.__wbg_clashrunresult_free(ptr, 1));
Binary file