71 lines
2.0 KiB
Python
71 lines
2.0 KiB
Python
import sympy as sp
|
|
from decimal import Decimal
|
|
import math
|
|
|
|
class Berechnungen:
|
|
def __init__(self, a, b):
|
|
self.a_wert = a
|
|
self.b_wert = b
|
|
self.e_quadrat_wert = self.e_quadrat()
|
|
self.e_strich_quadrat_wert = self.e_strich_quadrat()
|
|
|
|
def e_quadrat(self):
|
|
return (self.a_wert**2 - self.b_wert**2) / self.a_wert **2
|
|
|
|
def e_strich_quadrat(self):
|
|
return (self.a_wert**2 - self.b_wert**2) / self.b_wert **2
|
|
|
|
def P(self, x, y):
|
|
return sp.sqrt(x**2 + y**2)
|
|
|
|
def hilfswinkel(self, z, x, y):
|
|
hw = sp.atan2(z * self.a_wert, self.P(x, y) * self.b_wert)
|
|
return hw
|
|
|
|
def B(self, z, x, y):
|
|
hilfswinkel = self.hilfswinkel(z, x, y)
|
|
B = sp.atan2((z + self.e_strich_quadrat_wert * self.b_wert * sp.sin(hilfswinkel) ** 3), (self.P(x, y) - self.e_strich_quadrat_wert * self.a_wert * sp.cos(hilfswinkel) ** 3))
|
|
return B
|
|
|
|
def L(self, x, y):
|
|
return sp.atan2(y, x)
|
|
|
|
def H(self, x, y, z):
|
|
B = self.B(z, x, y)
|
|
H = (self.P(x, y) / sp.cos(B)) - self.a_wert / (sp.sqrt(1 - self.e_quadrat_wert * sp.sin(B) ** 2))
|
|
return H
|
|
|
|
def geometrische_breite_laenge(self, dict_koordinaten):
|
|
for punktnummer, matrix in dict_koordinaten.items():
|
|
|
|
dict_koordinaten[punktnummer] = [matrix, self.B(matrix[2], matrix[0], matrix[1]), self.L(matrix[0], matrix[1])]
|
|
return dict_koordinaten
|
|
|
|
class Einheitenumrechnung:
|
|
def __init__(self):
|
|
pass
|
|
|
|
def mas_to_rad(mas):
|
|
umrechnungsfaktor = 1 / 1000 * 1 / 3600 * sp.pi / 180
|
|
grad = mas * umrechnungsfaktor
|
|
return grad
|
|
|
|
def mm_to_m(mm):
|
|
m = mm / 1000
|
|
return m
|
|
|
|
def ppb(ppb):
|
|
ppb *= 10 ** (-9)
|
|
return ppb
|
|
|
|
def gon_to_rad_Decimal(gon):
|
|
gon = Decimal(gon)
|
|
pi = Decimal(str(math.pi))
|
|
rad = (gon / Decimal(200)) * pi
|
|
return rad
|
|
|
|
def mgon_to_rad_Decimal(gon):
|
|
gon = Decimal(gon)
|
|
pi = Decimal(str(math.pi))
|
|
rad = (gon / Decimal(200000)) * pi
|
|
return rad |