mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 05:20:36 +01:00
Flipped az/alt source and dest
This commit is contained in:
parent
d599437ea3
commit
c7dcf6f3ce
@ -173,7 +173,7 @@ def azalt(c1, c2, ellipsoid=True):
|
|||||||
azimuth = None
|
azimuth = None
|
||||||
if (c2rp[2]*c2rp[2]) + (c2rp[1]*c2rp[1]) > 1e-6:
|
if (c2rp[2]*c2rp[2]) + (c2rp[1]*c2rp[1]) > 1e-6:
|
||||||
theta = degrees(atan2(c2rp[2], c2rp[1]))
|
theta = degrees(atan2(c2rp[2], c2rp[1]))
|
||||||
azimuth = 270 - theta
|
azimuth = 90 - theta
|
||||||
if azimuth < 0: azimuth += 360
|
if azimuth < 0: azimuth += 360
|
||||||
if azimuth > 360: azimuth -= 360
|
if azimuth > 360: azimuth -= 360
|
||||||
azimuth = round(azimuth,4)
|
azimuth = round(azimuth,4)
|
||||||
@ -290,43 +290,44 @@ def shared_radio_horizon(c1, c2,):
|
|||||||
"antenna_distance": antenna_distance
|
"antenna_distance": antenna_distance
|
||||||
}
|
}
|
||||||
|
|
||||||
def tests():
|
# def tests():
|
||||||
import RNS
|
# import RNS
|
||||||
import numpy as np
|
# import numpy as np
|
||||||
from geographiclib.geodesic import Geodesic
|
# from geographiclib.geodesic import Geodesic
|
||||||
geod = Geodesic.WGS84
|
# geod = Geodesic.WGS84
|
||||||
coords = [
|
# coords = [
|
||||||
[(51.2308, 4.38703, 0.0), (47.699437, 9.268651, 0.0)],
|
# [(51.2308, 4.38703, 0.0), (47.699437, 9.268651, 0.0)],
|
||||||
[(51.2308, 4.38703, 0.0), (47.699437, 9.268651, 30.0*1e3)],
|
# [(51.2308, 4.38703, 0.0), (47.699437, 9.268651, 30.0*1e3)],
|
||||||
# [(51.230800, 4.38703, 0.0), (51.230801, 4.38703, 0.0)],
|
# [(0.0, 0.0, 0.0), (0.0, 1.0/60/60, 30.0)],
|
||||||
# [(35.3524, 135.0302, 100), (35.3532,135.0305, 500)],
|
# # [(51.230800, 4.38703, 0.0), (51.230801, 4.38703, 0.0)],
|
||||||
# [(57.758793, 22.605194, 0.0), (43.048838, -9.241343, 0.0)],
|
# # [(35.3524, 135.0302, 100), (35.3532,135.0305, 500)],
|
||||||
# [(0.0, 0.0, 0.0), (0.0, 0.0, 0.0)],
|
# # [(57.758793, 22.605194, 0.0), (43.048838, -9.241343, 0.0)],
|
||||||
# [(-90.0, 0.0, 0.0), (90.0, 0.0, 0.0)],
|
# # [(0.0, 0.0, 0.0), (0.0, 0.0, 0.0)],
|
||||||
# [(-90.0, 0.0, 0.0), (78.0, 0.0, 0.0)],
|
# # [(-90.0, 0.0, 0.0), (90.0, 0.0, 0.0)],
|
||||||
# [(0.0, 0.0, 0.0), (0.5, 179.5, 0.0)],
|
# # [(-90.0, 0.0, 0.0), (78.0, 0.0, 0.0)],
|
||||||
# [(0.7, 0.0, 0.0), (0.0, -180.0, 0.0)],
|
# # [(0.0, 0.0, 0.0), (0.5, 179.5, 0.0)],
|
||||||
]
|
# # [(0.7, 0.0, 0.0), (0.0, -180.0, 0.0)],
|
||||||
for cs in coords:
|
# ]
|
||||||
c1 = cs[0]; c2 = cs[1]
|
# for cs in coords:
|
||||||
print("Testing: "+str(c1)+" -> "+str(c2))
|
# c1 = cs[0]; c2 = cs[1]
|
||||||
us = time.time()
|
# print("Testing: "+str(c1)+" -> "+str(c2))
|
||||||
ld = c1+c2; g = geod.Inverse(c1[0], c1[1], c2[0], c2[1])
|
# us = time.time()
|
||||||
print("Lib computed in "+str(round((time.time()-us)*1e6, 3))+"us")
|
# ld = c1+c2; g = geod.Inverse(c1[0], c1[1], c2[0], c2[1])
|
||||||
us = time.time()
|
# print("Lib computed in "+str(round((time.time()-us)*1e6, 3))+"us")
|
||||||
eld = orthodromic_distance(c1,c2,ellipsoid=True)
|
# us = time.time()
|
||||||
if eld:
|
# eld = orthodromic_distance(c1,c2,ellipsoid=True)
|
||||||
print("Own computed in "+str(round((time.time()-us)*1e6, 3))+"us")
|
# if eld:
|
||||||
else:
|
# print("Own computed in "+str(round((time.time()-us)*1e6, 3))+"us")
|
||||||
print("Own timed out in "+str(round((time.time()-us)*1e6, 3))+"us")
|
# else:
|
||||||
ed_own = euclidian_distance(c1,c2,ellipsoid=True)
|
# print("Own timed out in "+str(round((time.time()-us)*1e6, 3))+"us")
|
||||||
sd_own = orthodromic_distance(c1,c2,ellipsoid=False)
|
# ed_own = euclidian_distance(c1,c2,ellipsoid=True)
|
||||||
aa = azalt(c1,c2,ellipsoid=True)
|
# sd_own = orthodromic_distance(c1,c2,ellipsoid=False)
|
||||||
fac = 1
|
# aa = azalt(c1,c2,ellipsoid=True)
|
||||||
if eld: print("LibDiff = "+RNS.prettydistance(g['s12']-eld)+f" {fac*g['s12']-fac*eld}")
|
# fac = 1
|
||||||
print("Spherical = "+RNS.prettydistance(sd_own)+f" {fac*sd_own}")
|
# if eld: print("LibDiff = "+RNS.prettydistance(g['s12']-eld)+f" {fac*g['s12']-fac*eld}")
|
||||||
# print("EllipLib = "+RNS.prettydistance(g['s12'])+f" {fac*g['s12']}")
|
# print("Spherical = "+RNS.prettydistance(sd_own)+f" {fac*sd_own}")
|
||||||
if eld: print("Ellipsoid = "+RNS.prettydistance(eld)+f" {fac*eld}")
|
# # print("EllipLib = "+RNS.prettydistance(g['s12'])+f" {fac*g['s12']}")
|
||||||
print("Euclidian = "+RNS.prettydistance(ed_own)+f" {fac*ed_own}")
|
# if eld: print("Ellipsoid = "+RNS.prettydistance(eld)+f" {fac*eld}")
|
||||||
print("AzAlt = "+f" {aa[0]} / {aa[1]}")
|
# print("Euclidian = "+RNS.prettydistance(ed_own)+f" {fac*ed_own}")
|
||||||
print("")
|
# print("AzAlt = "+f" {aa[0]} / {aa[1]}")
|
||||||
|
# print("")
|
||||||
|
@ -771,7 +771,7 @@ class Location(Sensor):
|
|||||||
cs = (slat, slon, salt); cr = (lat, lon, alt)
|
cs = (slat, slon, salt); cr = (lat, lon, alt)
|
||||||
ed = euclidian_distance(cs, cr)
|
ed = euclidian_distance(cs, cr)
|
||||||
od = orthodromic_distance(cs, cr)
|
od = orthodromic_distance(cs, cr)
|
||||||
aa = azalt(cs, cr)
|
aa = azalt(cr, cs)
|
||||||
ath = angle_to_horizon(cr)
|
ath = angle_to_horizon(cr)
|
||||||
atd = aa[1]-ath
|
atd = aa[1]-ath
|
||||||
above_horizon = None
|
above_horizon = None
|
||||||
|
Loading…
Reference in New Issue
Block a user