title: Snap point to nearest line
body: <p>I have a start and end point of every line. Every line can be only vertical or horizontal.</p>
  
  <p>Example:</p>
  
  <p><img src="https://i.stack.imgur.com/BdUcJ.png" alt="enter image description here"></p>
  
  <pre><code>Lines = [
    ((1, 1), (1, 7)), // (start, end)
    ((1, 1), (7, 1)),
    ((4, 1), (4, 7))
  ]
  
  Point = (6, 6)
  
  NearestPointOnLine = (4, 6) // magic here
  </code></pre>
  
  <p>How do I calculate the closest point on the line for any point?</p>