Last active
August 29, 2015 14:05
-
-
Save codearachnid/c3aa8c06d7aa0119329e to your computer and use it in GitHub Desktop.
Convert degrees to radians
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
/** | |
* Convert degrees to radians | |
* @author Timothy Wood @codearachnid | |
* @link http://www.movable-type.co.uk/scripts/latlong.html | |
* @example | |
var latitude = 38.68551; | |
var longitude = -96.503906; | |
var latitude_radian = latitude.toRadians(); | |
var longitude_radian = longitude.toRadians(); | |
*/ | |
if ( typeof( Number.prototype.toRadians ) === "undefined" || !Number.prototype.toRad ) { | |
Number.prototype.toRadians = function() { | |
// todo better int handling for the calculation to ensure is truly a number | |
return this * Math.PI / 180; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment