@ifc-lite/wasm 2.8.1 → 2.9.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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "IFC-Lite Contributors"
6
6
  ],
7
7
  "description": "WebAssembly bindings for IFC-Lite",
8
- "version": "2.8.1",
8
+ "version": "2.9.1",
9
9
  "license": "MPL-2.0",
10
10
  "repository": {
11
11
  "type": "git",
package/pkg/ifc-lite.d.ts CHANGED
@@ -554,10 +554,53 @@ export class SpacePlateHandle {
554
554
  * surviving room.
555
555
  */
556
556
  mergeFaces(edge: number): any;
557
+ /**
558
+ * The face outline offset to a wall boundary, as flat `[x0, y0, …]`: each
559
+ * edge is moved by its own wall's half-thickness — inward when `inset`
560
+ * (the net / inner face), outward otherwise (the gross / outer face).
561
+ * Shared room↔room edges are pinned when pushing outward. Falls back to the
562
+ * centreline outline when no offset applies — so it's always a sane ring.
563
+ * (For a `center` boundary just use `faceOutline`.)
564
+ */
565
+ netOutline(face: number, inset: boolean): Float64Array;
566
+ /**
567
+ * Remove a wall edge, choosing the right semantics from its two faces:
568
+ * two real rooms → union them; a bridge / spur / outer-only wall → delete
569
+ * it and auto-clean the orphaned inner lines and nodes it leaves; a real
570
+ * enclosing wall (room ↔ exterior) → rejected (`BordersExterior`). This is
571
+ * the "remove this wall and tidy up" affordance for the orphan cruft the
572
+ * non-destructive wall arrangement leaves behind. Returns the rooms it
573
+ * changed (empty if the edge bounded no room).
574
+ */
575
+ removeEdge(edge: number): any;
557
576
  /**
558
577
  * Flat outline `[x0, y0, x1, y1, …]` of a face (no repeated closing vertex).
559
578
  */
560
579
  faceOutline(face: number): Float64Array;
580
+ /**
581
+ * Face-based gap-room boundary as flat `[x0, y0, …]`: each edge pushed
582
+ * OUTWARD (into the wall) by `factor × the source wall's half-thickness`.
583
+ * `0` → net (the gap / inner faces); `1` → centre axis (½ thickness, the
584
+ * editable node line on the wall mid); `2` → gross outer face.
585
+ */
586
+ gapBoundary(face: number, factor: number): Float64Array;
587
+ /**
588
+ * Dissolve a degree-2 vertex, welding its two edges into one straight
589
+ * edge between the neighbours — the inverse of `splitEdge`, and the
590
+ * "delete this corner / node" affordance. Returns the rooms it changed.
591
+ * Rejects a wall junction (degree ≥ 3) or a weld that would duplicate an
592
+ * edge.
593
+ */
594
+ dissolveVertex(v: number): any;
595
+ /**
596
+ * FACE-BASED build: rooms are the gaps between wall footprint rectangles.
597
+ * `rectCoords` is flat `[x0, y0, x1, y1, x2, y2, x3, y3, …]` — 8 f64 per wall
598
+ * (its 4 plan-rectangle corners, CCW). A bounded arrangement face is a room
599
+ * only if its centroid is outside every rectangle (a gap, not a wall
600
+ * interior). The room outline IS the net (inner-face) area; `gapBoundary`
601
+ * gives the centre axis (½ thickness) and the gross outer face.
602
+ */
603
+ static fromWallRects(rect_coords: Float64Array, snap_tolerance: number, min_area: number): SpacePlateHandle;
561
604
  /**
562
605
  * The room on the far side of a half-edge (its twin's face), or
563
606
  * `undefined`. O(1) — the "who's across this wall" query.
@@ -582,9 +625,27 @@ export class SpacePlateHandle {
582
625
  *
583
626
  * `segCoords`: `[ax, ay, bx, by, …]` (length a multiple of 4).
584
627
  * `segSources`: one `i32` per segment, `-1` for none.
628
+ * `segHalfThickness`: one `f64` per segment — half the wall's thickness in
629
+ * metres, carried onto the derived edges for `netOutline`. Pass an empty
630
+ * array (or all zeros) when thickness is unknown (centreline only).
585
631
  * `snapTolerance` / `minArea`: pass `<= 0` to take the defaults.
586
632
  */
587
- constructor(seg_coords: Float64Array, seg_sources: Int32Array, snap_tolerance: number, min_area: number);
633
+ constructor(seg_coords: Float64Array, seg_sources: Int32Array, seg_half_thickness: Float64Array, snap_tolerance: number, min_area: number);
634
+ /**
635
+ * Sweep the whole plate clean: remove dangling spur walls, isolated nodes,
636
+ * and redundant collinear nodes — the "clean up orphans" / eraser action.
637
+ * Area-neutral and idempotent. Returns how many topology elements were
638
+ * pruned (0 = the plate was already clean); the caller re-renders via
639
+ * `snapshot` like any other edit.
640
+ */
641
+ prune(): number;
642
+ /**
643
+ * Author a new room from a flat ring `[x0, y0, x1, y1, …]` (no repeated
644
+ * closing vertex). `source` `-1` marks a user-drawn room. Winding is
645
+ * normalised to CCW; returns the new room patch. The room is its own
646
+ * connected component — it does not merge into existing topology.
647
+ */
648
+ addFace(coords: Float64Array, source: number): any;
588
649
  /**
589
650
  * Face ids of every live room.
590
651
  */
@@ -916,15 +977,22 @@ export interface InitOutput {
916
977
  readonly profileentryjs_modelIndex: (a: number) => number;
917
978
  readonly profileentryjs_outerPoints: (a: number) => number;
918
979
  readonly profileentryjs_transform: (a: number) => number;
980
+ readonly spaceplatehandle_addFace: (a: number, b: number, c: number, d: number, e: number) => void;
919
981
  readonly spaceplatehandle_boundingElements: (a: number, b: number, c: number) => void;
982
+ readonly spaceplatehandle_dissolveVertex: (a: number, b: number, c: number) => void;
920
983
  readonly spaceplatehandle_dragVertex: (a: number, b: number, c: number, d: number, e: number) => void;
921
984
  readonly spaceplatehandle_duplicate: (a: number) => number;
922
985
  readonly spaceplatehandle_faceArea: (a: number, b: number) => number;
923
986
  readonly spaceplatehandle_faceOutline: (a: number, b: number, c: number) => void;
924
987
  readonly spaceplatehandle_findVertexNear: (a: number, b: number, c: number, d: number) => number;
988
+ readonly spaceplatehandle_fromWallRects: (a: number, b: number, c: number, d: number, e: number) => void;
989
+ readonly spaceplatehandle_gapBoundary: (a: number, b: number, c: number, d: number) => void;
925
990
  readonly spaceplatehandle_mergeFaces: (a: number, b: number, c: number) => void;
926
991
  readonly spaceplatehandle_neighborAcross: (a: number, b: number) => number;
927
- readonly spaceplatehandle_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
992
+ readonly spaceplatehandle_netOutline: (a: number, b: number, c: number, d: number) => void;
993
+ readonly spaceplatehandle_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
994
+ readonly spaceplatehandle_prune: (a: number) => number;
995
+ readonly spaceplatehandle_removeEdge: (a: number, b: number, c: number) => void;
928
996
  readonly spaceplatehandle_roomCount: (a: number) => number;
929
997
  readonly spaceplatehandle_roomIds: (a: number, b: number) => void;
930
998
  readonly spaceplatehandle_setFaceHeight: (a: number, b: number, c: number, d: number, e: number) => void;
package/pkg/ifc-lite.js CHANGED
@@ -1728,6 +1728,56 @@ export class SpacePlateHandle {
1728
1728
  wasm.__wbindgen_add_to_stack_pointer(16);
1729
1729
  }
1730
1730
  }
1731
+ /**
1732
+ * The face outline offset to a wall boundary, as flat `[x0, y0, …]`: each
1733
+ * edge is moved by its own wall's half-thickness — inward when `inset`
1734
+ * (the net / inner face), outward otherwise (the gross / outer face).
1735
+ * Shared room↔room edges are pinned when pushing outward. Falls back to the
1736
+ * centreline outline when no offset applies — so it's always a sane ring.
1737
+ * (For a `center` boundary just use `faceOutline`.)
1738
+ * @param {number} face
1739
+ * @param {boolean} inset
1740
+ * @returns {Float64Array}
1741
+ */
1742
+ netOutline(face, inset) {
1743
+ try {
1744
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1745
+ wasm.spaceplatehandle_netOutline(retptr, this.__wbg_ptr, face, inset);
1746
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1747
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1748
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
1749
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
1750
+ return v1;
1751
+ } finally {
1752
+ wasm.__wbindgen_add_to_stack_pointer(16);
1753
+ }
1754
+ }
1755
+ /**
1756
+ * Remove a wall edge, choosing the right semantics from its two faces:
1757
+ * two real rooms → union them; a bridge / spur / outer-only wall → delete
1758
+ * it and auto-clean the orphaned inner lines and nodes it leaves; a real
1759
+ * enclosing wall (room ↔ exterior) → rejected (`BordersExterior`). This is
1760
+ * the "remove this wall and tidy up" affordance for the orphan cruft the
1761
+ * non-destructive wall arrangement leaves behind. Returns the rooms it
1762
+ * changed (empty if the edge bounded no room).
1763
+ * @param {number} edge
1764
+ * @returns {any}
1765
+ */
1766
+ removeEdge(edge) {
1767
+ try {
1768
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1769
+ wasm.spaceplatehandle_removeEdge(retptr, this.__wbg_ptr, edge);
1770
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1771
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1772
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1773
+ if (r2) {
1774
+ throw takeObject(r1);
1775
+ }
1776
+ return takeObject(r0);
1777
+ } finally {
1778
+ wasm.__wbindgen_add_to_stack_pointer(16);
1779
+ }
1780
+ }
1731
1781
  /**
1732
1782
  * Flat outline `[x0, y0, x1, y1, …]` of a face (no repeated closing vertex).
1733
1783
  * @param {number} face
@@ -1746,6 +1796,81 @@ export class SpacePlateHandle {
1746
1796
  wasm.__wbindgen_add_to_stack_pointer(16);
1747
1797
  }
1748
1798
  }
1799
+ /**
1800
+ * Face-based gap-room boundary as flat `[x0, y0, …]`: each edge pushed
1801
+ * OUTWARD (into the wall) by `factor × the source wall's half-thickness`.
1802
+ * `0` → net (the gap / inner faces); `1` → centre axis (½ thickness, the
1803
+ * editable node line on the wall mid); `2` → gross outer face.
1804
+ * @param {number} face
1805
+ * @param {number} factor
1806
+ * @returns {Float64Array}
1807
+ */
1808
+ gapBoundary(face, factor) {
1809
+ try {
1810
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1811
+ wasm.spaceplatehandle_gapBoundary(retptr, this.__wbg_ptr, face, factor);
1812
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1813
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1814
+ var v1 = getArrayF64FromWasm0(r0, r1).slice();
1815
+ wasm.__wbindgen_export4(r0, r1 * 8, 8);
1816
+ return v1;
1817
+ } finally {
1818
+ wasm.__wbindgen_add_to_stack_pointer(16);
1819
+ }
1820
+ }
1821
+ /**
1822
+ * Dissolve a degree-2 vertex, welding its two edges into one straight
1823
+ * edge between the neighbours — the inverse of `splitEdge`, and the
1824
+ * "delete this corner / node" affordance. Returns the rooms it changed.
1825
+ * Rejects a wall junction (degree ≥ 3) or a weld that would duplicate an
1826
+ * edge.
1827
+ * @param {number} v
1828
+ * @returns {any}
1829
+ */
1830
+ dissolveVertex(v) {
1831
+ try {
1832
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1833
+ wasm.spaceplatehandle_dissolveVertex(retptr, this.__wbg_ptr, v);
1834
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1835
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1836
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1837
+ if (r2) {
1838
+ throw takeObject(r1);
1839
+ }
1840
+ return takeObject(r0);
1841
+ } finally {
1842
+ wasm.__wbindgen_add_to_stack_pointer(16);
1843
+ }
1844
+ }
1845
+ /**
1846
+ * FACE-BASED build: rooms are the gaps between wall footprint rectangles.
1847
+ * `rectCoords` is flat `[x0, y0, x1, y1, x2, y2, x3, y3, …]` — 8 f64 per wall
1848
+ * (its 4 plan-rectangle corners, CCW). A bounded arrangement face is a room
1849
+ * only if its centroid is outside every rectangle (a gap, not a wall
1850
+ * interior). The room outline IS the net (inner-face) area; `gapBoundary`
1851
+ * gives the centre axis (½ thickness) and the gross outer face.
1852
+ * @param {Float64Array} rect_coords
1853
+ * @param {number} snap_tolerance
1854
+ * @param {number} min_area
1855
+ * @returns {SpacePlateHandle}
1856
+ */
1857
+ static fromWallRects(rect_coords, snap_tolerance, min_area) {
1858
+ try {
1859
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1860
+ const ptr0 = passArrayF64ToWasm0(rect_coords, wasm.__wbindgen_export);
1861
+ const len0 = WASM_VECTOR_LEN;
1862
+ wasm.spaceplatehandle_fromWallRects(retptr, ptr0, len0, snap_tolerance, min_area);
1863
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1864
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1865
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1866
+ if (r2) {
1867
+ throw takeObject(r1);
1868
+ }
1869
+ return SpacePlateHandle.__wrap(r0);
1870
+ } finally {
1871
+ wasm.__wbindgen_add_to_stack_pointer(16);
1872
+ }
1873
+ }
1749
1874
  /**
1750
1875
  * The room on the far side of a half-edge (its twin's face), or
1751
1876
  * `undefined`. O(1) — the "who's across this wall" query.
@@ -1804,20 +1929,26 @@ export class SpacePlateHandle {
1804
1929
  *
1805
1930
  * `segCoords`: `[ax, ay, bx, by, …]` (length a multiple of 4).
1806
1931
  * `segSources`: one `i32` per segment, `-1` for none.
1932
+ * `segHalfThickness`: one `f64` per segment — half the wall's thickness in
1933
+ * metres, carried onto the derived edges for `netOutline`. Pass an empty
1934
+ * array (or all zeros) when thickness is unknown (centreline only).
1807
1935
  * `snapTolerance` / `minArea`: pass `<= 0` to take the defaults.
1808
1936
  * @param {Float64Array} seg_coords
1809
1937
  * @param {Int32Array} seg_sources
1938
+ * @param {Float64Array} seg_half_thickness
1810
1939
  * @param {number} snap_tolerance
1811
1940
  * @param {number} min_area
1812
1941
  */
1813
- constructor(seg_coords, seg_sources, snap_tolerance, min_area) {
1942
+ constructor(seg_coords, seg_sources, seg_half_thickness, snap_tolerance, min_area) {
1814
1943
  try {
1815
1944
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1816
1945
  const ptr0 = passArrayF64ToWasm0(seg_coords, wasm.__wbindgen_export);
1817
1946
  const len0 = WASM_VECTOR_LEN;
1818
1947
  const ptr1 = passArray32ToWasm0(seg_sources, wasm.__wbindgen_export);
1819
1948
  const len1 = WASM_VECTOR_LEN;
1820
- wasm.spaceplatehandle_new(retptr, ptr0, len0, ptr1, len1, snap_tolerance, min_area);
1949
+ const ptr2 = passArrayF64ToWasm0(seg_half_thickness, wasm.__wbindgen_export);
1950
+ const len2 = WASM_VECTOR_LEN;
1951
+ wasm.spaceplatehandle_new(retptr, ptr0, len0, ptr1, len1, ptr2, len2, snap_tolerance, min_area);
1821
1952
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1822
1953
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1823
1954
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -1831,6 +1962,44 @@ export class SpacePlateHandle {
1831
1962
  wasm.__wbindgen_add_to_stack_pointer(16);
1832
1963
  }
1833
1964
  }
1965
+ /**
1966
+ * Sweep the whole plate clean: remove dangling spur walls, isolated nodes,
1967
+ * and redundant collinear nodes — the "clean up orphans" / eraser action.
1968
+ * Area-neutral and idempotent. Returns how many topology elements were
1969
+ * pruned (0 = the plate was already clean); the caller re-renders via
1970
+ * `snapshot` like any other edit.
1971
+ * @returns {number}
1972
+ */
1973
+ prune() {
1974
+ const ret = wasm.spaceplatehandle_prune(this.__wbg_ptr);
1975
+ return ret >>> 0;
1976
+ }
1977
+ /**
1978
+ * Author a new room from a flat ring `[x0, y0, x1, y1, …]` (no repeated
1979
+ * closing vertex). `source` `-1` marks a user-drawn room. Winding is
1980
+ * normalised to CCW; returns the new room patch. The room is its own
1981
+ * connected component — it does not merge into existing topology.
1982
+ * @param {Float64Array} coords
1983
+ * @param {number} source
1984
+ * @returns {any}
1985
+ */
1986
+ addFace(coords, source) {
1987
+ try {
1988
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1989
+ const ptr0 = passArrayF64ToWasm0(coords, wasm.__wbindgen_export);
1990
+ const len0 = WASM_VECTOR_LEN;
1991
+ wasm.spaceplatehandle_addFace(retptr, this.__wbg_ptr, ptr0, len0, source);
1992
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1993
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1994
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1995
+ if (r2) {
1996
+ throw takeObject(r1);
1997
+ }
1998
+ return takeObject(r0);
1999
+ } finally {
2000
+ wasm.__wbindgen_add_to_stack_pointer(16);
2001
+ }
2002
+ }
1834
2003
  /**
1835
2004
  * Face ids of every live room.
1836
2005
  * @returns {Uint32Array}
@@ -2784,6 +2953,10 @@ function __wbg_get_imports() {
2784
2953
  const ret = new Error();
2785
2954
  return addHeapObject(ret);
2786
2955
  };
2956
+ imports.wbg.__wbg_new_df1173567d5ff028 = function(arg0, arg1) {
2957
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2958
+ return addHeapObject(ret);
2959
+ };
2787
2960
  imports.wbg.__wbg_new_from_slice_41e2764a343e3cb1 = function(arg0, arg1) {
2788
2961
  const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
2789
2962
  return addHeapObject(ret);
@@ -2828,6 +3001,9 @@ function __wbg_get_imports() {
2828
3001
  imports.wbg.__wbg_set_index_42abe35f117e614e = function(arg0, arg1, arg2) {
2829
3002
  getObject(arg0)[arg1 >>> 0] = arg2 >>> 0;
2830
3003
  };
3004
+ imports.wbg.__wbg_set_name_df69b75cb0b4de8a = function(arg0, arg1, arg2) {
3005
+ getObject(arg0).name = getStringFromWasm0(arg1, arg2);
3006
+ };
2831
3007
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
2832
3008
  const ret = getObject(arg1).stack;
2833
3009
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
Binary file