Guest User

Untitled

a guest
May 3rd, 2020
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. from turtle import Turtle
  2. from numpy import cos, sin, pi
  3.  
  4. t = Turtle()
  5. t.speed(2)
  6.  
  7. t.shape('turtle')
  8.  
  9.  
  10. def pol2dec(r: float, phi: float) -> tuple:
  11. x = r * cos(phi)
  12. y = r * sin(phi)
  13. point = (x, y)
  14.  
  15. return point
  16.  
  17.  
  18. vMin = 3
  19. vMax = 13
  20. a = 10
  21.  
  22.  
  23. for n in range(vMin, vMax + 1):
  24. angle = 0
  25. radius = 0
  26.  
  27. angle_inc = ( 360 / n ) / 2
  28. radius_inc = angle_inc / (2 * sin(360 / 2 * n))
  29.  
  30. angle += angle_inc
  31. radius += radius_inc
  32.  
  33. print("++++++block++++++")
  34. print("n = ", n)
  35. print("angle = ", angle)
  36. print("radius = ", radius)
  37. print("++++++block++++++")
  38.  
  39. for i in range(n):
  40. t.goto(*pol2dec(radius, angle))
Advertisement
Add Comment
Please, Sign In to add comment