Find the shortest distance between a point and line segments (not line)
问题 I have set of line segments (not lines) , (A1, B1) , (A2, B2) , (A3, B3) , where A , B are ending points of the line segment. Each A and B has (x,y) coordinates. QUESTION: I need to know the shortest distance between point O and line segments as shown in the shown figure implemented in line of codes. The code I can really understand is either pseudo-code or Python. CODE: I tried to solve the problem with this code, unfortunately, it does not work properly. def dist(A, B, O): A_ = complex(*A)