import numpy as np import winkelumrechnungen as wu import ausgaben as aus class EllipsoidBiaxial: def __init__(self, a: float, b: float): self.a = a self.b = b self.c = a ** 2 / b self.e = np.sqrt(a ** 2 - b ** 2) / a self.e_ = np.sqrt(a ** 2 - b ** 2) / b @classmethod def init_name(cls, name: str): if name == "Bessel": a = 6377397.15508 b = 6356078.96290 return cls(a, b) elif name == "Hayford": a = 6378388 f = 1/297 b = a - a * f return cls(a, b) elif name == "Krassowski": a = 6378245 f = 298.3 b = a - a * f return cls(a, b) elif name == "WGS84": a = 6378137 f = 298.257223563 b = a - a * f return cls(a, b) @classmethod def init_af(cls, a: float, f: float): b = a - a * f return cls(a, b) V = lambda self, phi: np.sqrt(1 + self.e_ ** 2 * np.cos(phi) ** 2) M = lambda self, phi: self.c / self.V(phi) ** 3 N = lambda self, phi: self.c / self.V(phi) beta2psi = lambda self, beta: np.arctan(self.a / self.b * np.tan(beta)) beta2phi = lambda self, beta: np.arctan(self.a ** 2 / self.b ** 2 * np.tan(beta)) psi2beta = lambda self, psi: np.arctan(self.b / self.a * np.tan(psi)) psi2phi = lambda self, psi: np.arctan(self.a / self.b * np.tan(psi)) phi2beta = lambda self, phi: np.arctan(self.b ** 2 / self.a ** 2 * np.tan(phi)) phi2psi = lambda self, phi: np.arctan(self.b / self.a * np.tan(phi)) phi2p = lambda self, phi: self.N(phi) * np.cos(phi) def ellipsoidische_Koords (self, Eh, Ephi, x, y, z): p = np.sqrt(x**2+y**2) print(f"p = {round(p, 5)} m") lamb = np.arctan(y/x) phi_null = np.arctan(z/p*(1-self.e**2)**-1) hi = [0] phii = [phi_null] i = 0 while True: N = self.a*(1-self.e**2*np.sin(phii[i])**2)**(-1/2) h = p/np.cos(phii[i])-N phi = np.arctan(z/p*(1-(self.e**2*N)/(N+h))**(-1)) hi.append(h) phii.append(phi) dh = abs(hi[i]-h) dphi = abs(phii[i]-phi) i = i+1 if dh < Eh: if dphi < Ephi: break for i in range(len(phii)): print(f"P3[{i}]: {aus.gms('phi', phii[i], 5)}\th = {round(hi[i], 5)} m") return phi, lamb, h class EllipsoidTriaxial: def __init__(self, ax: float, ay: float, b: float): self.ax = ax self.ay = ay self.b = b self.ex = np.sqrt(self.ax**2 - self.b**2) self.ey = np.sqrt(self.ay**2 - self.b**2) self.ee = np.sqrt(self.ax**2 - self.ay**2) @classmethod def init_name(cls, name: str): if name == "BursaFialova1993": ax = 6378171.36 ay = 6378101.61 b = 6356751.84 return cls(ax, ay, b) elif name == "BursaSima1980": ax = 6378172 ay = 6378102.7 b = 6356752.6 return cls(ax, ay, b) elif name == "Eitschberger1978": ax = 6378173.435 ay = 6378103.9 b = 6356754.4 return cls(ax, ay, b) elif name == "Bursa1972": ax = 6378173 ay = 6378104 b = 6356754 return cls(ax, ay, b) elif name == "Bursa1970": ax = 6378173 ay = 6378105 b = 6356754 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 x = np.sqrt(u**2 + self.ex**2) * np.sqrt(np.cos(beta)**2 + self.ee**2/self.ex**2 * np.sin(beta)**2)