Detect enclosed regions from a set of 2D wall axis segments.
Pipeline:
Snap close vertices within snapTolerance (collapses tiny gaps
between wall ends that should meet at a corner).
Resolve pairwise segment intersections — each crossing splits
both segments into shorter pieces meeting at the new vertex.
Build a half-edge graph (DCEL): every undirected segment
becomes two opposing directed half-edges; per vertex, the
half-edges leaving it are ordered by polar angle so we can
find the next CCW-around-a-face neighbour in O(1).
Walk minimum cycles by always taking the leftmost turn. Each
half-edge belongs to exactly one face cycle.
Drop the outer (unbounded) face — the one with the most-
negative signed area.
Filter the remaining faces by minArea.
Pure: no IFC dependencies. Output is a list of CCW polygons
(outline) plus the signed area of each. Callers feed these into
the per-storey IfcSpace builder.
Detect enclosed regions from a set of 2D wall axis segments.
Pipeline:
snapTolerance(collapses tiny gaps between wall ends that should meet at a corner).minArea.Pure: no IFC dependencies. Output is a list of CCW polygons (
outline) plus the signed area of each. Callers feed these into the per-storey IfcSpace builder.