Skip to content

Instantly share code, notes, and snippets.

@mqklin
Created November 8, 2022 07:00
Show Gist options
  • Save mqklin/211c9c0650780d1794aa4eafd6972ad7 to your computer and use it in GitHub Desktop.
Save mqklin/211c9c0650780d1794aa4eafd6972ad7 to your computer and use it in GitHub Desktop.
// y = (x - xa) * (yb - ya) / (xb - xa) + ya
window.x = () => { // eslint-disable-line
const [xa, ya] = [-63, 4868.00];
const [xb, yb] = [-42, 4778.75];
const a = (yb - ya) / (xb - xa);
// const y = x * (yb - ya) / (xb - xa) - xa * (yb - ya) / (xb - xa) + ya;
// const b = x11 * (y12 - y11) / (x12 - x11) + y11;
const x_perpend = xa + 100;
const y_perpend = ya - 1 / a * 100;
console.log(a, x_perpend, y_perpend);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment