title: Shortest distance between a point and a line segment
body: <p>I need a basic function to find the shortest distance between a point and a line segment.  Feel free to write the solution in any language you want; I can translate it into what I'm using (Javascript).</p>
  
  <p>EDIT: My line segment is defined by two endpoints. So my line segment <code>AB</code> is defined by the two points <code>A (x1,y1)</code> and <code>B (x2,y2)</code>.  I'm trying to find the distance between this line segment and a point <code>C (x3,y3)</code>.  My geometry skills are rusty, so the examples I've seen are confusing, I'm sorry to admit.</p>