Use generator instead of list in bezier

This commit is contained in:
Grant Sanderson 2022-01-25 08:57:43 -08:00
parent 6376f0a8cc
commit eb245f6fdb

View file

@ -14,10 +14,10 @@ def bezier(points):
n = len(points) - 1
def result(t):
return sum([
return sum(
((1 - t)**(n - k)) * (t**k) * choose(n, k) * point
for k, point in enumerate(points)
])
)
return result