export default function getPointYLineDistance(p, p1, p2) {
  const dy2 = (p.y - p1.y) ** 2;
  if (p2.x < p.x) {
    return (p2.x - p.x) ** 2 + dy2;
  }