# line segment intersection strange results

I'm using this formula. I am getting very strange results with (1,3) to (29,17) and (6,19) to (7,8). I got an X* value of 7. When I plugged this into my intercept calculator it said they intercept at (7.173913, 6.086957). How is this possible with line segments?

The same thing happened with (1,3) to (29,17) , (6,19) to (9,15). X* is 8.793103. My intercept calculator said they intercept at (13.363636, 9.181818).

line segment intersection

$$x_*=\frac{{x_1} ({x_3} ({y_2}-{y_4})+{x_4} ({y_3}-{y_2}))+{x_2} ({x_3} ({y_4}-{y_1})+{x_4} ({y_1}-{y_3}))}{({x_1}-{x_2}) ({y_3}-{y_4})+({x_4}-{x_3}) ({y_1}-{y_2})}$$ and this value must be such that $x_1 \leq x_* \leq x_2$ and $x_3 \leq x_* \leq x_4$ in order the segments intercept.

## 1 Answer

The two lines in your first case are $y=\frac12x+\frac52=(x+5)/2$ and $y=-11x+85$. Their intersection has $x^*=165/23$, which agrees with your intercept calculator. I don’t know what method you used for finding the intersection, but there’s something wrong with it. The fact that $x^*$ is greater than $7$ just means that the segments don’t intersect.

• I'm using the big x* formula in my post. I figured I could trust a guy that has 27.9K reputation score. That formula works in most cases, but I have found a few weird cases like what I just posted. – cokedude Oct 17 '14 at 5:15
• Right. Here’s a case where it’s more reliable to write down the two equations (point-point formula, for instance, for each) and solve the pair of simultaneous equations that you get. – Lubin Oct 18 '14 at 2:23