Tapez >> art0()
, >> art1()
etc pour voir les différents tableaux.
La vidéo explique comment trouver les coordonnées des points (sur le cercle, les rayons, les arcs et les cordes) pour générer une infinité de tableaux.
from turtle import * from math import * from random import * speed(0) hideturtle() # Le programme def Ce(R,N,n,D=1,d=0): return [R*cos(2*pi*(n+d/D)/N),R*sin(2*pi*(n+d/D)/N)] def Or(): return [0,0] # Origine def Co(R,N,n,E,e): A = Ce(R,N,n) B = Ce(R,N,n+1) return [(1-e/E)*A[0]+e*B[0]/E,(1-e/E)*A[1]+e*B[1]/E] def Ra(R,N,n,F,f): A = Ce(R,N,n) return [f*A[0]/F, f*A[1]/F] def fil(A,B,c=(0,0,0)): pencolor(c) penup() goto(A) pendown() goto(B) # Exemples de tableaux def art0(N = 36, M = 10): for n in range(N): fil(Ce(100,N,n+M),Ce(100,N,n+1),(255,180,200)) for n in range(N): fil(Ce(100,N,n),Ce(100,N,n+M),(250,70,70)) def art1(N = 20): for n in range(N): for e in range(N): fil(Ce(100,N,n),Ce(100,N,e)) def art2(N = 200, M = 20): for n in range(N): fil(Ce(30,M,n),Ce(100,N,n)) def art3(N = 100, k = 2): for n in range(N): fil(Ce(160, N, n), Ce(160, N, k * n)) def art4(): for i in range(6): for n in range(72): fil(Ce(160, 72, n + 6 * i), \ Ce(160, 72, 3 * n + 6 * i)) def art5(N = 7, F = 8): for n in range(N): for f in range(F): fil(Ra(100,N,n,F,F-f),Ra(100,N,n+1,F,f)) def art6(N = 6, E = 20): for n in range(N): for e in range(E): fil(Ra(100,N,n,E,e),Ce(100,N,n,E,e)) fil(Ce(100,N,n,E,e),Ra(100,N,n+1,E,E-e)) fil(Ra(100,N,n,E,e),Ra(100,N,n+1,E,E-e)) def art7(N = 8, E = 20): for n in range(N): for e in range(E): if e<E/2: fil(Ra(100,N,n,E,e),Ce(100,N,n,E,E/2+e)) fil(Ce(100,N,n,E,e),Ra(100,N,n,E,e)) else: fil(Ra(100,N,n,E,e),Ra(100,N,n+1,E,2*E-2*e)) fil(Ce(100,N,n,E,e),Ra(100,N,n,E,e)) def art8(N = 8, E = 10): for n in range(N): for e in range(E): fil(Co(100,N,n,E,e),Co(100,N,n+1,E,e)) def art9(N = 6, E = 20): for n in range(N): for e in range(int(E/2)+1): fil(Co(100,N,n,E,E/2+e),Ra(100,N,n+1,E,E-1.5*e)) fil(Co(100,N,n+1,E,E/2-e),Ra(100,N,n+1,E,E-1.5*e)) def art10(N = 80): k = 0 for n in range(2*N): if n%6!=0: fil(Ce(100,N,n),Ce(100,N,N/2+k)) k += 1 def art11(N = 255): for n in range(N): c = (randint(0,n),randint(n,255),randint(255-n,255)) fil(Ce(20,N,n),Ce(randint(80,100),N,n),c)