Header menu logo Mibo

CellGrid3D Module

Functions and values

Function or value Description

clear x y z grid

Full Usage: clear x y z grid

Parameters:
Modifiers: inline
Type parameters: 'T

Clears a cell (sets to ValueNone). Silently ignores out-of-bounds coordinates. O(1).

x : int
y : int
z : int
grid : CellGrid3D<'T>

create width height depth cellSize origin

Full Usage: create width height depth cellSize origin

Parameters:
    width : int
    height : int
    depth : int
    cellSize : Vector3
    origin : Vector3

Returns: CellGrid3D<'T>

Allocates a new grid. This is an O(Width * Height * Depth) operation that allocates a single contiguous array.

width : int
height : int
depth : int
cellSize : Vector3
origin : Vector3
Returns: CellGrid3D<'T>

get x y z grid

Full Usage: get x y z grid

Parameters:
Returns: 'T voption
Modifiers: inline
Type parameters: 'T

Retrieves a cell's value. Returns ValueNone for out-of-bounds coordinates. O(1).

x : int
y : int
z : int
grid : CellGrid3D<'T>
Returns: 'T voption

getWorldPos x y z grid

Full Usage: getWorldPos x y z grid

Parameters:
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.

x : ^a
y : ^b
z : ^c
grid : CellGrid3D<'T>
Returns: Vector3

iter action grid

Full Usage: iter action grid

Parameters:
    action : 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.

action : int -> int -> int -> 'T -> unit
grid : CellGrid3D<'T>

iterVolume bounds action grid

Full Usage: iterVolume bounds action grid

Parameters:
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.

bounds : BoundingBox
action : int -> int -> int -> 'T -> unit
grid : CellGrid3D<'T>

set x y z content grid

Full Usage: set x y z content grid

Parameters:
    x : 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).

x : int
y : int
z : int
content : 'T
grid : CellGrid3D<'T>

Type something to start searching.