IFClite TypeScript API
    Preparing search index...

    Type Alias AutoSpaceVec2

    AutoSpaceVec2: [number, number]

    Detect enclosed regions from a set of 2D wall axis segments.

    Pipeline:

    1. Snap close vertices within snapTolerance (collapses tiny gaps between wall ends that should meet at a corner).
    2. Resolve pairwise segment intersections — each crossing splits both segments into shorter pieces meeting at the new vertex.
    3. 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).
    4. Walk minimum cycles by always taking the leftmost turn. Each half-edge belongs to exactly one face cycle.
    5. Drop the outer (unbounded) face — the one with the most- negative signed area.
    6. 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.