methods get_y

This commit is contained in:
Frank DeMarco 2014-01-27 19:35:15 +09:00
parent 1cf23ce4cf
commit ab5b5aa6f0
1 changed files with 8 additions and 1 deletions

View File

@ -124,7 +124,14 @@ class Nodeset(list):
self.splines = [CubicSpline(self[ii].x, a[ii], b[ii], c[ii],
d[ii]) for ii in xrange(n)]
def get_y(self, t):
def get_y(self, t, loop=False, natural=False):
if loop:
t %= self[-1].x
elif not natural:
if t < self[0].x:
t = self[0].x
elif t > self[-1].x:
t = self[-1].x
splines = self.splines
for ii in xrange(len(splines) - 1):
if t < splines[ii + 1].x: