I have a collection of lines:
Each has the properties: X1, X2, Y1, Y2
How can I determine whether any given line in the list (Line[n]) intercepts, at any point, any other line in the list?
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
There is a sweeping algorith for this with logarithmic complexity, precisely (n+k)log(n).
The algorithm is described as follows:
it is quite simple and easy algorithm, but tricky to describe... Should you have difficulties with understanding, I am sure you can with tons of alternative resources describing this algorithm and probably even implementing it.