distanceField

Single-source distance field: for each passable voxel, the shortest-path cost from source to that voxel. Unreachable voxels are absent from the result map. Useful when many agents share the same goal; compute the field once via multi-source distanceField, then look up distances per-voxel in O(1).


Multi-source distance field: for each passable voxel, the shortest-path cost from the nearest source in sources. The canonical use case is "distance from any charging-station voxel" for drone models — compute once at setup, then every drone follows the gradient toward zero in O(1) per step.

Sources themselves have distance 0. Unreachable voxels are absent from the result map.