A little module for generating Von Neumann neighborhoods (i.e. the surrounding cells of a single cell in a grid) of arbitrary range and dimensions.
Inspired by and API-compatible with the moore module.
npm install von-neumann
Takes two arguments, returning an array of relative coordinates.
rangedetermines how large the neighborhood extends, and defaults to 1.
dimensionsdetermines how many dimensions the Von Neumann neighborhood covers - i.e. 2 will return the results for a 2D grid, and 3 will return the results for a 3D grid. May be any value above zero.
var vonNeumann =// 2D, 1 range:===0-1-1 0 1 00 1
1.0.1 (2017-06-29) :
- Faster implementation by Brandon Semilla
1.0.0 (2015-09-20) :
- First implementation