Function: buildNeighborMap()
ts
function buildNeighborMap(tiles): Map<number, number[]>;Pre-computes a neighbour map for all tiles on a hexasphere.
Two tiles are neighbours if they share an edge, i.e. at least 2 boundary points with identical coordinates (within 1e-6 precision). This works natively with pentagon tiles (5 edges) and avoids any icosahedron-face bookkeeping.
Call once per planet load — O(n * avg_boundary) where n = tile count.
Parameters
| Parameter | Type | Description |
|---|---|---|
tiles | readonly Tile[] | All tiles from HexasphereData. |
Returns
Map<number, number[]>
Map from tileId to the array of neighbour tileIds.