+class Point:
+ def __init__(self, (x, y)):
+ self.x = x
+ self.y = y
+
+ def __getitem__(self, key):
+ if key == 0:
+ return self.x
+ elif key == 1:
+ return self.y
+
+ def __iter__(self):
+ yield self.x
+ yield self.y
+
+ def __len__(self):
+ return 2
+
+class Line:
+ def __init__(self, (a, b, c)):
+ self.a, self.b, self.c = (a, b, c)
+ self.points = []
+
+ @classmethod
+ def from_ad(cls, (a, d), size):
+ p = linef.line_from_angl_dist((a, d), size)
+ return cls(ransac.points_to_line(*p))
+
+ def __iter__(self):
+ yield self.a
+ yield self.b
+ yield self.c
+
+ def __len__(self):
+ return 3
+
+lines = pickle.load(open('lines.pickle'))
+
+size = (520, 390)
+new_lines1 = map(lambda l: Line.from_ad(l, size), lines[0])
+new_lines2 = map(lambda l: Line.from_ad(l, size), lines[1])
+for l1 in new_lines1:
+ for l2 in new_lines2:
+ p = Point(intersection(l1, l2))
+ p.l1 = l1
+ p.l2 = l2
+ l1.points.append(p)
+ l2.points.append(p)
+
+points = [l.points for l in new_lines1]
+
+def gen_corners(d1, d2):
+ for c1 in d1.points:
+ if c1 in d2.points:
+ continue
+ pass
+ # TODO TODO TODO