Skip to content

Commit c63a80b

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/VoronoiRoadMap/voronoi_road_map.py
1 parent d20f1e3 commit c63a80b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

PathPlanning/VoronoiRoadMap/voronoi_road_map.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def is_collision(sx, sy, gx, gy, rr, okdtree):
9595
dx = gx - sx
9696
dy = gy - sy
9797
yaw = math.atan2(gy - sy, gx - sx)
98-
d = math.sqrt(dx**2 + dy**2)
98+
d = math.hypot(dx, dy)
9999

100100
if d >= MAX_EDGE_LEN:
101101
return True
@@ -203,7 +203,7 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
203203
n_id = road_map[c_id][i]
204204
dx = sample_x[n_id] - current.x
205205
dy = sample_y[n_id] - current.y
206-
d = math.sqrt(dx**2 + dy**2)
206+
d = math.hypot(dx, dy)
207207
node = Node(sample_x[n_id], sample_y[n_id],
208208
current.cost + d, c_id)
209209

0 commit comments

Comments
 (0)