Select lines in the same direction - Grasshopper3d

Hi, I am sure there is a solution out there. I want to seprate all lines in one direction in a set of lines. I have tried different startegies but it has not worked for me. Any suggestion?
Quesry on Lines in (37.8 KB)

The order of your square source curves are not setup in a standard grid order, is that on purpose?

Also, the squares don’t all start from the same location, which is creating lines that appear to be in the same direction, but are actually pointing in the opposite.

If you fix the ordering of your grid, then selecting lines that run in parallel should be easy to do by calculating the cross vector between one line and the rest and dispatching your results into 2 separate lists.

Quesry on Lines in (43.1 KB)


Quesry on Lines in GRasshopper3d edited (358.3 KB)
I must be super bored.
It uses dot product to find lines with similar angle.

Honeycam 2023-04-04 21-17-52


Many Thanks. It helped a lot.