def findPath(self, start, goal) : """ start : (float,float), goal : (float,float,float) or (float,float) uses the AStar class to find the shortest path between 'start' and 'goal' then simplifies the path to obtain straight lines as long as possible """ if len(goal) == 2 : goal = goal + (0,) # default value of 'goalRadius' is 0 a = AStar(start, goal, self.thresholdMap) print "Résultat de A*: " + str(a.aStar()) p = a.buildPath() if p == None : self.path == None else : l = len(p) current = l-1 self.path = [p[current]] while current > 0: i = 0 while i+1 < current and not self.isLineClear(p[current], p[i]) : i += 1 current = i self.path.insert(0,p[current])
def findPath(self, start, goal): """ start : (float,float), goal : (float,float,float) or (float,float) uses the AStar class to find the shortest path between 'start' and 'goal' then simplifies the path to obtain straight lines as long as possible """ if len(goal) == 2: goal = goal + (0, ) # default value of 'goalRadius' is 0 a = AStar(start, goal, self.thresholdMap) print "Résultat de A*: " + str(a.aStar()) p = a.buildPath() if p == None: self.path == None else: l = len(p) current = l - 1 self.path = [p[current]] while current > 0: i = 0 while i + 1 < current and not self.isLineClear( p[current], p[i]): i += 1 current = i self.path.insert(0, p[current])