VoxelHeuristics

Pre-built heuristic functions for A* pathfinding on a VoxelGraph. All are admissible on uniform-cost grids (voxel costs all ≥ 1.0) under the appropriate movement rule:

HeuristicMovement ruleNotes
ZEROanyA* degenerates to Dijkstra
MANHATTANVON_NEUMANN_6tight for 6-way movement
CHEBYSHEVMOORE_26tight when all step costs are 1 (not the default)
OCTILEMOORE_26tight when orth = 1, face-diag = √2, body-diag = √3 (the default)
EUCLIDEANeitheralways admissible but never tight on a grid

Admissibility and voxel costs. Every non-ZERO heuristic assumes each step costs at least its geometric length — i.e. all voxel costs are ≥ 1.0. If any voxel cost is < 1.0 (including 0.0) these heuristics overestimate and A* may return a sub-optimal path; wrap the heuristic with scaled using VoxelGraph.minVoxelCost, or use ZERO (Dijkstra), which is always admissible.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ZERO: (Voxel, Voxel) -> Double

Functions

Link copied to clipboard
fun scaled(scale: Double, base: (Voxel, Voxel) -> Double): (Voxel, Voxel) -> Double

Scale base by scale (typically VoxelGraph.minVoxelCost) so it stays admissible on grids with voxel costs below 1.0. A scale of 0 yields ZERO.