• Approximate the pole-of-inaccessibility for a triangle-soup polygon, returned in projection-basis (u, v) space.

    Strategy:

    1. Project every position from world space onto the ProjectionBasis's (right, up) plane, building a u/v point list parallel to the original triangle indices.
    2. Walk the triangle list, summing the triangulated area (shoelace per triangle), and collect every triangle edge into a multiset. Edges shared between two triangles are interior; edges that appear exactly once are boundary. The boundary edge set is the polygon outline regardless of triangulation choice.
    3. Grid-sample the polygon's (u, v) AABB. At each sample point, run the standard winding-number point-in-polygon test against the boundary edges; if inside, compute the minimum distance to any boundary edge. The sample with the largest min-distance is the placement anchor; that distance is the inscribed radius.

    This is a coarse-grid approximation of the recursive subdivision used in Mapbox's polylabel — accurate to one cell at the chosen grid resolution, which is sub-decimetre at the default 32×32 grid on a typical 5–15 m room. Fine for label placement; not fine enough to drive a CAM tool.

    Returns null when the polygon has no boundary edges (every edge was shared by two triangles — degenerate input) or no grid sample landed inside.

    Parameters

    • fills: readonly FillPolygons[]

      Triangle soup for one source SceneObject. May span multiple SceneMeshes; their triangles are concatenated into a single polygon for placement.

    • basis: ProjectionBasis

      Projection basis used to flatten world positions to (u, v).

    • gridResolution: number = 32

      Number of grid cells along the longer side of the polygon's AABB. Default 32. Increase to push placement accuracy closer to the inscribed circle's true centre at the cost of O(N²) more samples.

    Returns LabelPlacement