What a straight line across a sector map crosses, nearest first: the map's lines and
the bodies filed in a Cauldron2D.Sectors.Blockmap.
Cauldron2D.Sectors.Trace.run(map, blockmap, {x, y}, {x + 2048.0, y})
#=> [%{fraction: 0.12, line: 4}, %{fraction: 0.31, body: :imp_7, at: {..}, radius: 20.0}, ...]fraction is how far along from from to to the crossing is, 0.0..1.0. A line is
crossed where the trace meets it; a body where the trace first enters its circle, or at
0.0 where from is already inside it. Instant-hit weapons, line of sight, reaching for
a switch and sliding along a wall are all built on this.
Options
:lines— include lines. Defaulttrue:bodies— include bodies. Defaulttrue:except— a body id to leave out, such as the one tracing. Defaultnil
Summary
Functions
Where segment a1–a2 meets segment b1–b2, as a fraction along the first, or nil.
The intercepts from from to to, nearest first. See the moduledoc.
Types
Functions
@spec crossing( {number(), number()}, {number(), number()}, {number(), number()}, {number(), number()} ) :: float() | nil
Where segment a1–a2 meets segment b1–b2, as a fraction along the first, or nil.
@spec run( Cauldron2D.Sectors.Map.t(), Cauldron2D.Sectors.Blockmap.t(), {number(), number()}, {number(), number()}, keyword() ) :: [intercept()]
The intercepts from from to to, nearest first. See the moduledoc.