title: How do I move a point's y coordinate to intersect with a line?
body: <p><a href="https://i.stack.imgur.com/1sXpa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1sXpa.png" alt="enter image description here" /></a></p>
  <p>I have point <code>c</code>, which represents the center of a circle. After I drag the circle, I want its y coordinate <code>hmm</code> to snap to a line that's drawn between point <code>a</code> and <code>b</code>. How do I solve for <code>hmm</code>?</p>
  <p>So far I've been able to find the midway <code>y</code> value between points <code>a</code> and <code>b</code>. However, it's not taking into account point <code>c</code>'s <code>x</code> value.:</p>
  <pre><code>const snapYToLine = (aY, bY) =&gt; {
    const yDist = bY - aY;
    return aY + (yDist * 0.5);
  }
  
  const a = { x: 10, y: 10 };
  const b = { x: 50, y: 30 };
  const c = { x: 20, y: 0 }; // not doing anything with this yet...
  
  const hmm = snapYToLine(a.y, b.y); // will need to include c.x here...
  console.log(hmm);
  </code></pre>