Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # plocha automat x: 290-735 , y: 110-640
- # 445x530
- def move_to_mesh(x,y):
- a = 445 #sirka plochy
- b = 530 #dlzka plochy
- n = 60 #sirka stvorca
- n2 = math.floor(n/2)
- n3 = math.floor(n/4)
- ii = math.floor(a/n) #11
- jj = math.floor(b/n) #13
- #zaciatok plochy trochu posunuty nech neuklada na uplny kraj
- xx = 290+n3
- yy = 110+n3
- p = 0
- q = 0
- if x < xx-n2+n3 or x > xx+a-n3 or y < yy-n2+n3 or y > yy+b-n3:
- return p,q
- p = xx
- q = yy
- for i in range(ii):
- if xx <= x <= xx+n2:
- p = xx
- elif xx+n2 <= x <= xx+n:
- p = xx+n
- xx += n
- for j in range(jj):
- if yy <= y <= yy+n2:
- q = yy
- elif yy+n2 <= y <= yy+n:
- q = yy+n
- if yy <= y <= yy+n2:
- q = yy
- elif yy+n2 <= y <= yy+n:
- q = yy+n
- yy += n
- return [p,q]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement