def eval(self, t_in):
"""
Evaluate the spline at the points in t_in, which must be an array
with values in [0,1]
returns and np array with the corresponding points
"""
t_in = t_in.clip(0.0, 1.0)
splines = self.splines
tknots = self.tknots
index = tknots.searchsorted(t_in, side='left') - 1
index = index.clip(0, len(splines) - 1)
to_calc = splines[index]
ax, bx, cx, dx, tx = np.swapaxes(to_calc, 0, 1)
t_r = t_in[:, np.newaxis] - tx
out = ax + t_r * (bx + t_r * (cx + t_r * dx))
return out
评论列表
文章目录