可能重复:
Find the Intersection Points of All the Line Segments查找线交叉算法
嗨,
我有一组由2个点定义的线。你能推荐一个快速的算法,找到所有的交叉点吗?
感谢
可能重复:
Find the Intersection Points of All the Line Segments查找线交叉算法
嗨,
我有一组由2个点定义的线。你能推荐一个快速的算法,找到所有的交叉点吗?
感谢
如果你的意思是线段,你可以使用查找所有口岸Bentley-Ottmann algorithm在O((n+k)*log(n))
其中k
是过路的总数量,进而n
在您所设定的段数。
只是补充一点,在SO之前有一个关于执行的问题,也许它有帮助:Sibilance,定义,“哎!” http://stackoverflow.com/questions/4407493/existing-bentley-ottmann-algorithm-implementation – 2011-02-15 09:48:50
_Lines_或_line-segments_?可能是后者,但从来不知道...... – 2011-02-14 20:51:41