I have nearly parallel several $3D$ line segments. Some line segments are located (blue line) beside to a specific line segment (black line) and some others (red line) located away from that line segment.
I want to know which line is away and which is beside. I hope to do it by projecting all the line segments to that specific line segment (black line) and.. (however, I do not have a clear idea of how to do this... ). Also I am thinking to use the midpoints of red, blue lines and then project those points onto the black line and test whether it is within the ends.
Also, I am thinking of testing perpendicular distance between lines, but it doesn't give the correct answer. I guess as we do not know small distances are always given by away lines or vice-versa. However, I am looking for an easily implementable method. Any help please.
I also inserted an image to make it clear to you. Thank you in advance.