ai v pizdu

This commit is contained in:
Extazy-b 2025-03-26 00:45:33 +03:00
parent 236be7bb2a
commit 29f3563e49
6 changed files with 29 additions and 8 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

25
grad.py
View File

@ -22,11 +22,16 @@ def rgb_to_hex(color):
def main(wind):
wind.points = [(0, 0)] + wind.points + [(wind.width, wind.height)]
[print(wind.points)]
L = interpol(wind.points)
dL = L.diff()
N = len(wind.points)
perp = []
for p in wind.points:
k = dL.value(p[0])
if k==0:
@ -36,18 +41,21 @@ def main(wind):
b = p[1] - k*p[0]
perp.append(Poly([b, k]))
colors = [(0, Vector(0, 0, 0))]
colors = []
for i in range(N):
colors.append((wind.points[i][0], Vector(randint(0, 255), randint(0, 255), randint(0, 255))))
colors.append((width, Vector(255, 255, 255)))
#colors.append((width, Vector(255, 255, 255)))
print(colors)
#colors = [(0, Vector(0, 0, 0))] + colors + []
color_func = interpol(colors).tuple()
step = 0.5
step = 0.1
for dx in range(round(width/step)):
x=dx*step
color = color_filter(comp.value(x) for comp in color_func)
print(x, color)
"""
k = dL.value(x)
if k == 0:
@ -58,8 +66,9 @@ def main(wind):
for y in range(width*2):
wind.canvas.create_line(y/2, k*y/2+b, y/2+1, k*(y/2+1)+b, fill=rgb_to_hex(color))
"""
wind.canvas.create_line(x, L.value(x), x+step, L.value(x+step), fill=rgb_to_hex((color)), width=5)
wind.canvas.create_line(x, L.value(x), x+step, L.value(x+step), fill=rgb_to_hex((color)), width=10)
wind.points = wind.points[1:-2]
for i in range(N):
wind.canvas.create_oval(colors[i][0] - 3, L.value(colors[i][0]) - 3, colors[i][0] + 3, L.value(colors[i][0]) + 3, fill=rgb_to_hex(colors[i][1].tuple()))
@ -69,8 +78,8 @@ def main(wind):
if __name__ == "__main__":
title = 'Huy'
width = 1000
height = 500
width = 1200
height = round(width*1080/1920)
wind = window(title, width, height)
def on_enter_pressed(event):
@ -78,4 +87,4 @@ if __name__ == "__main__":
wind.bind("<Return>", on_enter_pressed)
wind.mainloop()
wind.mainloop()

12
test.py Normal file
View File

@ -0,0 +1,12 @@
def mult(p, q):
n = len(p) - 1
m = len(q) - 1
p += [0]*m
q += [0]*n
result = [0]*(n+m+1)
for k in range(n+m+1):
for l in range(k+1):
result[k] += p[l]*q[k-l]
return result[::-1]
print(mult([1, 1, 1, 1], [1, 1, 1]))