# `Cauldron2D.Overlap`
[🔗](https://github.com/jaman/cauldron/blob/v0.2.2/cauldron_2d/lib/cauldron_2d/overlap.ex#L1)

Whether placed shapes (`Cauldron2D.Shape`) touch each other, a point, a rectangle, a
circle or a line.

Two shapes overlap when some world pixel's centre, `{x + 0.5, y + 0.5}`, lies inside
both. A rectangle query is a shape like any other; a circle covers the pixel centres
within its radius; a line is sampled every half pixel along its length, both ends
included.

    Cauldron2D.Overlap.shapes?(player, wall)
    Cauldron2D.Overlap.line?(wall, {0, 10}, {200, 10})

# `circle?`

```elixir
@spec circle?(Cauldron2D.Shape.t(), {number(), number()}, number()) :: boolean()
```

Whether `shape` shares a pixel with the circle of `radius` around `{x, y}`.

# `line?`

```elixir
@spec line?(Cauldron2D.Shape.t(), {number(), number()}, {number(), number()}) ::
  boolean()
```

Whether the segment from `from` to `to` passes through `shape`.

# `point?`

```elixir
@spec point?(Cauldron2D.Shape.t(), {number(), number()}) :: boolean()
```

Whether the world point `{x, y}` is inside `shape`.

# `rectangle?`

```elixir
@spec rectangle?(Cauldron2D.Shape.t(), {number(), number(), number(), number()}) ::
  boolean()
```

Whether `shape` shares a pixel with the rectangle `{left, top, right, bottom}`.

# `shapes?`

```elixir
@spec shapes?(Cauldron2D.Shape.t(), Cauldron2D.Shape.t()) :: boolean()
```

Whether `first` and `second` share a pixel.

---

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