diff --git a/Karto/assignment4/KTZ004_2019_04_ats.py b/Karto/assignment4/KTZ004_2019_04_ats.py index 77c1476..2feef2d 100755 --- a/Karto/assignment4/KTZ004_2019_04_ats.py +++ b/Karto/assignment4/KTZ004_2019_04_ats.py @@ -130,8 +130,8 @@ Kelias A-08 Griovys G-11 ******* Visas prognozuojamo uzliejimo plotas (0.001 m2 tikslumu) -******* +%.3f""" % heptagon_area + """ Visas uzlietas plotas (0.001 m2 tikslumu) -******* +%.3f""" % circle_area + """ Plotas kuris liko neuzlietas (0.001 m2 tikslumu) -*******""") +%.3f""" % (heptagon_area - circle_area)) diff --git a/Karto/assignment4/measure.py b/Karto/assignment4/measure.py index 33b4304..0dde63d 100755 --- a/Karto/assignment4/measure.py +++ b/Karto/assignment4/measure.py @@ -2,7 +2,7 @@ from collections import namedtuple from decimal import Decimal as Dec from math import sin, cos, pi -from shapely.geometry import LineString +from shapely.geometry import LineString, asPolygon, Point as sPoint import numpy as np def normalize(ang): @@ -41,6 +41,13 @@ class Vertex: """xy returns a tuple of lksx and lksy coordinates""" return np.array([float(self.coords.lksx), float(self.coords.lksy)]) +def heptagon(d1): + angles = np.linspace(0, 2*pi, num=8) + R = float(D1)/2/sin(pi/7) + heptagon_xy = (np.array([np.cos(angles), np.sin(angles)])*R).T + return asPolygon(heptagon_xy) + + juosta = namedtuple('juosta', ['plotis', 'kryptis', 'dashes', 'spalva']) kelias = namedtuple('kelias', ['virsunes', 'plotis', 'kat', 'dashes', 'spalva', 'juostos']) @@ -128,6 +135,10 @@ K1 = Dec('13.147') + B # Atstumas iki tikrosios uzliejimo zonos (A1) (0.001 tikslumu) A1 = Dec('67.536') + B +circle_radius = float(D1)/2/sin(pi/7)-float(A1) +heptagon_area = heptagon(float(D1)).area +circle_area = sPoint(0,0).buffer(circle_radius).area + # Points is vertice map by id Points = {} for v in vertices: