|What you need to do is solving linear equations. As you (may) know from college mathematics, the equation of a straight line on a X-Y plane has the following form:
y = kx + b
unless it is a vertical line, in which case the equation has the form
x = b
Here k and b are constants. If you know the equations of the two lines, then the coordinates of the intersecting point (if exists) will be the solution (x, y) of these two equations. So what you need to do is:
a) Find the equation of the two lines.
b) Determine if they have an intersecting point.
c) Find the intersecting point by solving these two equations for x and y.
a) You need to know two different points on each line. Say (x1, y1) and (x2, y2). If x1 = x2, then the line is vertical, the equation is x = x1. Otherwise, the equation is y = kx + b, where k = (y2-y1)/(x2-x1) and b = y1 - x1(y2-y1)/(x2-x1).
b) Suppose you already have the equations of the two lines: y = k1 x + b1 and y = k2 x + b2. If k1 = k2, then the two lines are parallel (there is not intersecting point). If the two lines are both vertical, then there is no intersecting point either. Otherwise the intersecting point exists (but it may not be on the screen, it may be 200 miles away).
c) After a) and b), you can solve the two equations to get the coordinates of the intersecting point. This is left as an exercise.
Hope you are not bored with the above lecture.
P.S. By the way, this is very fast. Even if you have 100 pairs of lines, the code you write will be executed instantly.
My articles and software tools