mklines: find intercept of last line in a list
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
4c4366a5d1
commit
dc42010f0b
@ -31,7 +31,12 @@ 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 = 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
|
||||
|
Loading…
Reference in New Issue
Block a user