De Boor's algorithm: Difference between revisions

Content deleted Content added
Its not wrong if you do the padding
Line 72:
p: Degree of B-spline.
"""
d = [c[j + k - p] for j in range(0, p + 1)] # this wrong, can easily give -ve indices, eg if j=0, k=0, p= eg 3, then trying to find the quantity c[-3]
 
for r in range(1, p + 1):
for j in range(p, r - 1, -1):
alpha = (x - t[j + k - p]) / (t[j + 1 + k - r] - t[j + k - p]) # this wrong, can easily give -ve indices, eg if j=r=1, k=0, p= eg 3, then trying to find the quantity t[-2]
d[j] = (1.0 - alpha) * d[j - 1] + alpha * d[j]