Grille de quadrilatères "aléatoires" #PyGgb

[url=https://geogebra.org/python/index.html?name=grille+de+quadrilateres&code=eJylU81O4zAQvvspRnBxwCQxWmmlSjm0aPfEYe9oVTmJEywc22s7q%2BTMy8BrwIsxaUppoVIPWEmcmc%2FzzY9nzqH1SmsJtYR%2FvahREPH18eXJywCU%2F8x4nmXX%2BfWPhJDG2w68MDVuqnPWxwsy7xBVJwk5B2eViSB6uBdB%2BBpC76E3EGTbSRMXpJYNuLieUbpkq2RBAFeEYstMk43iBhV%2FJjK6TIfLeEFX6XCFvwlbpuMsjyiPCVNh%2FV8FVWpZ%2FBY6yNney9h7Azdk47KzUTXUsG7rrrEeRlBm8tlKoPkOeUeHHYqg2QOndYvB3f09VKXCOWlq%2BpHdHP7Axq8hsi12yY%2BhyZzCaerj5vvk%2BH6P%2FhjBu4Nv0p8iP0ntNj2ix9YaevsJSq0TlYpjwT%2FpK6utL%2B6GzLAx6xg%2FvEaXamXkOt6r6sHIEIr8AJ7aPA1aSkfzNM85OsWu%2FzXgwDxXfVTWLIgpeE666bNvibPRWFNDBqWoHlpve1OT5a7JrzjD52srr3YnDBbr6JFyrwo4UAwntZyzROCs1OjuDDXbeqCOE%2FIxD289gi6g]LIEN[/url] / LINK/ ENLACE
Pour n=20 et m=20
[code]# grille de quadrilatères (17/10//2024)[br][br]from random import*[br]import time[br][br]# point au hasard sur un segment:[br]def pt_hasard(A,B):[br] t = random()[br] C = Point(A.x+t*(B.x-A.x),A.y+t*(B.y-A.y),is_visible=False)[br] return C[br][br]def motif(n,m):[br] for y in range (0,m):[br] for x in range(0,n):[br] L = [][br] L.append(pt_hasard(Point(x,y,is_visible=False),Point(x+1,y,is_visible=False)))[br] L.append(pt_hasard(Point(x+1,y,is_visible=False),Point(x+1,y+1,is_visible=False)))[br] L.append(pt_hasard(Point(x+1,y+1,is_visible=False),Point(x,y+1,is_visible=False)))[br] L.append(pt_hasard(Point(x,y+1,is_visible=False),Point(x,y,is_visible=False)))[br] p = Polygon(L)[br] p.opacity=1[br] p.color=[x/n,y/m,1][br] p.line_thickness=0[br] time.sleep(0.001)[br] [br][br]#Exécution:[br]n=10[br]m=10[br] [br]# fond / background[br]A = Point(-1,-1,is_visible=False)[br]B = Point(n+1,-1,is_visible=False)[br]b = Polygon(A,B,4)[br]b.color = "black"[br]b.opacity = 1[br][br]motif(n,m)[/code]

Information: Grille de quadrilatères "aléatoires" #PyGgb