Given n lines in a panel, how can you find how many intersection points are there(count in the duplicated intersection point)
注意的是,这是直线,而不是线段
所以两条直线,要么有一个交点,要么平行,这里排除重合的情况。
所以将平行的直线看做是平行等价的,用map记录平行等价直线类的数量,譬如平行类有a条,另一个平行类有b条,c,d
所以共有ab+ac+ad+bc+bd+cd个交点