Function moore_neighbors

Source
pub fn moore_neighbors<const N: usize>() -> Vec<[isize; N]>
Expand description

Generates the Moore stencil for grids of arbitrary dimensionality.

The Moore neighborhood consists of all neighbors where each coordinate offset is in {-1, 0, 1}. In N dimensions, this yields 3^N - 1 neighbors (excluding the center point).

For example, in 3D, this returns offsets like:

[-1, -1, -1], [-1, -1, 0], ..., [1, 1, 1] (excluding [0, 0, 0])