- #1
msn009
- 53
- 6
I have computed a line from point A to point B by just subtracting the coordinates as below:
line = np.array (x2-x1, y2-y1)
I am not sure if I need to form the formula for this line first by computing the slope and intercept but I continued my code as below, slope being m and b being the intercept from the formula y=mx+b
slope = (y2-y1)/(x2-x1)
b = (y2-y1) - (x2-x1)*slope
Now I am not sure how I can calculate the distance of several x,y points to this line.
can anyone help? thanks.
line = np.array (x2-x1, y2-y1)
I am not sure if I need to form the formula for this line first by computing the slope and intercept but I continued my code as below, slope being m and b being the intercept from the formula y=mx+b
slope = (y2-y1)/(x2-x1)
b = (y2-y1) - (x2-x1)*slope
Now I am not sure how I can calculate the distance of several x,y points to this line.
can anyone help? thanks.