diverse Änderungen, Versuch der Lösung der zweiten GHA mit Louville

This commit is contained in:
2025-11-25 14:49:06 +01:00
parent 2ff4cff2be
commit 9031a12312
5 changed files with 308 additions and 121 deletions

View File

@@ -2,7 +2,6 @@ import numpy as np
import winkelumrechnungen as wu
import ausgaben as aus
import jacobian_Ligas
from GHA_triaxial.panou import p_q
class EllipsoidBiaxial:
@@ -110,6 +109,10 @@ class EllipsoidTriaxial:
@classmethod
def init_name(cls, name: str):
"""
Mögliche Ellipsoide: BursaFialova1993, BursaSima1980, Eitschberger1978, Bursa1972, Bursa1970, BesselBiaxial
:param name: Name des dreiachsigen Ellipsoids
"""
if name == "BursaFialova1993":
ax = 6378171.36
ay = 6378101.61
@@ -117,8 +120,8 @@ class EllipsoidTriaxial:
return cls(ax, ay, b)
elif name == "BursaSima1980":
ax = 6378172
ay = 6378102.7
b = 6356752.6
ay = 6378103
b = 6356753
return cls(ax, ay, b)
elif name == "Eitschberger1978":
ax = 6378173.435
@@ -135,61 +138,79 @@ class EllipsoidTriaxial:
ay = 6378105
b = 6356754
return cls(ax, ay, b)
elif name == "Bessel-biaxial":
elif name == "BesselBiaxial":
ax = 6377397.15509
ay = 6377397.15508
b = 6356078.96290
return cls(ax, ay, b)
elif name == "Fiction":
ax = 5500000
ay = 4500000
b = 4000000
return cls(ax, ay, b)
def ell2cart(self, beta, lamb, u):
def point_on(self, point: np.ndarray) -> bool:
"""
Test, ob ein Punkt auf dem Ellipsoid liegt.
:param point: kartesische 3D-Koordinaten
:return: Punkt auf dem Ellispoid?
"""
value = point[0]**2/self.ax**2 + point[1]**2/self.ay**2 + point[2]**2/self.b**2
if abs(1-value) < 0.000001:
return True
else:
return False
def ell2cart(self, beta: float, lamb: float, u: float) -> np.ndarray:
"""
Panou 2014 12ff.
:param beta: ellipsoidische Breite
:param lamb: ellipsoidische Länge
:param u: Höhe
:return: kartesische Koordinaten
Ellipsoidische Breite+Länge sind nicht gleich der geodätischen
Verhältnisse des Ellipsoids bekannt, Größe verändern bis Punkt erreicht,
dann ist u die Größe entlang der z-Achse
:param beta: ellipsoidische Breite [rad]
:param lamb: ellipsoidische Länge [rad]
:param u: Größe entlang der z-Achse
:return: Punkt in kartesischen Koordinaten
"""
s1 = u**2 - self.b**2
s2 = -self.ay**2 * np.sin(beta)**2 - self.b**2 * np.cos(beta)**2
s3 = -self.ax**2 * np.sin(lamb)**2 - self.ay**2 * np.cos(lamb)**2
# s1 = u**2 - self.b**2
# s2 = -self.ay**2 * np.sin(beta)**2 - self.b**2 * np.cos(beta)**2
# s3 = -self.ax**2 * np.sin(lamb)**2 - self.ay**2 * np.cos(lamb)**2
# print(s1, s2, s3)
xe = np.sqrt(((self.ax**2+s1) * (self.ax**2+s2) * (self.ax**2+s3)) /
((self.ax**2-self.ay**2) * (self.ax**2-self.b**2)))
ye = np.sqrt(((self.ay**2+s1) * (self.ay**2+s2) * (self.ay**2+s3)) /
((self.ay**2-self.ax**2) * (self.ay**2-self.b**2)))
ze = np.sqrt(((self.b**2+s1) * (self.b**2+s2) * (self.b**2+s3)) /
((self.b**2-self.ax**2) * (self.b**2-self.ax**2)))
# xe = np.sqrt(((self.ax**2+s1) * (self.ax**2+s2) * (self.ax**2+s3)) /
# ((self.ax**2-self.ay**2) * (self.ax**2-self.b**2)))
# ye = np.sqrt(((self.ay**2+s1) * (self.ay**2+s2) * (self.ay**2+s3)) /
# ((self.ay**2-self.ax**2) * (self.ay**2-self.b**2)))
# ze = np.sqrt(((self.b**2+s1) * (self.b**2+s2) * (self.b**2+s3)) /
# ((self.b**2-self.ax**2) * (self.b**2-self.ay**2)))
x = np.sqrt(u**2 + self.Ex**2) * np.sqrt(np.cos(beta)**2 + self.Ee**2/self.Ex**2 * np.sin(beta)**2) * np.cos(lamb)
y = np.sqrt(u**2 + self.Ey**2) * np.cos(beta) * np.sin(lamb)
z = u * np.sin(beta) * np.sqrt(1 - self.Ee**2/self.Ex**2 * np.cos(lamb)**2)
return x, y, z
def ell2cart_P(self, lamb, beta):
return np.array([x, y, z])
def ell2cart2(self, beta: float, lamb: float) -> np.ndarray:
"""
Panou 2013, 241
:param lamb: ellipsoidische Länge
:param beta: reduzierte ellipsoidische Breite
:return: kartesische Koordinaten x y z
Panou, Korakitis 2019 2
:param beta: ellipsoidische Breite [rad]
:param lamb: ellipsoidische Länge [rad]
:return: Punkt in kartesischen Koordinaten
"""
x = self.ax * np.sqrt(np.cos(beta) ** 2 + self.Ee ** 2 / self.Ex ** 2 * np.sin(beta) ** 2) * np.cos(lamb)
B = self.Ex**2 * np.cos(beta)**2 + self.Ee**2 * np.sin(beta)**2
L = self.Ex**2 - self.Ee**2 * np.cos(lamb)**2
x = self.ax / self.Ex * np.sqrt(B) * np.cos(lamb)
y = self.ay * np.cos(beta) * np.sin(lamb)
z = self.b * np.sin(beta) * np.sqrt(1 - self.Ee ** 2 / self.Ex ** 2 * np.cos(lamb) ** 2)
z = self.b / self.Ex * np.sin(beta) * np.sqrt(L)
return np.array([x, y, z])
return x, y, z
def cart2ell(self, x, y, z):
def cart2ell(self, point: np.ndarray) -> tuple[float, float, float]:
"""
Panou 2014 15ff.
:param x:
:param y:
:param z:
:return:
:param point: Punkt in kartesischen Koordinaten
:return: ellipsoidische Breite, ellipsoidische Länge, Größe entlang der z-Achse
"""
x, y, z = point
c2 = self.ax**2 + self.ay**2 + self.b**2 - x**2 - y**2 - z**2
c1 = (self.ax**2 * self.ay**2 + self.ax**2 * self.b**2 + self.ay**2 * self.b**2 -
(self.ay**2+self.b**2) * x**2 - (self.ax**2 + self.b**2) * y**2 - (self.ax**2 + self.ay**2) * z**2)
@@ -211,18 +232,34 @@ class EllipsoidTriaxial:
return beta, lamb, u
def cart2geod(self, mode: str, xG, yG, zG, maxIter=30, maxLoa=0.005):
def cart2ell2(self, point: np.ndarray) -> tuple[float, float]:
"""
Panou, Korakitis 2019 2f.
:param point: Punkt in kartesischen Koordinaten
:return: ellipsoidische Breite, ellipsoidische Länge
"""
x, y, z = point
c1 = x ** 2 + y ** 2 + z ** 2 - (self.ax ** 2 + self.ay ** 2 + self.b ** 2)
c0 = (self.ax ** 2 * self.ay ** 2 + self.ax ** 2 * self.b ** 2 + self.ay ** 2 * self.b ** 2 -
(self.ay ** 2 + self.b ** 2) * x ** 2 - (self.ax ** 2 + self.b ** 2) * y ** 2 - (
self.ax ** 2 + self.ay ** 2) * z ** 2)
t2 = (-c1 + np.sqrt(c1 ** 2 - 4 * c0)) / 2
t1 = c0 / t2
beta = np.arctan(np.sqrt((t1 - self.b**2) / (self.ay**2 - t1)))
lamb = np.arctan(np.sqrt((t2 - self.ay**2) / (self.ax**2 - t2)))
return beta, lamb
def cart2geod(self, mode: str, point: np.ndarray, maxIter: int = 30, maxLoa: float = 0.005) -> tuple[float, float, float]:
"""
Ligas 2012
:param mode:
:param xG:
:param yG:
:param zG:
:param maxIter:
:param maxLoa:
:return:
:param mode: ligas1, ligas2, oder ligas3
:param point: Punkt in kartesischen Koordinaten
:param maxIter: maximale Anzahl Iterationen
:param maxLoa: Level of Accuracy, das erreicht werden soll
:return: phi, lambda, h
"""
rG = np.sqrt(xG**2 + yG**2 + zG**2)
xG, yG, zG = point
rG = np.sqrt(xG ** 2 + yG ** 2 + zG ** 2)
pE = np.array([self.ax * xG / rG, self.ax * yG / rG, self.ax * zG / rG], dtype=np.float64)
E = 1 / self.ax**2
@@ -247,65 +284,93 @@ class EllipsoidTriaxial:
phi = np.arctan((1-self.ee**2) / (1-self.ex**2) * pE[2] / np.sqrt((1-self.ee**2)**2 * pE[0]**2 + pE[1]**2))
lamb = np.arctan(1/(1-self.ee**2) * pE[1]/pE[0])
h = np.sign(zG-pE[2]) * np.sign(pE[2]) * np.sqrt((pE[0]-xG)**2 + (pE[1]-yG)**2 + (pE[2]-zG)**2)
h = np.sign(zG - pE[2]) * np.sign(pE[2]) * np.sqrt((pE[0] - xG) ** 2 + (pE[1] - yG) ** 2 + (pE[2] - zG) ** 2)
return phi, lamb, h
def geod2cart(self, phi, lamb, h):
def geod2cart(self, phi: float, lamb: float, h: float) -> np.ndarray:
"""
Ligas 2012, 250
:param phi:
:param lamb:
:param h:
:return:
:param phi: geodätische Breite [rad]
:param lamb: geodätische Länge [rad]
:param h: Höhe über dem Ellipsoid
:return: kartesische Koordinaten
"""
v = self.ax / np.sqrt(1 - self.ex**2*np.sin(phi)**2-self.ee**2*np.cos(phi)**2*np.sin(lamb)**2)
xG = (v + h) * np.cos(phi) * np.cos(lamb)
yG = (v * (1-self.ee**2) + h) * np.cos(phi) * np.sin(lamb)
zG = (v * (1-self.ex**2) + h) * np.sin(phi)
return xG, yG, zG
return np.array([xG, yG, zG])
def para2cart(self, u, v):
def cartonell(self, point: np.ndarray) -> tuple[np.ndarray, float, float, float]:
"""
Berechnung des Lotpunktes auf einem Ellipsoiden
:param point: Punkt in kartesischen Koordinaten, der gelotet werden soll
:return: Lotpunkt in kartesischen Koordinaten, geodätische Koordinaten des Punktes
"""
phi, lamb, h = self.cart2geod("ligas3", point)
x, y, z = self. geod2cart(phi, lamb, 0)
return np.array([x, y, z]), phi, lamb, h
def cartellh(self, point: np.ndarray, h: float) -> np.ndarray:
"""
Punkt auf Ellipsoid hoch loten
:param point: Punkt auf dem Ellipsoid
:param h: Höhe über dem Ellipsoid
:return: hochgeloteter Punkt
"""
phi, lamb, _ = self.cart2geod("ligas3", point)
pointH = self. geod2cart(phi, lamb, h)
return pointH
def para2cart(self, u: float, v: float) -> np.ndarray:
"""
Panou, Korakitits 2020, 4
:param u:
:param v:
:return:
:param u: Parameter u
:param v: Parameter v
:return: Punkt in kartesischen Koordinaten
"""
x = self.ax * np.cos(u) * np.cos(v)
y = self.ay * np.cos(u) * np.cos(v)
y = self.ay * np.cos(u) * np.sin(v)
z = self.b * np.sin(u)
return np.array([x, y, z])
def cart2para(self, x, y, z):
def cart2para(self, point: np.ndarray) -> tuple[float, float]:
"""
Panou, Korakitits 2020, 4
:param x:
:param y:
:param z:
:return:
:param point: Punkt in kartesischen Koordinaten
:return: parametrische Koordinaten
"""
x, y, z = point
u_check1 = z*np.sqrt(1 - self.ee**2)
u_check2 = np.sqrt(x**2 * (1-self.ee**2) + y**2) * np.sqrt(1-self.ex**2)
if u_check1 <= u_check2:
u = np.arctan(u_check1 / u_check2)
u = np.arctan2(u_check1, u_check2)
else:
u = np.pi/2 * np.arctan(u_check2 / u_check1)
u = np.pi/2 * np.arctan2(u_check2, u_check1)
v_check1 = y
v_check2 = x*np.sqrt(1-self.ee**2)
v_factor = np.sqrt(x**2*(1-self.ee**2)+y**2)
if v_check1 <= v_check2:
v = 2 * np.arctan(v_check1 / (v_check2 + np.sqrt(x**2*(1-self.ee**2)+y**2)))
v = 2 * np.arctan2(v_check1, v_check2 + v_factor)
else:
v = np.pi/2 - 2 * np.arctan(v_check2 / (v_check1 + np.sqrt(x**2*(1-self.ee**2)+y**2)))
v = np.pi/2 - 2 * np.arctan2(v_check2, v_check1 + v_factor)
return u, v
def p_q(self, x, y, z):
def p_q(self, x, y, z) -> dict:
"""
Berechnung sämtlicher Größen
:param x: x
:param y: y
:param z: z
:return: Dictionary sämtlicher Größen
"""
H = x ** 2 + y ** 2 / (1 - self.ee ** 2) ** 2 + z ** 2 / (1 - self.ex ** 2) ** 2
n = np.array([x / np.sqrt(H), y / ((1 - self.ee ** 2) * np.sqrt(H)), z / ((1 - ell.ex ** 2) * np.sqrt(H))])
n = np.array([x / np.sqrt(H), y / ((1 - self.ee ** 2) * np.sqrt(H)), z / ((1 - self.ex ** 2) * np.sqrt(H))])
beta, lamb, u = self.cart2ell(x, y, z)
carts = self.ell2cart(beta, lamb, u)
beta, lamb, u = self.cart2ell(np.array([x, y, z]))
B = self.Ex ** 2 * np.cos(beta) ** 2 + self.Ee ** 2 * np.sin(beta) ** 2
L = self.Ex ** 2 - self.Ee ** 2 * np.cos(lamb) ** 2
@@ -335,38 +400,40 @@ class EllipsoidTriaxial:
"t2": t2,
"F": F, "p": p, "q": q}
def louvilleConstant(ell, x, y, z):
values = p_q(ell, x, y, z)
pass
if __name__ == "__main__":
ellips = EllipsoidTriaxial.init_name("Eitschberger1978")
ell = EllipsoidTriaxial.init_name("Eitschberger1978")
# carts = ellips.ell2cart(wu.deg2rad(10), wu.deg2rad(30), 6378172)
# ells = ellips.cart2ell(carts[0], carts[1], carts[2])
# print(aus.gms("beta", ells[0], 3), aus.gms("lambda", ells[1], 3), "u =", ells[2])
# ells2 = ellips.cart2ell(5712200, 2663400, 1106000)
# carts2 = ellips.ell2cart(ells2[0], ells2[1], ells2[2])
# print(aus.xyz(carts2[0], carts2[1], carts2[2], 10))
point = np.array([5672455, 2698193, 1103177])
pointell, _, _, _ = ell.cartonell(point)
values1 = ell.cart2ell(point)
values2 = ell.cart2ell2(pointell)
carts1 = ell.ell2cart(values2[0], values2[1], ell.b)
carts2 = ell.ell2cart2(values2[0], values2[1])
# stellen = 20
# geod1 = ellips.cart2geod("ligas1", 5712200, 2663400, 1106000)
# print(aus.gms("phi", geod1[0], stellen), aus.gms("lambda", geod1[1], stellen), "h =", geod1[2])
# geod2 = ellips.cart2geod("ligas2", 5712200, 2663400, 1106000)
# print(aus.gms("phi", geod2[0], stellen), aus.gms("lambda", geod2[1], stellen), "h =", geod2[2])
# geod3 = ellips.cart2geod("ligas3", 5712200, 2663400, 1106000)
# print(aus.gms("phi", geod3[0], stellen), aus.gms("lambda", geod3[1], stellen), "h =", geod3[2])
# cart1 = ellips.geod2cart(geod1[0], geod1[1], geod1[2])
# print(aus.xyz(cart1[0], cart1[1], cart1[2], 10))
# cart2 = ellips.geod2cart(geod2[0], geod2[1], geod2[2])
# print(aus.xyz(cart2[0], cart2[1], cart2[2], 10))
# cart3 = ellips.geod2cart(geod3[0], geod3[1], geod3[2])
# print(aus.xyz(cart3[0], cart3[1], cart3[2], 10))
# test_cart = ellips.geod2cart(0.175, 0.444, 100)
# print(aus.xyz(test_cart[0], test_cart[1], test_cart[2], 10))
ellips.louvilleConstant(5712200, 2663400, 1106000)
pass
# cart_x, cart_y, cart_z = np.array([5672455, 2698193, 1103177])
# cart_x, cart_y, cart_z = np.array([3415031.1337320395, 3414993.9029805865, 588647.548260936])
# cart_x, cart_y, cart_z = np.array([6378173.435, 0, 0])
# cart_x, cart_y, cart_z = np.array([0, 6378103.9, 0])
# cart_x, cart_y, cart_z = np.array([0, 0, 6356754.4])
cart_x, cart_y, cart_z = np.array([1000, 1000, 1000])
print(aus.xyz(cart_x, cart_y, cart_z, 10), " Startwerte")
beta, lamb_ell, u = ell.cart2ell(np.array([cart_x, cart_y, cart_z]))
phi, lamb_geod, h = ell.cart2geod("ligas3", np.array([cart_x, cart_y, cart_z]))
u_para, v_para = ell.cart2para(np.array([cart_x, cart_y, cart_z]))
e_x, e_y, e_z = ell.ell2cart(beta, lamb_ell, u)
print(aus.xyz(e_x, e_y, e_z, 10), f", Distanz ellipsoidisch: {np.linalg.norm(np.array([cart_x, cart_y, cart_z]) - np.array([e_x, e_y, e_z]))} m")
g_x, g_y, g_z = ell.geod2cart(phi, lamb_geod, h)
print(aus.xyz(g_x, g_y, g_z, 10), f", Distanz geodätisch: {np.linalg.norm(np.array([cart_x, cart_y, cart_z]) - np.array([g_x, g_y, g_z]))} m")
p_x, p_y, p_z = ell.para2cart(u_para, v_para)
print(aus.xyz(p_x, p_y, p_z, 10), f", Distanz parametrisch: {np.linalg.norm(np.array([cart_x, cart_y, cart_z]) - np.array([p_x, p_y, p_z]))} m")
pass
carts = ell.ell2cart(wu.deg2rad(10), wu.deg2rad(20), 6356754.4)
pass