From 44c5e109459c84633638c25e809e8e2cbf5ae966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Mon, 25 Nov 2019 23:33:15 +0200 Subject: [PATCH] more measurements --- Karto/assignment4/measure.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Karto/assignment4/measure.py b/Karto/assignment4/measure.py index db31c04..84194c2 100755 --- a/Karto/assignment4/measure.py +++ b/Karto/assignment4/measure.py @@ -10,7 +10,13 @@ def guess(inp): else: return Dec(instr) -Point = namedtuple('Point', ['acadx', 'acady']) +class Point(namedtuple('Point', ['acadx', 'acady'])): + @property + def lksx(self): + return self.acady + @property + def lksy(self): + return self.acadx class Vertex: def __init__(self, point, length, angle, dirang=Dec()): @@ -20,7 +26,7 @@ class Vertex: self.dirang = dirang self.coords = Point(Dec(), Dec()) def __str__(self): - return "%2d: len:%7.3f ang:%8.4f dirang:%8.4f acoords:(%.3f,%.3f)" % \ + return "%2d: len:%7.3f ang:%8.4f dirang:%8.4f acadcoords:(%.3f,%.3f)" % \ (self.point, self.len, self.ang, self.dirang, self.coords.acadx, self.coords.acady) @@ -67,10 +73,8 @@ for v in vertices: angle_sum += v.ang theoretical_angle_sum = Dec(int((len(vertices)-2)*180)) -prev_dirang = A11_2 -for v in vertices[1:]: - v.dirang = prev_dirang + 180 - v.ang - dirang = v.dirang +for i, v in enumerate(vertices[1:]): + v.dirang = vertices[i].dirang + 180 - v.ang if __name__ == '__main__': print("""