diff --git a/PathPlanning/Dijkstra/dijkstra.py b/PathPlanning/Dijkstra/dijkstra.py index bb73ed50..5c06f53a 100644 --- a/PathPlanning/Dijkstra/dijkstra.py +++ b/PathPlanning/Dijkstra/dijkstra.py @@ -123,7 +123,7 @@ class Dijkstra: def calc_heuristic(self, n1, n2): w = 1.0 # weight of heuristic - d = w * math.sqrt((n1.x - n2.x)**2 + (n1.y - n2.y)**2) + d = w * math.hypot(n1.x - n2.x, n1.y - n2.y) return d def calc_position(self, index, minp): @@ -178,7 +178,7 @@ class Dijkstra: for iy in range(self.ywidth): y = self.calc_position(iy, self.miny) for iox, ioy in zip(ox, oy): - d = math.sqrt((iox - x)**2 + (ioy - y)**2) + d = math.hypot(iox - x, ioy - y) if d <= self.rr: self.obmap[ix][iy] = True break