SuperMonkey

ARE Final Vr(x,y) shortened

Apr 29th, 2014
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Ici on fait les imports, les règlages de la fenêtre, etc... mais on ne s'y intéressera pas.
  2. #
  3. def VR(X,Y):
  4.     l = pi/2 - atan(Y/X)
  5.     r = sqrt(X**2+(Y-Ro)**2)
  6.     return Vo*(Ro/r - 1)*(sin(l))
  7.  
  8. Vo = 220000
  9. Ro = 262282594 * 10**12
  10.  
  11. scale = W / Ro
  12. #
  13. min = -1
  14. max = Vo
  15. for x in range(1,W) :
  16.     for y in range(1,H) :
  17.         X,Y = x/scale, y/scale
  18.         Vr = VR(X,Y)
  19.        
  20.         if Vr < min or min == -1:
  21.             min = Vr
  22. #
  23. for x in range(1,W) :
  24.     for y in range(1,H) :
  25.         X,Y = x/scale, y/scale
  26.         Vr = VR(X,Y)
  27.        
  28.         if Vr > max:
  29.             coeff = 1
  30.         else :
  31.             coeff = (Vr-min)/(max-min)
  32.         plot(x,y,rgb(coeff*255, 0, (1-coeff)*255))
Advertisement
Add Comment
Please, Sign In to add comment