Possible Duplicate:
Shortest distance between a point and a line segment
i am looking for a way to calculate the minimum distance in all cases. the problems with solutions i found are:
Solutions with graphical conceptual drawings show point always on perpendicular from line segment so it's "between line segment's end points". My geometry skills are horrible so i can't verify that these solutions work in all cases.
Algorithm solutions are a: with fortran or some other language i don't fully understand, b: are flagged as incomplete by people, c: calling methods/functions that are not described in any way (considered trivial).
Good example of 2 a, b and c is
Shortest distance between a point and a line segment
i have the 2D line segment as double-type co-ordinate pair (x1, y1), (x2,y2) and point as double type co-ordinate (x3,y3). C#/Java/C solutions are all appreciated.
Thanks for your answers & BR: Matti