Created
April 29, 2020 23:07
-
-
Save rowanwins/f665fa7be671827e0def6d6d475d926a 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 crossProduct (a, b) { | |
return (a.x * b.y) - (a.y * b.x) | |
} | |
const ab = crossProduct(A, B) | |
const ac = crossProduct(A, C) | |
const bd = crossProduct(B, D) | |
const cd = crossProduct(C, D) | |
const isInRange = (ab * bd < 0 && ac * cd > 0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment