Here you can find the source of toRad()
Number.prototype.toRad = function() { return this * Math.PI / 180; }; Number.prototype.toDeg = function() { return this * 180 / Math.PI; }; global.getPointAtDistance = function(lat, lon, brng, dist) { dist = dist / 6371000;/*from w w w .j ava2s. c om*/ brng = brng.toRad(); var lat1 = lat.toRad(), lon1 = lon.toRad(); var lat2 = Math.asin(Math.sin(lat1) * Math.cos(dist) + Math.cos(lat1) * Math.sin(dist) * Math.cos(brng)); var lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(dist) * Math.cos(lat1), Math.cos(dist) - Math.sin(lat1) * Math.sin(lat2)); if (isNaN(lat2) || isNaN(lon2)) return null; return [lat2.toDeg(), lon2.toDeg()]; };
Math.radians = function(degrees){ return degrees * Math.PI / 180; };
Math.degToRad = function(degrees){ return degrees * Math.PI / 180; };
Number.prototype.toRad = function() { return this * Math.PI / 180;
Number.prototype.toRad = function() { return this * Math.PI / 180; Number.prototype.toDeg = function() { return this * 180 / Math.PI;
Number.prototype.toRad = function() { return this * Math.PI / 180; }; Number.prototype.toDegree = function() { return this / Math.PI * 180; };
Number.prototype.toRad = function() { return this * Math.PI / 180; };
Number.prototype.toRad = function() { return (this / 180) * Math.PI; };
Number.prototype.toRad = function() { return this * Math.PI / 180;
Number.prototype.toRadians = function() { return (this / 360) * 2 * Math.PI;