def aux(c,n,i): if(i > 0): pi=math.pi base=((1-math.sin(pi/n))/(1+math.sin(pi/n))) r=getRayon(c)*base r1=getRayon(c)*((1-math.sin(pi/n))/(1+math.sin(pi/n))) xi=(r+r1)*math.cos((2*i*pi)/n) yi=(r+r1)*math.sin((2*i*pi)/n) p=point.create(xi,yi) cercle=create(p,r1) return [cercle]+aux(c, n, i-1) else: return []
#!/usr/bin/env python import point p = point.create(1.0, -2.0, 1) print(p) print('radius = {0}'.format(point.radius(p))) point.project(p) print(p)
import tkinter import point import circle as c fenetre = tkinter.Tk() canvas = tkinter.Canvas(fenetre, width=600, height=600, background='white') dot=point.create(300,300) cercle=c.create(dot,300) edge=c.defineSquare(cercle) cercle1=canvas.create_oval(edge[0].real,edge[0].imag,edge[1].real,edge[1].imag) cercleM = c.cercleMilieu(cercle,5) edge2=c.defineSquare(cercleM) cercle2=canvas.create_oval(edge2[0].real,edge2[0].imag,edge2[1].real,edge2[1].imag) test=c.couronne(cercleM,5) for circle in test : edge3=c.defineSquare(circle) canvas.create_oval(edge3[0].real,edge3[0].imag,edge3[1].real,edge3[1].imag) canvas.pack() fenetre.mainloop()