# `Cauldron2D.Grid.Coarse.Space`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_2d/lib/cauldron_2d/grid/coarse/space.ex#L1)

Positions on a grid of `width` by `height` tiles whose opposite edges join when
`wrap?`, as `Cauldron2D.Grid.Coarse` measures them. Any map with those three keys is a
space.

    Space.delta(%{width: 10, height: 10, wrap?: true}, {9.5, 0.5}, {0.5, 0.5})
    #=> {1.0, 0.0}

# `t`

```elixir
@type t() :: %{
  :width =&gt; pos_integer(),
  :height =&gt; pos_integer(),
  :wrap? =&gt; boolean(),
  optional(atom()) =&gt; term()
}
```

# `delta`

```elixir
@spec delta(t(), {number(), number()}, {number(), number()}) :: {number(), number()}
```

How far `to` lies from `from` on each axis, the short way across joined edges.

# `distance`

```elixir
@spec distance(t(), {number(), number()}, {number(), number()}) :: float()
```

The straight distance from `a` to `b`, the short way across joined edges.

# `near`

```elixir
@spec near(t(), {number(), number()}, {number(), number()}) :: {number(), number()}
```

The place of `point` nearest `reference`: `point` itself, or on a wrapping grid the copy of it across the edges closest to `reference`.

# `tile`

```elixir
@spec tile(t(), {number(), number()}) :: {integer(), integer()} | nil
```

The tile holding `point`, brought onto the grid when it wraps, or nil when it lies off a grid that does not.

---

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