Documentation of 'Catalano.Graph.Pathfinding.AStar.AStar' Java class
AStar
Catalano.Graph.Pathfinding.AStar

Class AStar

  • All Implemented Interfaces:
    ISearch


    public class AStar
    extends java.lang.Object
    implements ISearch
    AStar pathfinding.
    • Constructor Detail

      • AStar

        public AStar(int width,
                     int height)
        Initializes a new instance of the AStar class.
        Parameters:
        width - Width of the Matrix.
        height - Height of the Matrix.
      • AStar

        public AStar(int width,
                     int height,
                     double initialCost)
        Initializes a new instance of the AStar class.
        Parameters:
        width - Width of the Matrix.
        height - Height of the Matrix.
        initialCost - Initial cost for all nodes.
      • AStar

        public AStar(double[][] costMap)
        Initializes a new instance of the AStar class.
        Parameters:
        costMap - Cost map.
      • AStar

        public AStar(double[][] costMap,
                     AStar.Neighbor neighbor,
                     AStar.Heuristic heuristic)
        Initializes a new instance of the AStar class.
        Parameters:
        costMap - Cost map.
        neighbor - Neighbor.
        heuristic - Heuristic.
      • AStar

        public AStar(int width,
                     int height,
                     double initialCost,
                     AStar.Neighbor neighbor,
                     AStar.Heuristic heuristic)
        Initializes a new instance of the AStar class.
        Parameters:
        width - Width of the matrix.
        height - Height of the matrix.
        initialCost - Initial cost for all the nodes.
        neighbor - Neighbor.
        heuristic - Heuristic.
    • Method Detail

      • getWidth

        public int getWidth()
        Get width of the map.
        Returns:
        Width.
      • getHeight

        public int getHeight()
        Get height of the map.
        Returns:
        Height.
      • getNeighbor

        public AStar.Neighbor getNeighbor()
        Get neighbor size of the algorithm.
        Returns:
        Neighbor.
      • setNeighbor

        public void setNeighbor(AStar.Neighbor neighbor)
        Set neighbor size of the algorithm.
        Parameters:
        neighbor - Neighbor.
      • getHeuristic

        public AStar.Heuristic getHeuristic()
        Get heuristic.
        Returns:
        Heuristic.
      • setHeuristic

        public void setHeuristic(AStar.Heuristic heuristic)
        Set heuristic.
        Parameters:
        heuristic - Heuristic.
      • addBlock

        public void addBlock(int x,
                             int y)
        Add block in the path. Is the same with the cust of the node equals zero.
        Parameters:
        x - X axis coordinate.
        y - Y axis coordinate.
      • removeBlock

        public void removeBlock(int x,
                                int y)
        Remove block in the path. Is the same with the cust of the node equals one.
        Parameters:
        x - X axis coordinate.
        y - Y axis coordinate.
      • isBlocked

        public boolean isBlocked(int x,
                                 int y)
        Verify if the actual node is blocked.
        Parameters:
        x - X axis coordinate.
        y - Y axis coordinate.
        Returns:
        True if is blocked, otherwise false.
      • getCost

        public double getCost(int x,
                              int y)
        Get cost from a point.
        Parameters:
        x - X axis coordinate.
        y - Y axis coordinate.
        Returns:
        Cost.
      • setCost

        public void setCost(int x,
                            int y,
                            double cost)
        Set cost.
        Parameters:
        x - X axis coordinate.
        y - Y axis coordinate.
        cost - Cost.
      • getNodeMap

        public NodeMap getNodeMap()
        Get node map.
        Returns:
        Node map.
      • getTotalCost

        public double getTotalCost(java.util.ArrayList<IntPoint> path)
        Get total cost.
        Parameters:
        path - List of the points.
        Returns:
        Total cost.
      • FindPath

        public java.util.ArrayList<IntPoint> FindPath(IntPoint start,
                                                      IntPoint end)
        Description copied from interface: ISearch
        Find path.
        Specified by:
        FindPath in interface ISearch
        Parameters:
        start - Start point.
        end - End point.
        Returns:
        List of points that contains the path.
      • FindPath

        public java.util.ArrayList<IntPoint> FindPath(int startX,
                                                      int startY,
                                                      int endX,
                                                      int endY)
        Description copied from interface: ISearch
        Find path.
        Specified by:
        FindPath in interface ISearch
        Parameters:
        startX - Start X axis coordinate.
        startY - Start Y axis coordinate.
        endX - End X axis coordinate.
        endY - End Y axis coordinate.
        Returns:
        List of points that contains the path.

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.