AStar.getIdPath

Returns an array with the ids of the points that form the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.

More...
struct AStar
@nogc nothrow
PoolIntArray
getIdPath
(
in long from_id
,
in long to_id
)

Detailed Description

var as = AStar.new()

as.add_point(1, Vector3(0,0,0)) as.add_point(2, Vector3(0,1,0), 1) # default weight is 1 as.add_point(3, Vector3(1,1,0)) as.add_point(4, Vector3(2,0,0))

as.connect_points(1, 2, false) as.connect_points(2, 3, false) as.connect_points(4, 3, false) as.connect_points(1, 4, false) as.connect_points(5, 4, false)

var res = as.get_id_path(1, 3) # returns 1, 2, 3

If you change the 2nd point's weight to 3, then the result will be $(D 1, 4, 3) instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.

Meta