-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (26 loc) · 773 Bytes
/
test.py
File metadata and controls
32 lines (26 loc) · 773 Bytes
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
def encodedDistance(inches):
start = 65535
vector = [0, 1, 0, 1, 1, 0, 1, 0, 1, 1,
0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1]
# we always drop 39935
# we always rise 25600
result = []
stage = 0
for i in range(inches + 1):
if (vector[stage] == 0):
result.append(start - 39935)
start = start - 39935
else:
result.append(start + 25600)
start = start + 25600
stage = stage + 1
if (stage == 23):
stage = 0
return int(hex(result[i-1]), 16)
width = 24
height = 30
newWidth = min(44, width)
height = int(height * (newWidth / width))
width = newWidth
print("height:", hex(encodedDistance(height)))
print("width:", hex(encodedDistance(width)))