-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocation.py
37 lines (30 loc) · 996 Bytes
/
location.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class Board:
n, m, HEIGHT = 9, 9, 2
LOWER_LEFT = [318, -86, HEIGHT]
LOWER_RIGHT = [318, 86, HEIGHT]
UPPER_LEFT = [132, -86, HEIGHT]
UPPER_RIGHT = [132, 86, HEIGHT]
unit_len = 1. * (LOWER_RIGHT[1] - LOWER_RIGHT[1]) / (n - 1)
unit_wid = 1. * (LOWER_RIGHT[0] - UPPER_RIGHT[0]) / (m - 1)
def location(self, x, y):
ans = self.LOWER_LEFT
ans[0] += x * self.unit_len
ans[1] += y * self.unit_wid
return ans
class ChessArea:
def __init__(self):
self.n, self.m, self.HEIGHT = 6, 7, -6
self.pos = ((128, -104),)
self.LOWER_LEFT = [318, -86, self.HEIGHT]
self.idx = 0
def location(self, idx):
return [self.pos[idx][0], self.pos[idx][1], self.HEIGHT]
@staticmethod
def get_chess(self):
self.idx += 1
return self.location(self.idx - 1)
relay_point = [0, 0, 0] # update
origin_point = [0, 0, 0] # update
safe_pos = (130, -30, 15)
board = Board()
chess = ChessArea()