Let's say you have a two-dimensional plane with 2 points (called a and N1 and N2) on it.
N1= [9 * H // 8 , 0] N2= [9 * H // 8 , W]
How do I check if my third point which is P= (int(x1), int(y1))
is intersecting the line that is crossing N1 and N2? (please note that p or third point might be moving anywhere on the plane, I only what not know when it is on the line)
So let's say
what I can think of is:
N1 = np.array([9 * H // 8, 0])
N2 = np.array([9 * H // 8, W]);
p_aftertop = (int(x1), int(y1))
v1 = (0,W ) # Vector 1
v2 = (9 * H // 8 - int(x1), W- int(y1)) # Vector 1
xp = v1[0] * v2[1] - v1[1] * v2[0] # Cross product
if (xp != 0):
status = cv2.imwrite('/img' + str(i) + '.jpg', frame)
print('on the line')
i +=1
I do not know why my method does not work well. How do I know when this point is on the line that crosses those two points?