Advertisement
Guest User

Untitled

a guest
Oct 17th, 2020
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 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 jump2next(pt: tuple):
  11. t.penup()
  12. t.goto(pt)
  13. t.pendown()
  14.  
  15.  
  16. def pol2dec(r: float, phi: float) -> tuple:
  17. x = r * cos(phi)
  18. y = r * sin(phi)
  19. point = (x, y)
  20. print("x = ", x)
  21. print("y = ", y)
  22. return point
  23.  
  24.  
  25. vMin = 1
  26. vMax = 22
  27. radius = 40
  28. angle, angle_inc = 3 * pi / 2, pi / 10
  29.  
  30.  
  31. for j in range(vMin, vMax + 1):
  32.  
  33. jump2next(pol2dec(radius, angle))
  34.  
  35. angle += angle_inc
  36. t.goto(*pol2dec(radius, angle))
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement