Companion

Functions

Link copied to clipboard
fun mooreNeighborhood(center: IntArray, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A Moore neighborhood includes all points where the Chebyshev distance (also called L∞ distance) from the center is less than or equal to the radius. The Chebyshev distance is the maximum absolute difference across all dimensions. This function uses a direct iteration around a bounding box.

Link copied to clipboard
fun mooreNeighborhoodBFS(center: IntArray, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A Moore neighborhood includes all points where the Chebyshev distance (also called L∞ distance) from the center is less than or equal to the radius. The Chebyshev distance is the maximum absolute difference across all dimensions. This function expands from the center outward using a breadth-first search to find the elements.

Link copied to clipboard
fun vonNeumannNeighborhood(center: IntArray, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A von Neumann neighborhood includes all points where the Manhattan distance (sum of absolute differences in all dimensions) from the center is less than or equal to the radius. This function uses a direct iteration around a bounding box.

Link copied to clipboard
fun vonNeumannNeighborhoodBFS(center: IntArray, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A von Neumann neighborhood includes all points where the Manhattan distance (sum of absolute differences in all dimensions) from the center is less than or equal to the radius. This function uses an outward expanding approach from the center point using breadth-first search (BFS).

Link copied to clipboard
fun zeroMooreNeighborhood(dimension: Int, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A Moore neighborhood includes all points where the Chebyshev distance (also called L∞ distance) from the center is less than or equal to the radius. The Chebyshev distance is the maximum absolute difference across all dimensions. This function uses a direct iteration around a bounding box. This function returns the Moore neighborhood around an array of zeroes of size dimension

Link copied to clipboard
fun zeroVonNeumannNeighborhood(dimension: Int, radius: Int = 1, includeCenter: Boolean = false): List<IntArray>

A von Neumann neighborhood includes all points where the Manhattan distance (sum of absolute differences in all dimensions) from the center is less than or equal to the radius. This function uses a direct iteration around a bounding box. This function returns the von Neumann neighborhood around an array of zeroes of size dimension