from kandinsky import fill_rect from math import * from turtle import * fill_rect(0,0,320,222,(57,)*3) def ptsCercle(n, ct, rayon): tab=[] for i in range(n): ngl=2*i*pi/n tab.append((ct[0]+rayon*cos(ngl),ct[1]+rayon*sin(ngl))) return tab def demiDrte(A, B, k=6): C = (A[0]+(B[0]-A[0])*k,A[1]+(B[1]-A[1])*k) penup() goto(A) pendown() goto(C) def go(x,y): penup() goto(x,y) pendown() def demi_ovale(d): r = d // 3 circle(r, 60 ) circle(6 * r, 60 ) circle(r, 60 ) def ovale(d): demi_ovale(d) demi_ovale(d) speed(0) color((245,)*3) for i in range(3): a = -30+30*i go(45*cos(radians(a)),45 * sin(radians(a))) setheading(a+90) ovale(40) N = 12 DD = 36 O = (0,0) tpts = ptsCercle(N, O, 80) for j in range(N): pt = tpts[j] u = ptsCercle(DD, pt, 15) for i in range(DD//2 + 1): ind0 = (i + DD//4 + int(j*DD/N)) % DD ind1 = (ind0 + DD//2) % DD demiDrte(u[ind0],u[ind1])