diff --git a/mklines.py b/mklines.py index 85c049b..d474d08 100644 --- a/mklines.py +++ b/mklines.py @@ -31,8 +31,13 @@ def main(): print('line ', line.get_m(), line.get_b()) 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]) + p = None # This is risky + if i == len(lines) - 1: + print("last") + p = lines[i].intercept(lines[0]) + # Last line is a special case + else: + p = lines[i].intercept(lines[i+1]) print(p.get_x(), p.get_y()) return 0