Hex2DSpatial Module
Nested modules
| Modules | Description |
|
Internal helpers for hex spatial operations. Not intended for direct use. |
Functions and values
| Function or value |
Description
|
Full Usage:
cubeRound fq fr fs
Parameters:
float32
fr : float32
fs : float32
Returns: int * int * int
Modifiers: inline |
Rounds fractional cube coordinates to the nearest integer hex.
|
Full Usage:
cubeToOffset q r orientation
Parameters:
int
r : int
orientation : HexOrientation
Returns: int * int
Modifiers: inline |
Converts cube (q, r, s) to offset (col, row) coordinates.
|
Full Usage:
distance c1 r1 c2 r2 grid
Parameters:
int
r1 : int
c2 : int
r2 : int
grid : HexGrid<'T>
Returns: int
Modifiers: inline Type parameters: 'T |
Hex distance using cube coordinates.
|
Full Usage:
findPath startCol startRow goalCol goalRow isPassable costFn grid
Parameters:
int
startRow : int
goalCol : int
goalRow : int
isPassable : int -> int -> bool
costFn : int -> int -> int -> int -> float32
grid : HexGrid<'T>
Returns: (int * int)[] voption
Modifiers: inline Type parameters: 'T |
A* pathfinding on a hex grid. Returns the shortest path from start to goal as an array of hex coordinates, or ValueNone if no path exists.
|
Full Usage:
floodFill col row predicate grid
Parameters:
int
row : int
predicate : int -> int -> bool
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Flood fill from (col, row) using BFS over hex neighbors. Returns all reachable hex cells for which `predicate` returns true.
|
Full Usage:
inRange col row range grid
Parameters:
int
row : int
range : int
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Returns all hex cells within `range` hex steps of (col, row).
|
Full Usage:
lineOfSight c1 r1 c2 r2 isBlocked grid
Parameters:
int
r1 : int
c2 : int
r2 : int
isBlocked : int -> int -> bool
grid : HexGrid<'T>
Returns: bool
Modifiers: inline Type parameters: 'T |
Returns true if a hex line from (c1,r1) to (c2,r2) is clear of blocked cells. The start cell is not checked; the goal IS checked.
|
Full Usage:
lineOfSightCells c1 r1 c2 r2 isBlocked grid
Parameters:
int
r1 : int
c2 : int
r2 : int
isBlocked : int -> int -> bool
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Returns the visible hex cells along a line from (c1,r1) toward (c2,r2), stopping at the first blocked cell.
|
Full Usage:
neighbors col row grid
Parameters:
int
row : int
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Returns the 6 hex neighbors of (col, row), filtered to grid bounds.
|
Full Usage:
offsetToCube col row orientation
Parameters:
int
row : int
orientation : HexOrientation
Returns: int * int * int
Modifiers: inline |
Converts offset (col, row) to cube (q, r, s) coordinates.
|
Full Usage:
ring col row radius grid
Parameters:
int
row : int
radius : int
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Returns all hex cells exactly `radius` hex steps from (col, row).
|
Full Usage:
spiral col row radius grid
Parameters:
int
row : int
radius : int
grid : HexGrid<'T>
Returns: (int * int)[]
Modifiers: inline Type parameters: 'T |
Returns all hex cells within `radius` hex steps, in spiral order (center first, then ring 1, ring 2, ...).
|
|
Mibo