normalize angles

This commit is contained in:
Motiejus Jakštys 2019-11-18 13:49:37 +02:00
parent 4d9a68c30b
commit c2d40c81a5
2 changed files with 91 additions and 63 deletions

View File

@ -2,7 +2,7 @@ from decimal import Decimal as D
class Deg: class Deg:
def __str__(self): def __str__(self):
return "%03d-%02d-%04.2f" % (self.deg, self.mm, self.ss) return "%03d-%02d-%4.2f" % (self.deg, self.mm, self.ss)
def __init__(self, deg, mm, ss): def __init__(self, deg, mm, ss):
self.deg = D(deg) self.deg = D(deg)

View File

@ -1,27 +1,55 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from decimal import Decimal from decimal import Decimal as Dec
from deg import Deg from deg import Deg
def fmt(orig, direction, deg):
return "%12.7f (%s: %12.7f)" % (orig, direction, deg)
def nrm(deg):
if deg > 180:
return deg - 360
if deg < -180:
return 360 + deg
return deg
def pr(deg): return fmt(deg, 'pr', nrm(deg - 90))
def rp(deg): return fmt(deg, 'rp', nrm(360 - deg))
def vp(deg): return fmt(deg, 'vp', nrm(180 + deg))
def pv(deg): return fmt(deg, 'pv', nrm(270 - deg))
def rs(deg): return fmt(deg, 'rs', nrm(deg))
def sv(deg): return fmt(deg, 'sv', nrm(90 + deg))
def vs(deg): return fmt(deg, 'vs', nrm(180 - deg))
def sr(deg): return fmt(deg, 'sr', nrm(90 - deg))
# Sklypu pradiniu tasku (1 ir 15) koordinates:
X1 = Dec('16639.290')
Y1 = Dec('25500.960')
X15 = Dec('17191.590')
Y15 = Dec('25121.430')
# Sklypu sujungimo tasko T3 koordinates:
XT3 = Dec('16971.790')
YT3 = Dec('26685.160')
# Pataisos ATKARPOMS: # Pataisos ATKARPOMS:
A = Decimal('-2.207') A = Dec('-2.207')
B = Decimal('1.999') B = Dec('1.999')
C = Decimal('4.838') C = Dec('4.838')
D = Decimal('2.862') D = Dec('2.862')
E = Decimal('-5.907') E = Dec('-5.907')
F = Decimal('-3.744') F = Dec('-3.744')
G = Decimal('-1.466') G = Dec('-1.466')
H = Decimal('6.841') H = Dec('6.841')
M = Decimal('-4.824') M = Dec('-4.824')
# Pataisos KAMPAMS: # Pataisos KAMPAMS:
K = Decimal('-7.7422786') K = Dec('-7.7422786')
L = Decimal('-6.6428275') L = Dec('-6.6428275')
N = Decimal('-4.2872043') N = Dec('-4.2872043')
P = Decimal('-3.1145084') P = Dec('-3.1145084')
R = Decimal('-7.2564859') R = Dec('-7.2564859')
S = Decimal('3.8874407') S = Dec('3.8874407')
T = Decimal('-8.7554531') T = Dec('-8.7554531')
print("""Sklypu pradiniu tasku (1 ir 15) koordinates: print("""Sklypu pradiniu tasku (1 ir 15) koordinates:
X1 = 16639.290 X1 = 16639.290
@ -34,52 +62,52 @@ XT3 = 16971.790
YT3 = 26685.160 YT3 = 26685.160
Atkarpos: Atkarpos:
1L-1 = %.3f""" % (Decimal('125.829') + G) + """ 1L-1 = %7.3f""" % (Dec('125.829') + G) + """
1L-2 = %.3f""" % (Decimal('81.682') + E) + """ 1L-2 = %7.3f""" % (Dec('81.682') + E) + """
1L-3 = %.3f""" % (Decimal('61.206') + H) + """ 1L-3 = %7.3f""" % (Dec('61.206') + H) + """
1L-4 = %.3f""" % (Decimal('121.055') + D) + """ 1L-4 = %7.3f""" % (Dec('121.055') + D) + """
1L-5 = %.3f""" % (Decimal('79.892') + B) + """ 1L-5 = %7.3f""" % (Dec('79.892') + B) + """
1L-6 = %.3f""" % (Decimal('159.299') + H) + """ 1L-6 = %7.3f""" % (Dec('159.299') + H) + """
1L-7 = %.3f""" % (Decimal('76.500') + E) + """ 1L-7 = %7.3f""" % (Dec('76.500') + E) + """
1L-8 = %.3f""" % (Decimal('51.091') + G) + """ 1L-8 = %7.3f""" % (Dec('51.091') + G) + """
1L-9 = %.3f""" % (Decimal('93.765') + F) + """ 1L-9 = %7.3f""" % (Dec('93.765') + F) + """
1L-10 = %.3f""" % (Decimal('58.926') + D) + """ 1L-10 = %7.3f""" % (Dec('58.926') + D) + """
1L-11 = %.3f""" % (Decimal('79.061') + M) + """ 1L-11 = %7.3f""" % (Dec('79.061') + M) + """
1L-12 = %.3f""" % (Decimal('121.209') + D) + """ 1L-12 = %7.3f""" % (Dec('121.209') + D) + """
1L-13 = %.3f""" % (Decimal('94.071') + C) + """ 1L-13 = %7.3f""" % (Dec('94.071') + C) + """
2L-1 = %.3f""" % (Decimal('205.221') + C) + """ 2L-1 = %7.3f""" % (Dec('205.221') + C) + """
2L-2 = %.3f""" % (Decimal('122.820') + G) + """ 2L-2 = %7.3f""" % (Dec('122.820') + G) + """
2L-3 = %.3f""" % (Decimal('178.657') + H) + """ 2L-3 = %7.3f""" % (Dec('178.657') + H) + """
2L-4 = %.3f""" % (Decimal('116.987') + B) + """ 2L-4 = %7.3f""" % (Dec('116.987') + B) + """
2L-5 = %.3f""" % (Decimal('84.793') + H) + """ 2L-5 = %7.3f""" % (Dec('84.793') + H) + """
2L-6 = %.3f""" % (Decimal('138.291') + F) + """ 2L-6 = %7.3f""" % (Dec('138.291') + F) + """
2L-7 = %.3f""" % (Decimal('85.607') + H) + """ 2L-7 = %7.3f""" % (Dec('85.607') + H) + """
2L-8 = %.3f""" % (Decimal('114.589') + G) + """ 2L-8 = %7.3f""" % (Dec('114.589') + G) + """
2L-9 = %.3f""" % (Decimal('79.210') + D) + """ 2L-9 = %7.3f""" % (Dec('79.210') + D) + """
Kampai: Kampai:
1K-1(L-M-S) = %3.7f""" % (Deg.guess('84-03-08.3').frac + P) + """ 1K-1 = %s""" % pr(Deg.guess('84-03-08.3').frac + P) + """
1K-2(L-M-S) = %3.7f""" % (Deg.guess('112-58-25.4').frac + S) + """ 1K-2 = %s""" % rp(Deg.guess('112-58-25.4').frac + S) + """
1K-3(L) = %3.7f""" % (Deg.guess('54.3107235').frac + L) + """ 1K-3 = %s""" % vp(Deg.guess('54.3107235').frac + L) + """
1K-4(L-M-S) = %3.7f""" % (Deg.guess('84-33-44.2').frac + S) + """ 1K-4 = %s""" % pr(Deg.guess('84-33-44.2').frac + S) + """
1K-5(L) = %3.7f""" % (Deg.guess('7.8383177').frac + P) + """ 1K-5 = %s""" % pv(Deg.guess('7.8383177').frac + P) + """
1K-6(L-M-S) = %3.7f""" % (Deg.guess('23-15-32.7').frac + P) + """ 1K-6 = %s""" % vp(Deg.guess('23-15-32.7').frac + P) + """
1K-7(L) = %3.7f""" % (Deg.guess('126.2540802').frac + K) + """ 1K-7 = %s""" % pv(Deg.guess('126.2540802').frac + K) + """
1K-8(L-M-S) = %3.7f""" % (Deg.guess('205-29-57.8').frac + K) + """ 1K-8 = %s""" % pv(Deg.guess('205-29-57.8').frac + K) + """
1K-9(L) = %3.7f""" % (Deg.guess('101.7366025').frac + S) + """ 1K-9 = %s""" % rs(Deg.guess('101.7366025').frac + S) + """
1K-10(L-M-S) = %3.7f""" % (Deg.guess('160-23-45.2').frac + T) + """ 1K-10 = %s""" % sv(Deg.guess('160-23-45.2').frac + T) + """
1K-11(L) = %3.7f""" % (Deg.guess('79.8680017').frac + K) + """ 1K-11 = %s""" % pv(Deg.guess('79.8680017').frac + K) + """
1K-12(L-M-S) = %3.7f""" % (Deg.guess('52-28-42.4').frac + R) + """ 1K-12 = %s""" % vs(Deg.guess('52-28-42.4').frac + R) + """
1K-13(L-M-S) = %3.7f""" % (Deg.guess('109-01-49.8').frac + T) + """ 1K-13 = %s""" % sr(Deg.guess('109-01-49.8').frac + T) + """
2K-1(L-M-S) = %3.7f""" % (Deg.guess('84-00-34.4').frac + L) + """ 2K-1 = %11.7f""" % (Deg.guess('84-00-34.4').frac + L) + """
2K-2(L) = %3.7f""" % (Deg.guess('76.1245808').frac + N) + """ 2K-2 = %11.7f""" % (Deg.guess('76.1245808').frac + N) + """
2K-3(L-M-S) = %3.7f""" % (Deg.guess('54-13-28.3').frac + P) + """ 2K-3 = %11.7f""" % (Deg.guess('54-13-28.3').frac + P) + """
2K-4(L) = %3.7f""" % (Deg.guess('182.7394778').frac + S) + """ 2K-4 = %11.7f""" % (Deg.guess('182.7394778').frac + S) + """
2K-5(L-M-S) = %3.7f""" % (Deg.guess('162-45-25.7').frac + L) + """ 2K-5 = %11.7f""" % (Deg.guess('162-45-25.7').frac + L) + """
2K-6(L-M-S) = %3.7f""" % (Deg.guess('60-41-55.2').frac + S) + """ 2K-6 = %11.7f""" % (Deg.guess('60-41-55.2').frac + S) + """
2K-7(L) = %3.7f""" % (Deg.guess('69.4792556').frac + R) + """ 2K-7 = %11.7f""" % (Deg.guess('69.4792556').frac + R) + """
2K-8(L-M-S) = %3.7f""" % (Deg.guess('130-50-06.1').frac + L) + """ 2K-8 = %11.7f""" % (Deg.guess('130-50-06.1').frac + L) + """
2K-9(L-M-S) = %3.7f""" % (Deg.guess('84-08-54.3').frac + K) 2K-9 = %11.7f""" % (Deg.guess('84-08-54.3').frac + K)
) )