I have a list of line curves.The lines can point in opposite directions, but I want to treat opposite vectors as the same direction, so +X and -X are both “X direction,” and +Y and -Y are both “Y direction.”
I need to group the curves by their overall/unoriented direction, count how many curves are in each direction group, and then return only the curves from the least common direction group.
For example, if I have 50 lines in the X direction and 2 lines in the Y direction, I want the result to be those 2 Y-direction lines.
I was able to achieve it this way, but it feels like I’m using too many components. I suspect there may be a more efficient approach, or perhaps a mathematical concept that I’m missing.
I feel like you did just fine. I suppose you could abbreviate by finding the dot-product against unit-x. 0 values are then unit y, which cast to boolean are false for y direction, true for x: