If we are extracting data from the given dataset and we are able to plot two line segments based on that data. How to find the intersection point of those two line segments?
If we are extracting data from the given dataset and we are able to plot two line segments based on that data. How to find the intersection point of those two line segments?
From the two lines' slope and intersections, you can analytically derive and solve for their mutual intersection point in the following manner:
# slopes and interceptions
m1, b1 = .5, 2.0 # line 1
m2, b2 = 3.0, -3.0 # line 2
# mutual intersection point, x and y coordinate:
xi = (b1-b2) / (m2-m1)
yi = m1 * xi + b1
print(f"(xi, yi) = ({xi}, {yi})")
Returns
(xi, yi) = (2, 3)
See the lines with mutual intersection below for illustration:
And should you not have the slopes or intersections directly available, these can be computed from any two points from each line, see for example http://www.math.com/school/subject2/lessons/S2U4L2GL.html#:~:text=The%20equation%20of%20any%20straight,line%20crosses%20the%20y%20axis.