@ifc-lite/wasm 4.5.0 → 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.0",
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.
@@ -603,11 +664,13 @@ export class IfcAPI {
603
664
  * Enable or disable per-entity geometry fingerprinting in
604
665
  * `processGeometryBatch`, used by the viewer's revision-diff feature.
605
666
  *
606
- * Pass a positive `tolerance` (metres) to enable — it is the quantization
607
- * grid the hash snaps positions to (larger = more tolerant of float noise,
608
- * smaller = catches finer edits; the `f32` precision floor of model-local
609
- * coordinates means values below ~1 mm mostly hash noise). Pass `null`/
610
- * `undefined` (or a non-positive value) to disable. Default: disabled.
667
+ * Pass a positive `tolerance` (metres) to enable — the quantization grid
668
+ * positions snap to (larger tolerates more float noise, smaller catches
669
+ * finer edits; below the `f32` precision floor of model-local coordinates,
670
+ * ~1 mm, mostly hashes noise). Finer than
671
+ * `ifc_lite_geometry::MIN_GEOM_HASH_TOLERANCE` (1e-6 m) is clamped up to it
672
+ * — see that constant's doc for why (an `i128` overflow surface, not a
673
+ * precision win). `null`/`undefined`/non-positive disables. Default: off.
611
674
  */
612
675
  setComputeGeometryHashes(tolerance?: number | null): void;
613
676
  /**
@@ -1598,6 +1661,24 @@ export class ZoneSplitJs {
1598
1661
  readonly wholeVolume: number;
1599
1662
  }
1600
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
+
1601
1682
  /**
1602
1683
  * `a - b`, keeping EVERY disjoint remnant.
1603
1684
  *
@@ -1722,6 +1803,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1722
1803
 
1723
1804
  export interface InitOutput {
1724
1805
  readonly memory: WebAssembly.Memory;
1806
+ readonly __wbg_clashintersectionsolidjs_free: (a: number, b: number) => void;
1725
1807
  readonly __wbg_clashrunresult_free: (a: number, b: number) => void;
1726
1808
  readonly __wbg_clashsession_free: (a: number, b: number) => void;
1727
1809
  readonly __wbg_contours2d_free: (a: number, b: number) => void;
@@ -1743,6 +1825,15 @@ export interface InitOutput {
1743
1825
  readonly __wbg_symbolictext_free: (a: number, b: number) => void;
1744
1826
  readonly __wbg_zonepiecejs_free: (a: number, b: number) => void;
1745
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;
1746
1837
  readonly clashrunresult_a: (a: number, b: number) => void;
1747
1838
  readonly clashrunresult_b: (a: number, b: number) => void;
1748
1839
  readonly clashrunresult_bounds: (a: number, b: number) => void;
@@ -1972,12 +2063,10 @@ export interface InitOutput {
1972
2063
  readonly version: (a: number) => void;
1973
2064
  readonly zonepiecejs_indices: (a: number) => number;
1974
2065
  readonly zonepiecejs_positions: (a: number) => number;
1975
- readonly zonepiecejs_volume: (a: number) => number;
1976
2066
  readonly zonepiecejs_zoneIndex: (a: number) => number;
1977
2067
  readonly zonesplitjs_piece: (a: number, b: number) => number;
1978
2068
  readonly zonesplitjs_pieceCount: (a: number) => number;
1979
2069
  readonly zonesplitjs_remainderFailed: (a: number) => number;
1980
- readonly zonesplitjs_sumErrorRel: (a: number) => number;
1981
2070
  readonly init: () => void;
1982
2071
  readonly meshoutlinejs_contourCount: (a: number) => number;
1983
2072
  readonly symbolicpolyline_pointCount: (a: number) => number;
@@ -1994,6 +2083,8 @@ export interface InitOutput {
1994
2083
  readonly symbolictext_worldY: (a: number) => number;
1995
2084
  readonly symbolictext_x: (a: number) => number;
1996
2085
  readonly symbolictext_y: (a: number) => number;
2086
+ readonly zonepiecejs_volume: (a: number) => number;
2087
+ readonly zonesplitjs_sumErrorRel: (a: number) => number;
1997
2088
  readonly zonesplitjs_wholeVolume: (a: number) => number;
1998
2089
  readonly __wbindgen_export: (a: number, b: number) => number;
1999
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.
@@ -1708,11 +1845,13 @@ export class IfcAPI {
1708
1845
  * Enable or disable per-entity geometry fingerprinting in
1709
1846
  * `processGeometryBatch`, used by the viewer's revision-diff feature.
1710
1847
  *
1711
- * Pass a positive `tolerance` (metres) to enable — it is the quantization
1712
- * grid the hash snaps positions to (larger = more tolerant of float noise,
1713
- * smaller = catches finer edits; the `f32` precision floor of model-local
1714
- * coordinates means values below ~1 mm mostly hash noise). Pass `null`/
1715
- * `undefined` (or a non-positive value) to disable. Default: disabled.
1848
+ * Pass a positive `tolerance` (metres) to enable — the quantization grid
1849
+ * positions snap to (larger tolerates more float noise, smaller catches
1850
+ * finer edits; below the `f32` precision floor of model-local coordinates,
1851
+ * ~1 mm, mostly hashes noise). Finer than
1852
+ * `ifc_lite_geometry::MIN_GEOM_HASH_TOLERANCE` (1e-6 m) is clamped up to it
1853
+ * — see that constant's doc for why (an `i128` overflow surface, not a
1854
+ * precision win). `null`/`undefined`/non-positive disables. Default: off.
1716
1855
  * @param {number | null} [tolerance]
1717
1856
  */
1718
1857
  setComputeGeometryHashes(tolerance) {
@@ -4398,6 +4537,40 @@ export class ZoneSplitJs {
4398
4537
  }
4399
4538
  if (Symbol.dispose) ZoneSplitJs.prototype[Symbol.dispose] = ZoneSplitJs.prototype.free;
4400
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
+
4401
4574
  /**
4402
4575
  * `a - b`, keeping EVERY disjoint remnant.
4403
4576
  *
@@ -4614,6 +4787,10 @@ function __wbg_get_imports() {
4614
4787
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4615
4788
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4616
4789
  },
4790
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
4791
+ const ret = getObject(arg0) === undefined;
4792
+ return ret;
4793
+ },
4617
4794
  __wbg___wbindgen_memory_de265df8aadd6273: function() {
4618
4795
  const ret = wasm.memory;
4619
4796
  return addHeapObject(ret);
@@ -4728,6 +4905,22 @@ function __wbg_get_imports() {
4728
4905
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
4729
4906
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4730
4907
  },
4908
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
4909
+ const ret = typeof global === 'undefined' ? null : global;
4910
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4911
+ },
4912
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
4913
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
4914
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4915
+ },
4916
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
4917
+ const ret = typeof self === 'undefined' ? null : self;
4918
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4919
+ },
4920
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
4921
+ const ret = typeof window === 'undefined' ? null : window;
4922
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
4923
+ },
4731
4924
  __wbg_warn_b1370d804fa3e259: function(arg0) {
4732
4925
  console.warn(getObject(arg0));
4733
4926
  },
@@ -4760,6 +4953,9 @@ function __wbg_get_imports() {
4760
4953
  };
4761
4954
  }
4762
4955
 
4956
+ const ClashIntersectionSolidJsFinalization = (typeof FinalizationRegistry === 'undefined')
4957
+ ? { register: () => {}, unregister: () => {} }
4958
+ : new FinalizationRegistry(ptr => wasm.__wbg_clashintersectionsolidjs_free(ptr, 1));
4763
4959
  const ClashRunResultFinalization = (typeof FinalizationRegistry === 'undefined')
4764
4960
  ? { register: () => {}, unregister: () => {} }
4765
4961
  : new FinalizationRegistry(ptr => wasm.__wbg_clashrunresult_free(ptr, 1));
Binary file