Cauldron2D.Sectors.Sight (Cauldron2D v0.2.2)

Copy Markdown View Source

Whether one point in a sector map can see a body: the straight line between them must pass through every opening it crosses, between floor and ceiling.

Cauldron2D.Sectors.Sight.visible?(world, {x, y, eye_z}, %{x: tx, y: ty, z: tz, height: 56.0})

world is %{map:, blockmap:, sectors:} as Cauldron2D.Sectors.Move takes it. The look is a wedge from the eye to the target's feet and head; each opening crossed narrows it by its floor and its ceiling, and a one-sided line or a closed opening ends it. Bodies never block sight.

A level may carry a table of sector pairs known never to see each other; pass it as reject: {bits, sector_count} and those pairs are answered at once.

Summary

Functions

Whether eye — {x, y, z} — sees any of target. See the moduledoc.

Functions

visible?(world, eye, target, opts \\ [])

@spec visible?(
  Cauldron2D.Sectors.Move.world(),
  {number(), number(), number()},
  map(),
  keyword()
) ::
  boolean()

Whether eye — {x, y, z} — sees any of target. See the moduledoc.