@turf/rhumb-destination
Advanced tools
Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3
@@ -38,3 +38,8 @@ // https://en.wikipedia.org/wiki/Rhumb_line | ||
// solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678 | ||
destination[0] += (destination[0] - coords[0] > 180) ? -360 : (coords[0] - destination[0] > 180) ? 360 : 0; | ||
destination[0] += | ||
destination[0] - coords[0] > 180 | ||
? -360 | ||
: coords[0] - destination[0] > 180 | ||
? 360 | ||
: 0; | ||
return point(destination, options.properties); | ||
@@ -61,5 +66,5 @@ } | ||
// θ => theta | ||
radius = (radius === undefined) ? earthRadius : Number(radius); | ||
radius = radius === undefined ? earthRadius : Number(radius); | ||
var delta = distance / radius; // angular distance in radians | ||
var lambda1 = origin[0] * Math.PI / 180; // to radians, but without normalize to 𝜋 | ||
var lambda1 = (origin[0] * Math.PI) / 180; // to radians, but without normalize to 𝜋 | ||
var phi1 = degreesToRadians(origin[1]); | ||
@@ -76,6 +81,9 @@ var theta = degreesToRadians(bearing); | ||
var q = Math.abs(DeltaPsi) > 10e-12 ? DeltaPhi / DeltaPsi : Math.cos(phi1); | ||
var DeltaLambda = delta * Math.sin(theta) / q; | ||
var DeltaLambda = (delta * Math.sin(theta)) / q; | ||
var lambda2 = lambda1 + DeltaLambda; | ||
return [((lambda2 * 180 / Math.PI) + 540) % 360 - 180, phi2 * 180 / Math.PI]; // normalise to −180..+180° | ||
return [ | ||
(((lambda2 * 180) / Math.PI + 540) % 360) - 180, | ||
(phi2 * 180) / Math.PI, | ||
]; // normalise to −180..+180° | ||
} | ||
export default rhumbDestination; |
@@ -40,3 +40,8 @@ "use strict"; | ||
// solution from https://github.com/mapbox/mapbox-gl-js/issues/3250#issuecomment-294887678 | ||
destination[0] += (destination[0] - coords[0] > 180) ? -360 : (coords[0] - destination[0] > 180) ? 360 : 0; | ||
destination[0] += | ||
destination[0] - coords[0] > 180 | ||
? -360 | ||
: coords[0] - destination[0] > 180 | ||
? 360 | ||
: 0; | ||
return helpers_1.point(destination, options.properties); | ||
@@ -63,5 +68,5 @@ } | ||
// θ => theta | ||
radius = (radius === undefined) ? helpers_1.earthRadius : Number(radius); | ||
radius = radius === undefined ? helpers_1.earthRadius : Number(radius); | ||
var delta = distance / radius; // angular distance in radians | ||
var lambda1 = origin[0] * Math.PI / 180; // to radians, but without normalize to 𝜋 | ||
var lambda1 = (origin[0] * Math.PI) / 180; // to radians, but without normalize to 𝜋 | ||
var phi1 = helpers_1.degreesToRadians(origin[1]); | ||
@@ -78,6 +83,9 @@ var theta = helpers_1.degreesToRadians(bearing); | ||
var q = Math.abs(DeltaPsi) > 10e-12 ? DeltaPhi / DeltaPsi : Math.cos(phi1); | ||
var DeltaLambda = delta * Math.sin(theta) / q; | ||
var DeltaLambda = (delta * Math.sin(theta)) / q; | ||
var lambda2 = lambda1 + DeltaLambda; | ||
return [((lambda2 * 180 / Math.PI) + 540) % 360 - 180, phi2 * 180 / Math.PI]; // normalise to −180..+180° | ||
return [ | ||
(((lambda2 * 180) / Math.PI + 540) % 360) - 180, | ||
(phi2 * 180) / Math.PI, | ||
]; // normalise to −180..+180° | ||
} | ||
exports.default = rhumbDestination; |
{ | ||
"name": "@turf/rhumb-destination", | ||
"version": "6.2.0-alpha.2", | ||
"version": "6.2.0-alpha.3", | ||
"description": "turf rhumb-destination module", | ||
@@ -36,2 +36,6 @@ "author": "Turf Authors", | ||
"module": "dist/es/index.js", | ||
"exports": { | ||
"import": "./dist/es/index.js", | ||
"require": "./dist/js/index.js" | ||
}, | ||
"types": "dist/js/index.d.ts", | ||
@@ -43,13 +47,12 @@ "sideEffects": false, | ||
"scripts": { | ||
"bench": "npm-run-all prepare bench:run", | ||
"bench:run": "node bench.js", | ||
"bench": "ts-node bench.js", | ||
"build": "npm-run-all build:*", | ||
"build:es": "tsc --outDir dist/es --module esnext --declaration false && echo '{\"type\":\"module\"}' > dist/es/package.json", | ||
"build:js": "tsc", | ||
"docs": "node ../../scripts/generate-readmes", | ||
"prepare": "npm-run-all prepare:*", | ||
"prepare:es": "tsc --outDir dist/es --module esnext --declaration false", | ||
"prepare:js": "tsc", | ||
"test": "npm-run-all prepare test:*", | ||
"test:tape": "node -r esm test.js" | ||
"test": "npm-run-all test:*", | ||
"test:tape": "ts-node -r esm test.js" | ||
}, | ||
"devDependencies": { | ||
"@turf/truncate": "^6.2.0-alpha.2", | ||
"@turf/truncate": "^6.2.0-alpha.3", | ||
"@types/tape": "*", | ||
@@ -60,2 +63,3 @@ "benchmark": "*", | ||
"tape": "*", | ||
"ts-node": "*", | ||
"tslint": "*", | ||
@@ -66,6 +70,6 @@ "typescript": "*", | ||
"dependencies": { | ||
"@turf/helpers": "^6.2.0-alpha.2", | ||
"@turf/invariant": "^6.2.0-alpha.2" | ||
"@turf/helpers": "^6.2.0-alpha.3", | ||
"@turf/invariant": "^6.2.0-alpha.3" | ||
}, | ||
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09" | ||
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14377
7
204
10