So I'm trying to use numpy.linalg.solve() to find where two lines intersect with each other using only some endpoints coordinates. If the coordinates of one lines are: (x1, y1)
, (x2, y2)
. I tried:
import numpy as np
a = np.array([[y2-y1],[x1-x2]])
b = np.array([(x1*y2)-(y1*x2)])
np.linalg.solve(a,b)
However I don't think the equations are correct and it is returning the following error:
numpy.linalg.LinAlgError: Last 2 dimensions of the array must be square
so I'm not really sure what to do, can someone help me with this?