I have two curves, defined by
X1=[9, 10.5, 11, 12, 12, 11, 10, 8, 7, 7]
Y1=[-5, -3.5, -2.5, -0.7, 1, 3, 4, 5, 5, 5]
X2=[5, 7, 9, 9.5, 10, 11, 12]
Y2=[-2, 4, 1, 0, -0.5, -0.7, -3]
and by a function which is written in the system code I am using, I can have the coordinates of the intersection.
loop1=Loop([9, 10.5, 11, 12, 12, 11, 10, 8, 7, 7],[-5, -3.5, -2.5, -0.7, 1, 3, 4, 5, 5, 5])
loop2=Loop([5, 7, 9, 9.5, 10, 11, 12], [-2, 4, 1, 0, -0.5, -0.7, -3])
x_int, y_int = get_intersect(loop1,loop2)
Intersection = [[],[]]
Intersection.append(x_int)
Intersection.append(y_int)
for both curves, I need to find the points which are upstream and downstream the intersection identified by (x_int, y_int).
What I tried is something like:
for x_val, y_val, x, y in zip(Intersection[0], Intersection[1], loop1[0], loop1[1]):
if abs(x_val - x) < 0.5 and abs(y_val - y) < 0.5:
print(x_val, x, y_val, y)
The problem is that the result is extremely affected by the delta that I decide (0.5 in this case) and this gives me wrong results especially if I work with more decimal numbers (which is actually my case).
How can I make the loop more robust and actually find all and only the points which are upstream and downstream the intersection?
Many thanks for your help