Header menu logo Mibo

Grid3DSpatial Module

Nested modules

Modules Description

Internal

Internal helpers for A* pathfinding. Not intended for direct use.

Functions and values

Function or value Description

distanceChebyshev x1 y1 z1 x2 y2 z2

Full Usage: distanceChebyshev x1 y1 z1 x2 y2 z2

Parameters:
    x1 : ^a
    y1 : ^c
    z1 : ^e
    x2 : ^b
    y2 : ^d
    z2 : ^f

Returns: int
Modifiers: inline
Type parameters: ^a, ^b, ^c, ^d, ^e, ^f

Chebyshev distance in 3D (diagonal = 1).

x1 : ^a
y1 : ^c
z1 : ^e
x2 : ^b
y2 : ^d
z2 : ^f
Returns: int

distanceEuclidean x1 y1 z1 x2 y2 z2

Full Usage: distanceEuclidean x1 y1 z1 x2 y2 z2

Parameters:
    x1 : ^a
    y1 : ^d
    z1 : ^g
    x2 : ^b
    y2 : ^e
    z2 : ^h

Returns: float32
Modifiers: inline
Type parameters: ^a, ^b, ^c, ^d, ^e, ^f, ^g, ^h, ^i

Euclidean distance in 3D.

x1 : ^a
y1 : ^d
z1 : ^g
x2 : ^b
y2 : ^e
z2 : ^h
Returns: float32

distanceManhattan x1 y1 z1 x2 y2 z2

Full Usage: distanceManhattan x1 y1 z1 x2 y2 z2

Parameters:
    x1 : ^a
    y1 : ^f
    z1 : ^j
    x2 : ^b
    y2 : ^e
    z2 : ^i

Returns: int
Modifiers: inline
Type parameters: ^a, ^b, ^c, ^d, ^e, ^f, ^g, ^h, ^i, ^j

Manhattan distance in 3D.

x1 : ^a
y1 : ^f
z1 : ^j
x2 : ^b
y2 : ^e
z2 : ^i
Returns: int

findPath startX startY startZ goalX goalY goalZ isPassable costFn grid

Full Usage: findPath startX startY startZ goalX goalY goalZ isPassable costFn grid

Parameters:
    startX : int
    startY : int
    startZ : int
    goalX : int
    goalY : int
    goalZ : int
    isPassable : int -> int -> int -> bool
    costFn : int -> int -> int -> int -> int -> int -> float32
    grid : CellGrid3D<'T>

Returns: (int * int * int)[] voption
Modifiers: inline
Type parameters: 'T

A* pathfinding on a 3D voxel grid. Returns the shortest path as an array of coordinates, or ValueNone if no path exists.

startX : int
startY : int
startZ : int
goalX : int
goalY : int
goalZ : int
isPassable : int -> int -> int -> bool
costFn : int -> int -> int -> int -> int -> int -> float32
grid : CellGrid3D<'T>
Returns: (int * int * int)[] voption

floodFill x y z predicate grid

Full Usage: floodFill x y z predicate grid

Parameters:
    x : int
    y : int
    z : int
    predicate : int -> int -> int -> bool
    grid : CellGrid3D<'T>

Returns: (int * int * int)[]
Modifiers: inline
Type parameters: 'T

Flood fill from (x, y, z) using BFS over 6-connected neighbors.

x : int
y : int
z : int
predicate : int -> int -> int -> bool
grid : CellGrid3D<'T>
Returns: (int * int * int)[]

inRange x y z range grid

Full Usage: inRange x y z range grid

Parameters:
    x : int32
    y : int32
    z : int32
    range : int
    grid : CellGrid3D<'T>

Returns: (int * int * int)[]
Modifiers: inline
Type parameters: 'T

Returns all cells within Chebyshev distance `range` of (x, y, z).

x : int32
y : int32
z : int32
range : int
grid : CellGrid3D<'T>
Returns: (int * int * int)[]

lineOfSight x1 y1 z1 x2 y2 z2 isBlocked grid

Full Usage: lineOfSight x1 y1 z1 x2 y2 z2 isBlocked grid

Parameters:
    x1 : int
    y1 : int
    z1 : int
    x2 : int
    y2 : int
    z2 : int
    isBlocked : int -> int -> int -> bool
    grid : CellGrid3D<'T>

Returns: bool
Modifiers: inline
Type parameters: 'T

Returns true if a 3D line from (x1,y1,z1) to (x2,y2,z2) is clear of blocked cells. Uses 3D Bresenham. Start not checked; goal IS checked.

x1 : int
y1 : int
z1 : int
x2 : int
y2 : int
z2 : int
isBlocked : int -> int -> int -> bool
grid : CellGrid3D<'T>
Returns: bool

lineOfSightCells x1 y1 z1 x2 y2 z2 isBlocked grid

Full Usage: lineOfSightCells x1 y1 z1 x2 y2 z2 isBlocked grid

Parameters:
    x1 : int
    y1 : int
    z1 : int
    x2 : int
    y2 : int
    z2 : int
    isBlocked : int -> int -> int -> bool
    grid : CellGrid3D<'T>

Returns: (int * int * int)[]
Modifiers: inline
Type parameters: 'T

Returns the visible cells along a 3D line from (x1,y1,z1) toward (x2,y2,z2), stopping at the first blocked cell.

x1 : int
y1 : int
z1 : int
x2 : int
y2 : int
z2 : int
isBlocked : int -> int -> int -> bool
grid : CellGrid3D<'T>
Returns: (int * int * int)[]

neighbors26 x y z grid

Full Usage: neighbors26 x y z grid

Parameters:
    x : int32
    y : int32
    z : int32
    grid : CellGrid3D<'T>

Returns: (int * int * int)[]
Modifiers: inline
Type parameters: 'T

Returns the 26 surrounding neighbors (face + edge + corner).

x : int32
y : int32
z : int32
grid : CellGrid3D<'T>
Returns: (int * int * int)[]

neighbors6 x y z grid

Full Usage: neighbors6 x y z grid

Parameters:
Returns: (int * int * int)[]
Modifiers: inline
Type parameters: 'T

Returns the 6 face-adjacent neighbors of (x, y, z).

x : int
y : int
z : int
grid : CellGrid3D<'T>
Returns: (int * int * int)[]

worldToCell worldPos grid

Full Usage: worldToCell worldPos grid

Parameters:
Returns: (int * int * int) voption
Modifiers: inline
Type parameters: 'T

Converts a world position to the nearest grid cell. Returns ValueNone if the position is outside the grid.

worldPos : Vector3
grid : CellGrid3D<'T>
Returns: (int * int * int) voption

Type something to start searching.