From 5574e67ff4a4059a504d8c56d52e328d0cecfa26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 28 Nov 2019 17:51:15 +0200 Subject: [PATCH] add lesson6 --- Karto/assignment4/KTZ004_2019_04_ats.py | 6 +++--- Karto/assignment4/measure.py | 4 ++++ Karto/lesson6/cnt.py | 28 +++++++++++++++++++++++++ Karto/lesson6/deg.py | 12 +++++++++++ 4 files changed, 47 insertions(+), 3 deletions(-) create mode 100755 Karto/lesson6/cnt.py create mode 100644 Karto/lesson6/deg.py diff --git a/Karto/assignment4/KTZ004_2019_04_ats.py b/Karto/assignment4/KTZ004_2019_04_ats.py index 5c4121a..f54d1a1 100755 --- a/Karto/assignment4/KTZ004_2019_04_ats.py +++ b/Karto/assignment4/KTZ004_2019_04_ats.py @@ -26,7 +26,7 @@ Plotis L2 (duotas) Plotis L3 (duotas) %.3f""" % L3 + """ Visas kelio A-05 plotis -******* +%.3f""" % A05_plotis + """ Koeficientas L2 plocio atidejimui (+/-0.001) ******* Koeficientas L3 plocio atidejimui (+/-0.001) @@ -45,7 +45,7 @@ Plotis L8 (duotas) Plotis L9 (duotas) %.3f""" % L9 + """ Visas kelio A-08 plotis -******* +%.3f""" % A08_plotis + """ Koeficientas L4 plocio atidejimui (+/-0.001) ******* Koeficientas L5 plocio atidejimui (+/-0.001) @@ -68,7 +68,7 @@ Plotis L12 (duotas) Plotis L13 (duotas) %.3f""" % L13 + """ Visas griovio G-11 plotis -******* +%.3f""" % G11_plotis + """ Koeficientas L10 plocio atidejimui (+/-0.001) ******* Koeficientas L11 plocio atidejimui (+/-0.001) diff --git a/Karto/assignment4/measure.py b/Karto/assignment4/measure.py index d0b8298..c306f78 100755 --- a/Karto/assignment4/measure.py +++ b/Karto/assignment4/measure.py @@ -56,6 +56,10 @@ L11 = Dec('3.305') L12 = Dec('2.210') L13 = Dec('4.381') +A05_plotis = L2 + L3 +A08_plotis = sum([L4,L5,L6,L7,L8,L9]) +G11_plotis = sum([L10,L11,L12,L13]) + # Directional coords + angle X11 = Dec('6091968.055') Y11 = Dec('485944.146') diff --git a/Karto/lesson6/cnt.py b/Karto/lesson6/cnt.py new file mode 100755 index 0000000..e77514e --- /dev/null +++ b/Karto/lesson6/cnt.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +from math import cos, tan, asin, sqrt +from deg import deg + +L12 = 396.942 +B12 = deg('40-19-21.0') +D12 = L12 * cos(B12) + +L23 = 421.159 +H23 = 25.771 +B23 = asin(H23 / L23) +D23 = sqrt(L23**2 - H23**2) + +L34 = 294.911 +B34 = deg('31-56-51.2') +D34 = L34 * cos(B34) + +H41 = 77.226 +B41 = deg('38-45-7.8') +D41 = H41 / tan(B41) + +print(""" +D12 = %4.3f""" % D12 + """ +D23 = %4.3f""" % D23 + """ +D34 = %4.3f""" % D34 + """ +D41 = %4.3f""" % D41 + """ +Sum = %4.3f""" % (D12 + D23 + D34 + D41) + """ +""") diff --git a/Karto/lesson6/deg.py b/Karto/lesson6/deg.py new file mode 100644 index 0000000..443e169 --- /dev/null +++ b/Karto/lesson6/deg.py @@ -0,0 +1,12 @@ +from math import pi + +def deg(inp): + """return angle in radians""" + if isinstance(inp, str) and '-' in inp: + deg, mm, ss = inp.split('-') + ddeg, dmm, dss = float(deg), float(mm), float(ss) + deg = ddeg + dmm/60 + dss/3600 + else: + deg = float(instr) + + return deg * pi / 180