mirror of
https://github.com/Ikatono/Bezier.git
synced 2025-10-28 20:45:33 -05:00
working on slicing
This commit is contained in:
13
bezier.py
13
bezier.py
@@ -1,3 +1,5 @@
|
||||
from math import factorial as fact
|
||||
|
||||
class Bezier:
|
||||
def __init__(self, *args, **kwargs):
|
||||
if len(args) == 1:
|
||||
@@ -47,4 +49,13 @@ class Bezier:
|
||||
start = max(start, 0)
|
||||
stop = min(stop, 1)
|
||||
stop = max(stop, 0)
|
||||
|
||||
return [self[i] for i in stepper(start, stop, step)]
|
||||
else:
|
||||
n = len(self.x) - 1
|
||||
x = 0
|
||||
y = 0
|
||||
for i in range(n+1):
|
||||
#eww
|
||||
x += self.x[i]*((1-t)**i)*(t**(n-i))*fact(n)/fact(i)/fact(n-i)
|
||||
y += self.y[i]*((1-t)**i)*(t**(n-i))*fact(n)/fact(i)/fact(n-i)
|
||||
return (x, y)
|
||||
|
||||
Reference in New Issue
Block a user