Created
March 24, 2017 22:18
-
-
Save msalahat/8a4f424326446926b49b24000970d193 to your computer and use it in GitHub Desktop.
Calculate Distance Between 2 pixels in 2D sphere
This file contains 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
const calculate_distance = (x1, y1, x2, y2) => { | |
let xd = x2 - x1; | |
let yd = y2 - y1; | |
let distance = Math.sqrt(xd * xd + yd * yd); | |
return distance; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment