Cauldron2D.Grid.Coarse.Regions (Cauldron2D v0.2.2)

Copy Markdown View Source

The regions of a grid for Cauldron2D.Grid.Coarse: within each block of block tiles a side, the open tiles joined edge to edge, numbered from 1.

build/3 returns:

  • :labels — a binary of one 32-bit region number for each tile, row by row, 0 for a tile that is not open
  • :count — how many regions there are
  • :spots — a tuple, the region numbered n at index n - 1, of the region's tile nearest its middle
  • :links — a tuple in the same order of [{region, cost}], the regions a region touches edge to edge across a block border, the cost the distance between spots
  • :components — a tuple in the same order of the number shared by every region that can reach every other

Summary

Functions

The regions of the tiles open? accepts in space, in blocks of block tiles.

Types

t()

@type t() :: %{
  labels: binary(),
  count: non_neg_integer(),
  spots: tuple(),
  links: tuple(),
  components: tuple()
}

Functions

build(open?, space, block)

@spec build(
  ({integer(), integer()} -> boolean()),
  Cauldron2D.Grid.Coarse.Space.t(),
  pos_integer()
) ::
  t()

The regions of the tiles open? accepts in space, in blocks of block tiles.