Number.prototype.toRad = function () { return this * Math.PI / 180 }, Number.prototype.toDeg = function () { return 180 * this / Math.PI }, L.LatLng.prototype.destinationPoint = function (a, b) { b /= 6378.14, a = a.toRad(); var c = this.lat.toRad(), d = this.lng.toRad(), e = Math.asin(Math.sin(c) * Math.cos(b) + Math.cos(c) * Math.sin(b) * Math.cos(a)), f = d + Math.atan2(Math.sin(a) * Math.sin(b) * Math.cos(c), Math.cos(b) - Math.sin(c) * Math.sin(e)); return isNaN(e) || isNaN(f) ? null : new L.LatLng(e.toDeg().toFixed(6), f.toDeg().toFixed(6)) }, L.LatLng.prototype.distanceTo = function (a, b) { void 0 === b && (b = 6371e3); var c = b, d = this.lat.toRad(), e = this.lng.toRad(), f = a.Lat.toRad(), g = a.Lon.toRad(), h = f - d, i = g - e, j = Math.sin(h / 2) * Math.sin(h / 2) + Math.cos(d) * Math.cos(f) * Math.sin(i / 2) * Math.sin(i / 2), k = 2 * Math.atan2(Math.sqrt(j), Math.sqrt(1 - j)), l = c * k; return l }, L.LatLng.prototype.bearingTo = function (a) { var b = this.lat.toRad(), c = a.Lat.toRad(), d = (a.Lon - this.lng).toRad(), e = Math.sin(d) * Math.cos(c), f = Math.cos(b) * Math.sin(c) - Math.sin(b) * Math.cos(c) * Math.cos(d), g = Math.atan2(e, f); return (g.toDeg() + 360) % 360 }, L.LatLng.prototype.rhumbDestinationPoint = function (a, b) { var c = 6378, d = parseFloat(b) / c, e = this.lat.toRad(), f = this.lng.toRad(); a = a.toRad(); var g = d * Math.cos(a); Math.abs(g) < 1e-10 && (g = 0); var h = e + g, i = Math.log(Math.tan(h / 2 + Math.PI / 4) / Math.tan(e / 2 + Math.PI / 4)), j = isFinite(g / i) ? g / i : Math.cos(e), k = d * Math.sin(a) / j; return Math.abs(h) > Math.PI / 2 && (h = h > 0 ? Math.PI - h : -Math.PI - h), lon2 = (f + k + 3 * Math.PI) % (2 * Math.PI) - Math.PI, new L.LatLng(h.toDeg(), lon2.toDeg()) };