Created
October 5, 2012 19:36
-
-
Save ashblue/3841880 to your computer and use it in GitHub Desktop.
Distance between points using two vertices
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
/** | |
* Calculates the distqance between two vertices and returns the value | |
* @param {array} startVert Start x and y point | |
* @param {array} endVert End x and y point | |
* @returns {number} | |
*/ | |
function distanceBetweenPoints (startVert, endVert) { | |
return Math.sqrt(Math.pow(endVert[0] - startVert[0], 2) + Math.pow(endVert[1] - startVert[1], 2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment