mklines: fixes and batch calculation

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2022-02-14 14:46:47 +03:00
parent be1a2e5300
commit bc790e21c3
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -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]: