CellGrid3D Module
Functions and values
| Function or value |
Description
|
Full Usage:
clear x y z grid
Parameters:
int
y : int
z : int
grid : CellGrid3D<'T>
Modifiers: inline Type parameters: 'T |
Clears a cell (sets to ValueNone). Silently ignores out-of-bounds coordinates. O(1).
|
|
Allocates a new grid. This is an O(Width * Height * Depth) operation that allocates a single contiguous array.
|
Full Usage:
get x y z grid
Parameters:
int
y : int
z : int
grid : CellGrid3D<'T>
Returns: 'T voption
Modifiers: inline Type parameters: 'T |
Retrieves a cell's value. Returns ValueNone for out-of-bounds coordinates. O(1).
|
Full Usage:
getWorldPos x y z grid
Parameters:
^a
y : ^b
z : ^c
grid : CellGrid3D<'T>
Returns: Vector3
Modifiers: inline Type parameters: ^a, ^b, ^c, 'T |
Projects a grid index (x, y, z) to its world-space position (corner of the cell). Does NOT validate bounds.
|
Full Usage:
iter action grid
Parameters:
int -> int -> int -> 'T -> unit
grid : CellGrid3D<'T>
Modifiers: inline Type parameters: 'T |
Iterates over every populated cell in the grid. Uses linear array traversal for optimal cache performance. Coordinates are derived from index only when content exists.
|
Full Usage:
iterVolume bounds action grid
Parameters:
BoundingBox
action : int -> int -> int -> 'T -> unit
grid : CellGrid3D<'T>
Modifiers: inline Type parameters: 'T |
Optimization for rendering: only iterates cells that intersect the given world-space bounds. Uses direct index calculation to avoid redundant bounds checks.
|
Full Usage:
set x y z content grid
Parameters:
int
y : int
z : int
content : 'T
grid : CellGrid3D<'T>
Modifiers: inline Type parameters: 'T |
Sets a cell's value. Silently ignores out-of-bounds coordinates to allow "painting off the edge" without crashing. O(1).
|
Mibo