Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. # plocha automat x: 290-735 , y: 110-640
  2. # 445x530
  3. def move_to_mesh(x,y):
  4.  
  5. a = 445 #sirka plochy
  6. b = 530 #dlzka plochy
  7.  
  8. n = 60 #sirka stvorca
  9. n2 = math.floor(n/2)
  10. n3 = math.floor(n/4)
  11.  
  12. ii = math.floor(a/n) #11
  13. jj = math.floor(b/n) #13
  14.  
  15.  
  16. #zaciatok plochy trochu posunuty nech neuklada na uplny kraj
  17. xx = 290+n3
  18. yy = 110+n3
  19.  
  20. p = 0
  21. q = 0
  22.  
  23. if x < xx-n2+n3 or x > xx+a-n3 or y < yy-n2+n3 or y > yy+b-n3:
  24. return p,q
  25.  
  26. p = xx
  27. q = yy
  28.  
  29. for i in range(ii):
  30. if xx <= x <= xx+n2:
  31. p = xx
  32. elif xx+n2 <= x <= xx+n:
  33. p = xx+n
  34. xx += n
  35.  
  36. for j in range(jj):
  37. if yy <= y <= yy+n2:
  38. q = yy
  39. elif yy+n2 <= y <= yy+n:
  40. q = yy+n
  41.  
  42. if yy <= y <= yy+n2:
  43. q = yy
  44. elif yy+n2 <= y <= yy+n:
  45. q = yy+n
  46.  
  47. yy += n
  48.  
  49. return [p,q]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement