#Import Modules
frommathimport*fromturtleimport*fromrandomimport*# Tracé d'une épicycloïde
# ou d'une hippocycloïde (si rayon négatif)
#----------------------------
# Le nom du script(donut)
# vient du fait
# qu'avec des rayons (PPCM) suffisament
# éloignés, la figure tend
# vers une forme en 'donut'
#------------------------------
#------------------------------
#Liste des combinaisons de paramètres interessantes
# (21,31,0.5,30) Donut classique
# (31,41,0.5,41) Grand Donut
# (15,21,0.5,9) Rosace
# (31,32,0.5,10) Anneaux
# (61,11,0.5,2) Soleil
#------------------------------
defepi(r1,r2,pas,tours):penup()speed(10)inc=pas*pi/180#conversion radians
rapport=r1/r2#Thalès
angle1=0#setup angles départ
angle2=pi#Test valeurs incorrectes
ifpas<=0.1ortours<1:return("Valeurs incorrectes")whileangle1<(2*pi*tours):angle1=angle1+inc#avancéee angle petit cercle
#Calcul des coordonées dans le cercle 1
x1=cos(angle1)*(r1+r2)y1=sin(angle1)*(r1+r2)angle2=angle2-(inc*rapport)#avancée angle grand cercle
#Calcul des coordonées du point
#qui va être tracé (cercle 2)
x2=(cos(angle2)*r2)+x1y2=(sin(angle2)*r2)+y1#Tracé du points
color(100,100,255)goto(x2,y2)pendown()hideturtle()
During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:
Ensure the proper functioning of the site (essential cookies); and
Track your browsing to send you personalized communications if you have created a professional account on the site and can be contacted (audience measurement cookies).
With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.