Commonplace kernel API
    Preparing search index...

    Function subRegionOffset

    • Experimental

      ADR-026 Phase 2(b) — the one unified sub-region offset operation. Automatically dispatches an offset of an inscribed sub-region to either the kernel-native sub-thickness bump (extrudeFaceSubRegionBump) or the composer-substrate through-cut (carveSubRegionThroughHost), by measuring how far the sub-region can sweep inward before it crosses the host's opposite wall.

      This collapses the two Phase 2 entry points into the single user-facing operation ADR-026 §Status sub-phase (b) describes: "automatic distance-vs-thickness dispatch — picking bump vs through-cut based on inscribed-radius wall depth."

      Let wallDepth = measureSubRegionWallDepth(...).depth (the inward distance to the first opposite face; +Infinity when none).

      • Outward offset (distance >= 0) → always bump. An outward sweep moves into open air; there is no opposite wall in the outward direction to cross, so the kernel-native curvature-following sweep is always correct. The measured wallDepth (the geometry's inward depth) is not consulted for outward gestures — the dispatch is direction-aware, so a deep outward push past the far wall's distance still bumps.
      • Inward offset (distance < 0):
        • |distance| < wallDepth · (1 − {@link WALL_DEPTH_REL_TOL}) → bump (a recess that does not reach the far wall — exact, curvature-following).
        • |distance| >= wallDepth · (1 − {@link WALL_DEPTH_REL_TOL}) → through-cut (the window punches through; the back wall gains an inner loop per ADR-006, so the host's hole count H increments).

      The boundary |distance| == wallDepth resolves to the through-cut (see WALL_DEPTH_REL_TOL) — the safe side, since a bump exactly to the far wall would leave a degenerate zero-thickness sliver.

      Matches extrudeFaceSubRegionBump and ADR-014: distance > 0 bumps the inscribed face outward (along the host outward normal); distance < 0 pushes it inward. The through-cut is reached only by an inward gesture; its carveSubRegionThroughHost depth is derived from -|distance| over the inscribed face's outer-loop corners (CCW from outside), which extends the carve prism inward.

      The window is healed out of its wall first (healInscribedFace) and the cutter's two caps are placed in open air (OffsetPlan.cutterSpanInAir): it starts a margin above the window and, when the push ends on the far wall, runs a margin past it. A cap lying in a host face's plane, or a cutter wall running along the window's own edges, is where the composer left a zero-thickness floor (exact depth, axis-aligned) or a zero-volume second shell (any frame that is not axis-aligned). A window the heal declines (it carries a hole, or other geometry is attached to its corners) is carved with its loop in place and the flush start, as before. Verified: the result is a single closed shell of genus 1 (one tunnel) — V − E + F − H = 0, validateMesh clean.

      Parameters

      • host: HalfEdgeMesh

        The host mesh. Mutated in place on success (bump: side strips + translated face; through-cut: replaced topology).

      • hostFace: Face

        The face carrying the inner loop that outlines the inscribed sub-region.

      • innerLoopHalfEdge: HalfEdge

        A half-edge on the host's inner loop; .face must equal hostFace. Its twin bounds the inscribed face (the offset target).

      • distance: number

        Signed offset distance (see sign convention).

      Returns
          | { path: "bump"; translatedFace: Face; wallDepth: number }
          | { carved: boolean; path: "through-cut"; wallDepth: number }

      A discriminated result reporting which path ran: { path: 'bump', translatedFace } or { path: 'through-cut', carved } (carved is false only when the composer's WASM bridge wasn't ready — the host is left untouched and the caller may retry). The measured wallDepth is included for callers that want to surface it.

      If preconditions fail (the underlying bump / carve / measure functions throw — degenerate distance, wrong host face, no inner loops, one-sided inner loop, …).

      2026-Q2

      experimental — stable-by target: 2027-Q1