Last active
February 19, 2023 15:25
-
-
Save christiannaths/b66028286cce8c45619a71643032a44d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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