This is a problem that I have often encountered, and I am looking for a more effective way to solve it. Take a look at these photos:


Suppose you want to find the shortest distance from a red dot to a line segment n . Suppose you know only the start / end point (x, y) of the segments and the point. Now this can be done in O (n), where n are line segments, checking each distance from a point to a line segment. This IMO is inefficient, because in the worst case, there should be n-1 remote checks until the right one is found.
n = 1000 f.e. ( ), , , , , Vincenty's.
:
, , , - O (n). , ?
: , / "" - , , . -, O (m), m < .