Grille déformée #pyggb

Image
from random import* # dimensions: nc = 10 # nombre de colonnes nl = 10 # nombre de lignes # "coefficients de déformation" cx = 0.25 cy = 0.5 # Matrices contenant les points M = [] for y in range(nl+1): L = [] for x in range(nc+1): P = Point(x+uniform(-cx,cx),y+uniform(-cy,cy),is_visible=True) L.append(P) M.append(L) # Dessin: for y in range(nl): for x in range(nc): p = Polygon([M[y][x],M[y][x+1],M[y+1][x+1],M[y+1][x]]) p.color = [1,x/nc,y/nl] p.opacity = 1 p2 = Polygon([M[y][x],M[y][x+1],M[y+1][x+1],M[y+1][x]]) p2.color = [0,0,0] p2.opacity = 0
Lien : ICI