Enum SquareAdjacency
Defines the neighborhood model used to determine which cells are considered adjacent in a square grid.
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public enum SquareAdjacency
Remarks
The choice of adjacency model has a direct impact on pathfinding heuristics, flood-fill results, and neighbor-query output:
- Use VonNeumann (4-connected) when movement is restricted to the four cardinal directions and the correct distance heuristic is Manhattan.
- Use Moore (8-connected) when diagonal movement is allowed and the correct distance heuristic is Octile or Chebyshev.
This enum is accepted by GetNeighborsNonAlloc(SquareCoord, Span<SquareCoord>, SquareAdjacency) and GetNeighborsNonAlloc(SquareCoord, Span<SquareCoord>, SquareAdjacency).
Fields
| Name | Description |
|---|---|
| Moore | 8-connected neighborhood: the four cardinal directions plus the four diagonal directions. Cells sharing an edge or a corner vertex with the origin cell are considered neighbors. Named after mathematician Edward F. Moore. |
| VonNeumann | 4-connected neighborhood: the cell to the north, south, east, and west. Only cells that share a full edge with the origin cell are considered neighbors. Named after mathematician John von Neumann. |