# `Cauldron2D.Grid.Fov`
[🔗](https://github.com/jaman/cauldron/blob/v0.1.3/cauldron_2d/lib/cauldron_2d/grid/fov.ex#L1)

Recursive shadowcasting: which tiles an observer can see from where it stands.

    Cauldron2D.Grid.Fov.compute(&transparent?/1, {12, 9}, 8)
    #=> MapSet.new([{12, 9}, {12, 8}, ...])

The map is walked as eight octants, each a wedge scanned row by row away from the
observer; an opaque tile splits the wedge and what is behind it is not visited, so the
cost follows what is visible rather than the area of the circle.

Two rules a caller can rely on:

  * Walls bounding a lit area are lit: an opaque tile is added to the set before it
    stops the scan.
  * Visibility is mutual: if `b` is in the set computed from `a`, `a` is in the set
    computed from `b` at the same radius.

`transparent?` is a function from a tile to whether sight passes through it; a tile
outside the map should answer `false`. `origin` itself is always in the set.

# `point`

```elixir
@type point() :: {integer(), integer()}
```

# `transparent`

```elixir
@type transparent() :: (point() -&gt; boolean())
```

# `compute`

```elixir
@spec compute(transparent(), point(), pos_integer()) :: MapSet.t(point())
```

The set of tiles visible from `origin` within `radius`, measured as Euclidean distance.

---

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