-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconvertRelativeToAbsolute.py
39 lines (35 loc) · 2.29 KB
/
convertRelativeToAbsolute.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
38
39
"""
Tiny script to convert a relative path from a chart tracing to an absolute path
The relative path below is a tracing of the sunlight emission spectrum
"""
relativePath = [
[5.52, -0.029], [5.64, 0.34], [5.54, 0.939], [5.54, 0.11], [5.64, 0.731], [5.53, 3.029],
[5.54, 7.83], [5.64, 14.111], [5.54, 17.019], [5.53, 10.24], [5.64, 3.76], [5.54, 3.66],
[5.54, 2.29], [5.64, 1.47], [5.53, 11.9], [5.54, 21.941], [5.64, 18.279], [5.54, 11.91],
[5.53, 9.92], [5.54, 10.66], [5.64, 7.201], [5.54, 2.089], [5.53, -1.98], [5.64, -6.16],
[5.54, -5.329], [5.54, 4.179], [5.64, 10.761], [5.53, 11.379], [5.54, 13.48], [5.64, 13.371],
[5.54, 11.589], [5.53, 8.67], [5.64, 6.58], [5.54, 6.06], [5.54, 3.55], [5.64, -1.77],
[5.53, -3.239], [5.54, 1.25], [5.53, 2.819], [5.65, 1.88], [5.53, -0.94], [5.54, -6.06],
[5.64, -0.199], [5.53, 8.98], [5.54, 7.83], [5.64, 1.049], [5.54, 0.21], [5.53, 2.92],
[5.64, 1.051], [5.54, -1.051], [5.54, -4.59], [5.64, -3.66], [5.53, 3.97], [5.54, 5.541],
[5.64, 5.009], [5.54, 2.821], [5.531, -0.73], [5.539, -3.141], [5.64, -0.2], [5.54, 3.761],
[5.531, 1.25], [5.639, -1.781], [5.54, -1.349], [5.54, 2.819], [5.64, 4.59], [5.53, -0.52],
[5.54, -2.719], [5.64, 2.089], [5.54, 3.76], [5.53, 1.68], [5.64, 1.141], [5.54, -2.5],
[5.54, -6.581], [5.641, -1.879], [5.529, 4.069], [5.54, 1.67], [5.54, 1.781], [5.641, -1.261],
[5.529, -4.699], [5.54, -3.761], [5.641, 1.36], [5.54, 3.341], [5.529, -0.94], [5.641, -4.591],
[5.54, -1.67], [5.54, 3.02], [5.639, 4.5], [5.531, 0.83], [5.54, -1.56], [5.639, -1.259],
[5.54, 0.21], [5.531, -1.151], [5.639, -3.03], [5.54, 1.78], [5.54, 5.53], [5.531, 4.391],
[5.639, 2.609], [5.54, 0.661], [5.531, -2.431], [5.649, -4.81], [5.53, -8.15], [5.54, -10.02],
[5.64, -5.959], [5.54, 3.239], [5.53, 2.19], [5.64, -2.5], [5.54, -0.94], [5.53, 5.531],
[5.651, 5.959], [5.529, -1.05], [5.54, -11.8], [5.641, -16.4], [5.529, -4.069], [5.54, 6.159],
[5.54, 2.92], [5.641, -3.03], [5.529, -9.29], [5.591, -26.22]]
xAccumulator = 0
yAccumulator = 0
absolutePath = [[0, 0]]
for p in relativePath:
x = absolutePath[-1][0] + p[0] * 10
y = absolutePath[-1][1] + p[1] * 10
absolutePath.append([x, y])
rounded = [[round(p[0]), round(p[1])] for p in absolutePath]
print(absolutePath)
print(rounded)