diff --git a/mklines.py b/mklines.py index e76a7ea..85c049b 100644 --- a/mklines.py +++ b/mklines.py @@ -20,16 +20,20 @@ def main(): perr('Invalid or corrupt samples') return -1 #for val in points: print(val.get_cartesian()) - lines = set() + lines = list() for i in range(0, len(points), 2): p1 = points[i] p2 = points[i+1] print('p1 ', p1.get_x(), p1.get_y()) print('p2 ', p2.get_x(), p2.get_y()) line = StraightLine(p1, p2) - lines.add(line) + lines.append(line) print('line ', line.get_m(), line.get_b()) - #for line in lines: print(line.get_m()) + intercepts = list() + for i, line in enumerate(lines): + if i == len(lines) - 1: break # Last line is a special case + p = lines[i].intercept(lines[i+1]) + print(p.get_x(), p.get_y()) return 0 def read_csv(filename: str, remove_header=False) -> list[PointWithID]: