Last active
August 29, 2015 14:23
-
-
Save jesty/4f5224d80806f6a1ce08 to your computer and use it in GitHub Desktop.
Route with same direction
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
/* | |
* Starting from two route, this algorithm, verify if they are the same direction. | |
* The computeHeading function is defined in https://gist.github.com/jesty/7b2a8e31d56c13a6adff | |
*/ | |
var sameDirection = function(startA, endA, startB, endB){ | |
var headingA = computeHeading(startA, endA); | |
var headingA = computeHeading(startB, endB); | |
return Math.abs(headingA - headingA) < 45 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment