Import std.algo.grid
GridNeighbors
function
@PanicsAtCaller Public Function GridNeighbors(width: Int, height: Int, cell: Vec2i, diagonal: Bool = False): Vec2i[]
The cells next to cell on a grid of width by height, those on it only: the four along the
axes, right, down, left, and up, then, when diagonal, the four corners. A negative size, or a
cell off the grid, panics.
Examples
Expect(GridNeighbors(3, 3, Vec2i(0, 0)) == [Vec2i(1, 0), Vec2i(0, 1)])
Expect(GridNeighbors(3, 3, Vec2i(1, 1), True).Count == 8)Report an issue with this page or with FutureBlitz on GitHub.