public List<Vector2> findPathBetween(Vector2 from,Vector2 to) throws Exception {
  resetSearchAlgorithm();
  if (!quadTree.isFilled(from) || !quadTree.isFilled(to)) {
    throw new Exception("fields are not visited in quadtree");
  }
  from=quadTree.rasterize(from);
  to=quadTree.rasterize(to);
  goal=new Node(to);
  openList.add(new Node(from));
  do {
    Node currentNode=getClosestNode();
    if (currentNode.equals(goal)) {
      while (currentNode.parent != null) {
        path.add(new Vector2(currentNode.x,currentNode.y));
        currentNode=currentNode.parent;
      }
      return path;
    }
    openList.remove(currentNode);
    closedList.add(currentNode);
    expandNode(currentNode);
  }
 while (!openList.isEmpty());
  throw new Exception("no path found");
}

public List < Vector2 > findPathBetween ( Vector2 from , Vector2 to ) throws Exception { resetSearchAlgorithm ( ) ; if ( ! quadTree . isFilled ( from ) || ! quadTree . isFilled ( to ) ) { throw new Exception ( "fields are not visited in quadtree" ) ; } from = quadTree . rasterize ( from ) ; to = quadTree . rasterize ( to ) ; goal = new Node ( to ) ; openList . add ( new Node ( from ) ) ; do { Node currentNode = getClosestNode ( ) ; if ( currentNode . equals ( goal ) ) { while ( currentNode . parent != null ) { path . add ( new Vector2 ( currentNode . x , currentNode . y ) ) ; currentNode = currentNode . parent ; } return path ; } openList . remove ( currentNode ) ; closedList . add ( currentNode ) ; expandNode ( currentNode ) ; } while ( ! openList . isEmpty ( ) ) ; throw new Exception ( "no path found" ) ; }
finds the shortest path between a start and an end point using a https : / / en . wikipedia . org / wiki / a * _search_algorithm
