SHOW:
|
|
- or go back to the newest paste.
| 1 | - | from tkinter import * |
| 1 | + | # Ici on fait les imports, les règlages de la fenêtre, etc... mais on ne s'y intéressera pas. |
| 2 | - | from math import * |
| 2 | + | # |
| 3 | def VR(X,Y): | |
| 4 | - | def plot(x,y,coul="red") : |
| 4 | + | l = pi/2 - atan(Y/X) |
| 5 | - | global can |
| 5 | + | |
| 6 | - | can.create_line(x,y,x+1,y,fill=coul) |
| 6 | + | |
| 7 | ||
| 8 | - | def rgb(r,g,b) : |
| 8 | + | |
| 9 | - | return '#%02x%02x%02x' % (int(r), int(g), int(b)) |
| 9 | + | |
| 10 | - | |
| 10 | + | |
| 11 | - | def L(x,y): |
| 11 | + | |
| 12 | - | return 1.5707963267948966 - atan(y/x) |
| 12 | + | # |
| 13 | - | |
| 13 | + | |
| 14 | max = Vo | |
| 15 | - | l = L(X,Y) |
| 15 | + | |
| 16 | for y in range(1,H) : | |
| 17 | X,Y = x/scale, y/scale | |
| 18 | Vr = VR(X,Y) | |
| 19 | - | # constantes de la fenetre |
| 19 | + | |
| 20 | - | W = 600 |
| 20 | + | |
| 21 | - | H = 600 |
| 21 | + | |
| 22 | # | |
| 23 | - | # constantes physiques |
| 23 | + | |
| 24 | for y in range(1,H) : | |
| 25 | X,Y = x/scale, y/scale | |
| 26 | Vr = VR(X,Y) | |
| 27 | - | # fenetre de dessin |
| 27 | + | |
| 28 | - | win = Tk() |
| 28 | + | |
| 29 | - | win.title("Vitesse radiale en fonction des coordonnées")
|
| 29 | + | |
| 30 | else : | |
| 31 | - | can = Canvas(win, width = W, height = H) |
| 31 | + | |
| 32 | - | can.pack() |
| 32 | + | plot(x,y,rgb(coeff*255, 0, (1-coeff)*255)) |