Skip to content

Commit

Permalink
fix etops circle on map crossing -180°
Browse files Browse the repository at this point in the history
  • Loading branch information
flyingeek committed Jun 17, 2020
1 parent ec99aac commit 44bcaa8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyingeek/lidojs",
"version": "1.2.8",
"version": "1.2.9",
"description": "convert Lido OFP text files",
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
4 changes: 3 additions & 1 deletion src/modules/geopoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ class GeoPoint {
const rlat = Math.asin(Math.sin(lat1) * Math.cos(d) + Math.cos(lat1) *Math.sin(d) * Math.cos(tc));
let phi = lon1;
if (Math.cos(rlat) !== 0) {
phi = fmod(lon1 - Math.asin(Math.sin(tc) * Math.sin(d) / Math.cos(rlat)) +Math.PI, 2 * Math.PI) - Math.PI;
phi = Math.asin(Math.sin(tc) * Math.sin(d) / Math.cos(rlat))
if (lon1 - phi < - Math.PI) phi = lon1 + Math.PI; // fix PPT ETOPS circle
phi = fmod(lon1 - phi + Math.PI, 2 * Math.PI) - Math.PI;
}
return new GeoPoint(new LatPhi(rlat, phi).asLatLng);
}
Expand Down

0 comments on commit 44bcaa8

Please sign in to comment.