From dcf1780f447199d22a17a07c239f2a5b60410b1e Mon Sep 17 00:00:00 2001 From: Hendrik Date: Tue, 21 Oct 2025 14:19:40 +0200 Subject: [PATCH] Umrechnung ell cart --- GHA/Hallo Welt!.py | 1 - ellipsoide.py | 63 +++++++++++++++++++++++++++++++++--- koord_umrechnung_triaxial.py | 3 -- 3 files changed, 59 insertions(+), 8 deletions(-) delete mode 100644 GHA/Hallo Welt!.py delete mode 100644 koord_umrechnung_triaxial.py diff --git a/GHA/Hallo Welt!.py b/GHA/Hallo Welt!.py deleted file mode 100644 index 6437288..0000000 --- a/GHA/Hallo Welt!.py +++ /dev/null @@ -1 +0,0 @@ -print("Hallo Welt!") diff --git a/ellipsoide.py b/ellipsoide.py index 531f223..e77c434 100644 --- a/ellipsoide.py +++ b/ellipsoide.py @@ -120,8 +120,63 @@ class EllipsoidTriaxial: return cls(ax, ay, b) def ell2cart(self, beta, lamb, u): - 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 + """ + Panou 2014 12ff. + :param beta: ellipsoidische Breite + :param lamb: ellipsoidische Länge + :param u: Höhe + :return: kartesische Koordinaten + """ + beta = wu.deg2rad(beta) + lamb = wu.deg2rad(lamb) - x = np.sqrt(u**2 + self.ex**2) * np.sqrt(np.cos(beta)**2 + self.ee**2/self.ex**2 * np.sin(beta)**2) \ No newline at end of file + # 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) + + 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 cart2ell(self, x, y, z): + """ + Panou 2014 15ff. + :param x: + :param y: + :param z: + :return: + """ + 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) + c0 = (self.ax**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) + + p = (c2**2 - 3*c1) / 9 + q = (9*c1*c2 - 27*c0 - 2*c2**3) / 54 + omega = np.arccos(q / np.sqrt(p**3)) + + s1 = 2 * np.sqrt(p) * np.cos(omega/3) - c2/3 + s2 = 2 * np.sqrt(p) * np.cos(omega/3 - 2*np.pi/3) - c2/3 + s3 = 2 * np.sqrt(p) * np.cos(omega/3 - 4*np.pi/3) - c2/3 + # print(s1, s2, s3) + + beta = np.arctan(np.sqrt((-self.b**2 - s2) / (self.ay**2 + s2))) + lamb = np.arctan(np.sqrt((-self.ay**2 - s3) / (self.ax**2 + s3))) + u = np.sqrt(self.b**2 + s1) + + return beta, lamb, u + + +if __name__ == "__main__": + ellips = EllipsoidTriaxial.init_name("Eitschberger1978") + # ellips = EllipsoidTriaxial.init_name("Bursa1972") + # carts = ellips.ell2cart(10, 30, 6378172) + # ells = ellips.cart2ell(carts[0], carts[1], carts[2]) + + carts = ellips.ell2cart(90, 0, 6356754.4) + # print(aus.gms("beta", ells[0], 3), aus.gms("lambda", ells[1], 3), "u =", ells[2]) + pass diff --git a/koord_umrechnung_triaxial.py b/koord_umrechnung_triaxial.py deleted file mode 100644 index e1b894e..0000000 --- a/koord_umrechnung_triaxial.py +++ /dev/null @@ -1,3 +0,0 @@ -import numpy as np - -def ell2cart() \ No newline at end of file