matlab - How to find all lines in a set that coincide in a single point? -
suppose given set of lines, how can partition set number of clusters, such lines in each cluster coincide in single point?
if number of lines n reasonable, can use o(n^3) algorithm: ever pair of lines (in form a*x+b*y+c=0
) check whether intersect - exclude pairs of parallel , not-coincident lines determinant
|a1 b1| = 0 |a2 b2|
for every intersecting pair if line shares same intersecting point, determinant:
|a1 b1 c1| |a2 b2 c2| = 0 |a3 b3 c3|
if n large cubic algorithm using, calculate intersection points (upto o(n^2) of them) , add these points map structure (hashtable, example). check matching points. don't forget numerical errors issue.
Comments
Post a Comment