title: Distance of a 3d Point to a Poly Line Segment Algorithm
body: <p>I have a path, made up of n 3d coordinates, all connected in series, which can be seen in <a href="http://img821.imageshack.us/img821/7915/segments.png" rel="nofollow">this diagram</a>.</p>
  
  <p>I want to find the shortest distance between my point and the poly line segment. I can calculate the distance of a point from a single line segment, but I want to do it for a more complicated path.</p>
  
  <p>Is there an algorithm for this that does not rely on testing every line segment to point distance and stores the minimum? Any pointers in the right direction would be great!</p>
  
  <p>This is for a games project where I want to calculate the distance of the player from a river that exists in the game. The river will be represented with poly line segments.</p>
  
  <p>Thanks</p>