Package com.valhalla.sdk.api.pathing
Class ReachabilityMap
java.lang.Object
com.valhalla.sdk.api.pathing.ReachabilityMap
A single-pass breadth-first map of every tile reachable from one local origin.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReachabilityMapbuild(CollisionMap collision, Tile origin) Builds a breadth-first reachability snapshot from one origin.booleanTests whether a tile was reached by the breadth-first search.intgetDistance(Tile tile) Reads shortest transition distance from the origin.Returns the origin used to build this map.Reconstructs the shortest path from the origin.
-
Method Details
-
build
Builds a breadth-first reachability snapshot from one origin.- Parameters:
collision- collision snapshotorigin- represented, walkable origin tile- Returns:
- reachability map; all tiles are unreachable if the origin is invalid
-
getOrigin
Returns the origin used to build this map.- Returns:
- the origin used to build this map
-
canReach
Tests whether a tile was reached by the breadth-first search.- Parameters:
tile- tile to test- Returns:
truewhen reachable
-
getDistance
Reads shortest transition distance from the origin.- Parameters:
tile- destination tile- Returns:
- transition count, or
Integer.MAX_VALUEwhen unreachable
-
pathTo
Reconstructs the shortest path from the origin.- Parameters:
destination- destination tile- Returns:
- immutable inclusive path, or an empty list when unreachable
-