There are efficient (compared to O(n2) pairwise testing) algorithms for finding all intersections in a set of line segments, like the Bentley-Ottmann algorithm. However, I want to find all intersections in a set of infinite lines. When the region of interest is something finite like a rectangle, the line-segment intersection algorithms can be applied after clipping the lines. But
- Is there a simpler or more efficient way than just clipping the lines and applying line-segment intersection algorithms?
- Is there an efficient algorithm for all intersections over the entire plane for a set of lines?
~O((n/m)^2)
but them
is number of the subdivisions making this a lot of faster. Here an example: Implementing Hoey Shamos algorithm with C#. However infinite lines can not be effectively subdivided spatially making such algorithms unusable. The only thing I can think of is compute unit direction vector of each line, sort the lines by it and ignore parallel lines. the rest is still~O(n^2)
but this will not give you much... – Spektre