Well, you can use the undocumented RegionDistance
which does exactly this as follows: (This answer, as written, only works for V9 as noted by Oska, for V10 see update below)
here is a triangle in 3D
region = Polygon[{{0, 0, 0}, {1, 0, 0}, {0, 1, 1}}];
Graphics3D[region]
Now suppose you want to find the shortest distance from the point {1, 1, 1}
in 3D
to this triangle just do the following:
Load the Region context
Graphics`Region`RegionInit[];
Then
RegionDistance[region, {1, 1, 1}]
As a bonus, you can get the exact point on the triangle that is closest to the given point as follows:
RegionNearest[region, {1, 1, 1}]
Visualize it
Graphics3D[{region, Darker@Green, PointSize[0.03], Point[{1, 1, 1}],
Red, PointSize[0.03], Point[{1/3, 2/3, 2/3}]}]
Update for Version 10
The above undocumented functions used in this answer now works out of the box in V10 so no need to load the Region
context as I did above. Otherwise everything works as is. Also, now you can use the new Triangle
function in place of Polygon
above.