TeXgraph# Cmd [view(-5,5,-5,5), Marges(0,0,0,0), size(10)]; Var t0 = pi/2; R = 2.5; r = 1; NbTours = 2; t1 = t0+2*pi*NbTours; I1 = -0.117680665274214+3.49802104925351*i; M1 = -0.000249402446887703+2.50494003618822*i; pas = 0.05; pause = 25; L1 = 1/0; L2 = 1/0; TimerOn = 0; Mac f = R*exp(i*%1); Centre = (R+r)*exp(i*%1); M' = Centre(%1)+r*exp(i*((1+R/r)*%1+pi-R/r*pi/2)); Init = [ stock:=Nil, Bouton(RefPoint, "Modifier &r", "if Input(""Ce rayon peut être négatif. Nouveau r="", [""Rayon de la petite roue, r="",r],r) then r:=Eval(chaine()), ReCalc() fi", "Rayon de la petite roue (mobile)"), Bouton(RefPoint+DeltaB, "Modifier &R", "if Input(""Nouveau R (>0)="", [""Rayon de la grande roue, R="",R],R) then R:=abs(Eval(chaine())), ReCalc() fi", "Rayon de la grande roue (fixe)"), Bouton(RefPoint+2*DeltaB, "&NbTours", "if Input(""NbTours="", [""Nombre de tours ="",NbTours],NbTours), then NbTours:=Eval(chaine()), ReCalc() fi", "Modifier le nombre de tours"), Bouton(RefPoint+3*DeltaB, "&Vitesse", "if Input(""Entrez un entier>0,"", [""Durée de la pause (ms) entre 2 instants="",pause],pause) then pause:=Eval(chaine()), ReCalc() fi","Pause en ms entre deux affichages"), Bouton(RefPoint+4*DeltaB, "&Pas", "if Input(""Entrez un réel>0,"", [""Valeur du pas ="",pas],pas) then pas:= Eval(chaine()), ReCalc() fi", "Modifier le pas entre deux instants"), Bouton(RefPoint+5*DeltaB,"&Lancer","Lancer()", "Faire tourner ou arrêter"), TimerMac("[if L1=Nil then Stroke(roue, mobile), timer(0) else I1:=L1[1], M1:=L2[1], Insert(stock, M1), Del(L1,1,1), Del(L2,1,1), Move(roue, mobile), Stroke(trajectoire) fi]") ]; Lancer = if TimerOn then timer(0), Stroke(roue,mobile) else if L1=Nil then $t:=t0, stock:=Nil, NotXor(roue,mobile), ReCalc(trajectoire), while t0, Timer(%1)]; Graph fond = [ background(full,beige) ]; Graph trajectoire = [Width:=8, Color:=red, Ligne(stock,0)]; Graph roue = [Width:=4, Color:=blue, Cercle(I1,r), Seg(I1,M1)]; Graph cercle = Cercle(0,R); Graph mobile = [Color:=blue, Point(M1,I1)];