
Author 
Topic: algorithm for detecting lines intersection? (Read 602 times) 

lunetta

algorithm for detecting lines intersection?
« on: Oct 3^{rd}, 2004, 3:01pm » 

Hello all community Hope everybody had a nice summer (or nice winter depending on your coordinates) I'm still dumb after this summer. I was planning to get smarter, but it didn't work out. Anyway, that's why I can't figure out a simple nice way to detect when two lines with arbitrary coordinates intersect, and the coordinates of this intersection... Any light? thanks in advance




rgovostes

Re: algorithm for detecting lines intersection?
« Reply #2 on: Oct 18^{th}, 2004, 11:22pm » 

If you have the equations for two lines, e.g. y = 0.25x + 6 and y = 3x  12, you can solve for an equal point (they're a system of equations, after all). Code: Equation 1: y = 0.25x + 6 0.25x = y + 6 x = 4y  24 Equation 2: y = 3x  12 y = 3(4y  24)  12 y = 12y  84 11y = 84 y = 84/11 (this is the y value for the interception) x = 4(84/11)  24 x = 72/11 (this is the x value for the interception) .'. the two lines intercept at (84/11, 72/11) (I know, it turned out to be messy.) 





lunetta

Re: algorithm for detecting lines intersection?
« Reply #4 on: Oct 21^{st}, 2004, 1:56am » 

Hey thanks for all the feedback and those links were great... I'm studying them




