Build a plate from flat wall-axis segments.
segCoords: [ax, ay, bx, by, …] (length a multiple of 4).
segSources: one i32 per segment, -1 for none.
segHalfThickness: one f64 per segment — half the wall's thickness in
metres, carried onto the derived edges for netOutline. Pass an empty
array (or all zeros) when thickness is unknown (centreline only).
snapTolerance / minArea: pass <= 0 to take the defaults.
Author a new room from a flat ring [x0, y0, x1, y1, …] (no repeated
closing vertex). source -1 marks a user-drawn room. Winding is
normalised to CCW; returns the new room patch. The room is its own
connected component — it does not merge into existing topology.
Bounding half-edges of a face paired with their source element —
[{ edge, source }, …] — for IfcRelSpaceBoundary at bake.
Dissolve a degree-2 vertex, welding its two edges into one straight
edge between the neighbours — the inverse of splitEdge, and the
"delete this corner / node" affordance. Returns the rooms it changed.
Rejects a wall junction (degree ≥ 3) or a weld that would duplicate an
edge.
Move a vertex; returns the rooms it changed. A shared wall is one edge whose endpoints are shared vertices, so one drag updates both rooms.
Deep-copy the plate for an undo/redo snapshot. The clone owns its own
heap; the caller must .free() it like any handle.
Absolute area (m²) of a face.
Flat outline [x0, y0, x1, y1, …] of a face (no repeated closing vertex).
Nearest live vertex id to (x, y) within tol, or undefined.
Face-based gap-room boundary as flat [x0, y0, …]: each edge pushed
OUTWARD (into the wall) by factor × the source wall's half-thickness.
0 → net (the gap / inner faces); 1 → centre axis (½ thickness, the
editable node line on the wall mid); 2 → gross outer face.
Remove a shared wall, unioning the two rooms it separated. Returns the surviving room.
The room on the far side of a half-edge (its twin's face), or
undefined. O(1) — the "who's across this wall" query.
The face outline offset to a wall boundary, as flat [x0, y0, …]: each
edge is moved by its own wall's half-thickness — inward when inset
(the net / inner face), outward otherwise (the gross / outer face).
Shared room↔room edges are pinned when pushing outward. Falls back to the
centreline outline when no offset applies — so it's always a sane ring.
(For a center boundary just use faceOutline.)
Sweep the whole plate clean: remove dangling spur walls, isolated nodes,
and redundant collinear nodes — the "clean up orphans" / eraser action.
Area-neutral and idempotent. Returns how many topology elements were
pruned (0 = the plate was already clean); the caller re-renders via
snapshot like any other edit.
Remove a wall edge, choosing the right semantics from its two faces:
two real rooms → union them; a bridge / spur / outer-only wall → delete
it and auto-clean the orphaned inner lines and nodes it leaves; a real
enclosing wall (room ↔ exterior) → rejected (BordersExterior). This is
the "remove this wall and tidy up" affordance for the orphan cruft the
non-destructive wall arrangement leaves behind. Returns the rooms it
changed (empty if the edge bounded no room).
Face ids of every live room.
Set a face's floor / ceiling planes (the vertical dimension that turns a 2D face into a prismatic space at bake).
All live rooms as { face, area, simple, outline } patches.
Insert a new vertex at (x, y) on edge edge, subdividing it (no new
face). Returns the new vertex id — use it as a splitFace endpoint to
cut between points that weren't existing corners. Project (x, y) onto
the edge to keep areas unchanged.
Subdivide a face with a partition between two of its vertices. source
-1 marks a brand-new partition (materialised as a fresh wall at bake).
Returns the kept face and the new face.
StaticfromFACE-BASED build: rooms are the gaps between wall footprint rectangles.
rectCoords is flat [x0, y0, x1, y1, x2, y2, x3, y3, …] — 8 f64 per wall
(its 4 plan-rectangle corners, CCW). A bounded arrangement face is a room
only if its centroid is outside every rectangle (a gap, not a wall
interior). The room outline IS the net (inner-face) area; gapBoundary
gives the centre axis (½ thickness) and the gross outer face.
A persistent, editable floor-plate topology. See the module docs.