Find Colinear lines from two lists

Hey all, is there an efficient way to extract the colinear lines from two lists? As known, the Set Intersection Component does not accept lines as the input. Thanks!

How_to_find_colinear_lines.gh (149.8 KB)

Not sure if it qualifies as efficient but it might help…

How_to_find_colinear_lines_RE.gh (158.2 KB)

1 Like

You can turn the lines into vectors and calculate the dot product. In short results of 1 and -1 are colinear. Bigger question is probably do you want to check the lines for each combination and some how utilize that info or just check the list of lines with the corresponding line on the other list.

1 Like

Thank you Jakinta for solving this. It costs 2 mins compared to the Set Intersection component with only 1 second to finish intersecting all ending points of the lines.

I hope there should be some third-party component for fast intersecting lines.

this is a bit faster, relies on the thing that the mid-point of a line identifies exclusively that possible line (so it will fail in more complex cases like if lines could connect diagonal points 0-2 and 1-3, in which case their middle point would identify both)

one note: there are several duplicate lines already inside your starting sets of lines

Rhino seems to agree on the number and position of duplicates found (I baked the outputs of DupLn from K2 to run this test)


How_to_find_colinear_lines_RE.gh (156.7 KB)

2 Likes