Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. import math
  2. import matplotlib.pyplot as plt
  3.  
  4. screen_x, screen_y = (500, 500)
  5. middle_screen = (screen_x/2, screen_y/2)
  6. # point behind the middle
  7. point_behind = (middle_screen[0], -750)
  8. # middle point to the left
  9. middle_point_in_screen = (middle_screen[0]-50, middle_screen[1])
  10. # y = mx + b, y-y1 = m(x-x1)
  11.  
  12. radius_midpoint = 1250
  13. # find a the slice of the circle from the middle
  14. min_range = math.pi/2 - math.sin((middle_screen[1] - point_behind[1])/radius_midpoint)
  15. max_range = math.pi/2
  16.  
  17. # pi/4 => pi/2
  18. def create_list_rad(min_range, max_range = math.pi/2):
  19.     min_pi = min_range
  20.     radian_list = []
  21.     while min_pi< max_range:
  22.         radian_list.append(min_pi)
  23.         min_pi += .001
  24.     return radian_list
  25.  
  26.  
  27. def find_xy(r, theta):
  28.     return (int(r*math.cos(theta)), int(r*math.sin(theta)))
  29.  
  30. x_y_list = []
  31. for i in create_list_rad(min_range):
  32.     x_y_list.append(find_xy(radius_midpoint, i))
  33.  
  34. print(x_y_list)
  35.  
  36. x, y = list(zip(*x_y_list))
  37. print(x)
  38. print(y)
  39.  
  40. plt.plot(x,y)
  41. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement