Skip to content

Instantly share code, notes, and snippets.

@christiannaths
Last active February 19, 2023 15:25
Show Gist options
  • Save christiannaths/b66028286cce8c45619a71643032a44d to your computer and use it in GitHub Desktop.
Save christiannaths/b66028286cce8c45619a71643032a44d to your computer and use it in GitHub Desktop.
function getX3(p1, p2, y3) {
let [x1, y1] = p1;
let [x2, y2] = p2;
let slope = (y2 - y1) / (x2 - x1);
let dy = y3 - y1
return x1 + ((1 / slope) * dy)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment