mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:41 -04:00
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/CubicSpline/cubic_spline_planner.py
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user