Gtkada.Canvas_View.Astar

Entities

Array Types

Record Types

Constants

Subprograms

Description

This package implements the A* algorithm for optimal path finding

Coordinate

type Coordinate is record
   X, Y : Integer;
end record;
Record fields
X
Y

Coordinate_Array

type Coordinate_Array is array (Natural range <>) of Coordinate;

Find_Path

generic
   type User_Data is private;
   with function Heuristic_Cost
     (Self : User_Data; Parent, From, To : Coordinate) return Integer;
   with function Next_Point
     (Self : User_Data;
      From : Coordinate;
      Nth  : Positive) return Coordinate;
   with function Heuristic_Dist
      (Self : User_Data; P1, P2 : Coordinate) return Integer;
function Find_Path
  (Self     : User_Data;
   From, To : Coordinate;
   Parent   : Coordinate) return Coordinate_Array

Return the optimal path from From to To. Parent is the point that came before From (in case the first segment is imposed for instance, to get away from the item)

Generic formal parameters
User_Data
Heuristic_Cost
Next_Point
Heuristic_Dist
Parameters
Self
From
To
Parent
Return Value

Manhattan_Next_Point

generic
   type User_Data is private;
function Manhattan_Next_Point
  (Self : User_Data; From : Coordinate; Nth : Positive) return Coordinate

Points to the four possible neighboards in a horizontal and vertical grid.

Generic formal parameters
User_Data
Parameters
Self
From
Nth
Return Value

No_Coordinate

No_Coordinate : constant Coordinate;

Not_Traversable

Not_Traversable : constant Integer;