pub fn von_neumann_neighbors<const N: usize>() -> Vec<[isize; N]>
Expand description
Generates the von Neumann stencil for grids of arbitrary dimensionality.
The von Neumann neighborhood consists of all neighbors offset by
±1 along a single axis, with all other coordinates unchanged. In
n
dimensions, this yields 2 * n
neighbors.
For example, in 3D, this returns the offsets:
[-1, 0, 0], [1, 0, 0],
[0, -1, 0], [0, 1, 0],
[0, 0, -1], [0, 0, 1]