As can be seen in figure below, I have some lines (finite length) between any two joints (red points), such as the line between joints J1 and J2. I have also some points such a
A voronoi diagram can gives you fast lookup. I think you can use the red points for the voronoi diagram. IMO the closest line is the same like the closest point.