Replaced sqrt(x**2+y**2) with hypot in PathPlanning/CubicSpline/cubic_spline_planner.py

This commit is contained in:
Guillaume Jacquenot
2019-12-07 22:53:08 +01:00
parent cf538756e6
commit 4c73cada9b

View File

@@ -140,8 +140,7 @@ class Spline2D:
def __calc_s(self, x, y):
dx = np.diff(x)
dy = np.diff(y)
self.ds = [math.sqrt(idx ** 2 + idy ** 2)
for (idx, idy) in zip(dx, dy)]
self.ds = np.hypot(dx, dy)
s = [0]
s.extend(np.cumsum(self.ds))
return s