mklines: fixes and batch calculation
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
be1a2e5300
commit
bc790e21c3
10
mklines.py
10
mklines.py
@ -20,16 +20,20 @@ def main():
|
|||||||
perr('Invalid or corrupt samples')
|
perr('Invalid or corrupt samples')
|
||||||
return -1
|
return -1
|
||||||
#for val in points: print(val.get_cartesian())
|
#for val in points: print(val.get_cartesian())
|
||||||
lines = set()
|
lines = list()
|
||||||
for i in range(0, len(points), 2):
|
for i in range(0, len(points), 2):
|
||||||
p1 = points[i]
|
p1 = points[i]
|
||||||
p2 = points[i+1]
|
p2 = points[i+1]
|
||||||
print('p1 ', p1.get_x(), p1.get_y())
|
print('p1 ', p1.get_x(), p1.get_y())
|
||||||
print('p2 ', p2.get_x(), p2.get_y())
|
print('p2 ', p2.get_x(), p2.get_y())
|
||||||
line = StraightLine(p1, p2)
|
line = StraightLine(p1, p2)
|
||||||
lines.add(line)
|
lines.append(line)
|
||||||
print('line ', line.get_m(), line.get_b())
|
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
|
return 0
|
||||||
|
|
||||||
def read_csv(filename: str, remove_header=False) -> list[PointWithID]:
|
def read_csv(filename: str, remove_header=False) -> list[PointWithID]:
|
||||||
|
Loading…
Reference in New Issue
Block a user