diff options
author | HanEmile <emile.hansmaennel@gmail.com> | 2017-03-10 23:36:20 +0100 |
---|---|---|
committer | HanEmile <emile.hansmaennel@gmail.com> | 2017-03-10 23:36:20 +0100 |
commit | 8b38ee426ed75396e0f49276608e763867261a83 (patch) | |
tree | f12b1bc6505935ac79ce97f906901e58f9c48d27 | |
parent | 57caa041a7d406bcac6037fe2c04a28793e4bc43 (diff) |
added vonvert kartesian file + added NOTES.md
-rw-r--r-- | NOTES.md | 33 | ||||
-rw-r--r-- | convert_koordinate.py | 52 | ||||
-rw-r--r-- | main2.py | 4 |
3 files changed, 87 insertions, 2 deletions
diff --git a/NOTES.md b/NOTES.md new file mode 100644 index 0000000..e4e002f --- /dev/null +++ b/NOTES.md @@ -0,0 +1,33 @@ +# Satellite Computation Notes + +## TODO: + +- speed +- Kugelkoordinatensysteme (räumliche Polarkoordinaten) + * helferklasese + +## Notes: + +# Umrechnung kartesian - polar + +koordinatentripel (r, theta, phi) + +- r -> alle positiven Reellen Werte +- theta -> Intervall [0, pi] bzw. [0, 180°] +- phi -> Intervall [-pi, pi] bzw. [-180°, 180°] oder [0, 2pi] bzw. [0, 360°] + +Umrechnung polar -> kartesian: + +- x = r * sin(theta) * cos(phi) +- y = r * sin(theta) * sin(phi) +- z = r * sin(theta) + +Umrechnung kartesian -> polar: + +- r = sqrt(x^2 + y^2 + z^2) +- theta = arccos({z}over{sqrt(x^2 + y^2 + z^2)}) +- phi = + - wenn x > 0, arctan({y}over{x}) + - wenn x = 0, sgn(y){pi}over{2} + - wenn x < 0 And y >= 0, arctan({y}over{x})+pi + - wenn x < 0 And y < 0, arctan({y}over{x})-pi diff --git a/convert_koordinate.py b/convert_koordinate.py new file mode 100644 index 0000000..b5e52e3 --- /dev/null +++ b/convert_koordinate.py @@ -0,0 +1,52 @@ +# import +import math +import numpy as np +import matplotlib.pyplot as plt + +# pol[x, y, z] +x = 1 +y = 2 +z = 3 +pol = [x, y, z] + +# define r, theta, phi +r = 0 +theta = 0 +phi = 0 +kart = [0, 0, 0] + +def poltokart(pol): + # split up list + x = pol[0] + y = pol[1] + z = pol[2] + + # radius + r = np.sqrt(np.power(x, 2) + np.power(y, 2) + np.power(z, 2)) + + # theta + a = np.sqrt(x^2 + y^2 + z^2) + b = ((z) / a) + b = b * math.pi / 180 + theta = np.arccos(b) + + # phi + if x > 0: + phi = np.arctan(y/x) + elif x == 0: + phi = np.sign(y)*(math.pi/2) + elif x < 0 and y >= 0: + phi = np.arctan(y/x) + math.pi + elif x < 0 and y < 0: + phi = np.arctan(y/x) - math.pi + + # write to cartesian list + kart[0] = r + kart[1] = theta + kart[2] = phi + +# run +poltokart(pol) + +print("{:<15}{:<60}".format("polar:", str(pol) )) +print("{:<15}{:<60}".format("cartesian:", str(kart) )) diff --git a/main2.py b/main2.py index 62a4426..7745d86 100644 --- a/main2.py +++ b/main2.py @@ -87,7 +87,7 @@ class TLE: start = timer() # controll values -category = "iridium" +category = "argos" globalScale = 1 satSize = 0.5 orbitSubDivs = 256 @@ -95,7 +95,7 @@ resolution = 100 # get position of sat each x frames threshold = 0.001 # if internet connection available: -TLE.download(category) +# TLE.download(category) # define sce = bpy.context.scene |