title: Find the nearest point on a segment
body: <p>I try to find in Javascript a way to get the nearest point coordinates on a segment from 3 informations: The segment endpoints, let's say A = [x1,y1] and B = [x2,y2], and a point C = [x,y].</p>
  
  <p><a href="https://i.stack.imgur.com/ao01J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ao01J.png" alt="enter image description here"></a></p>
  
  <p>How to perform this?</p>