asobi_spatial_grid (asobi v0.35.4)

View Source

Summary

Types

cell_coords/0

-type cell_coords() :: {integer(), integer()}.

grid/0

-type grid() ::
          #{cell_size := number(),
            cells := #{cell_coords() => #{binary() => pos()}},
            entity_cells := #{binary() => cell_coords()}}.

pos/0

-type pos() :: {number(), number()}.

Functions

entities_in_cell(Cell, _)

-spec entities_in_cell(cell_coords(), grid()) -> [{binary(), pos()}].

insert(EntityId, Pos, Grid)

-spec insert(binary(), pos(), grid()) -> grid().

new(CellSize)

-spec new(number()) -> grid().

query_radius(_, Radius, _)

-spec query_radius(pos(), number(), grid()) -> [{binary(), pos()}].

query_rect(_, _, _)

-spec query_rect(pos(), pos(), grid()) -> [{binary(), pos()}].

remove(EntityId, Grid)

-spec remove(binary(), grid()) -> grid().

size(_)

-spec size(grid()) -> non_neg_integer().

update(EntityId, Pos, Grid)

-spec update(binary(), pos(), grid()) -> grid().