# `CauldronGPU.Sectors.Flats`
[🔗](https://github.com/jaman/cauldron/blob/v0.3.3/cauldron_gpu/lib/cauldron_gpu/sectors/flats.ex#L2)

Floors and ceilings of a sector map as `CauldronGPU.Sectors.Surfaces` surfaces.

Each subsector of the map's BSP becomes one convex polygon: the map's bounds cut by
every partition line above it, then by each of its own segs. The polygons cover every
sector, concave or holed, without gaps. Floors face up, ceilings down; both are
textured in map space, one picture's width and height a repeat, and keyed
`{:picture, id}`. Sectors whose ceiling (or floor) picture is in `sky` get no ceiling
(or floor).

    CauldronGPU.Sectors.Flats.surfaces(map, pictures, MapSet.new([sky_flat]))

# `polygon`

```elixir
@type polygon() :: [Cauldron2D.Sectors.Map.point()]
```

# `polygons`

```elixir
@spec polygons(Cauldron2D.Sectors.Map.t()) :: [{non_neg_integer(), polygon()}]
```

Each subsector's convex polygon, counter-clockwise, as `{sector, points}`.

# `surfaces`

```elixir
@spec surfaces(
  Cauldron2D.Sectors.Map.t(),
  Cauldron2D.Sectors.Pictures.t(),
  MapSet.t()
) :: [
  CauldronGPU.Sectors.Surfaces.surface()
]
```

The floor and ceiling surfaces of every subsector of `map`, which must carry a BSP.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
