title: How can I implement the distance from a point to a line segment in GLSL?
body: <p>I just can't seem to spot my bug here, can you?</p>
  
  <pre><code>bool oblong (vec2 p, vec2 a, vec2 b, float r) {
   return (((b.y-a.y)*(p.x-a.x)+(b.x-a.x)*(p.y-a.y))^2/((b.x-a.x)^2+(b.y-a.y)^2)&lt;= r);
  }
  </code></pre>
  
  <p>This is my second GLSL program, (my first was a circle.) Thanks for your input!</p>