Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Merge pull request #21 from darkskyapp/ironwallaby/fix_astro
Browse files Browse the repository at this point in the history
fix sin/cos azimuth
  • Loading branch information
Jay LaPorte committed Oct 8, 2019
2 parents e0e33fe + f80388b commit aaa5153
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/solar.js
Expand Up @@ -201,9 +201,7 @@ class Location {
}

get azimuth() {
// NOTE: This Math.PI and negative silliness is so we return 0..2π
// (instead of -π..π).
return Math.PI + Math.atan2(-this.sin_azimuth, -this.cos_azimuth);
return Math.atan2(this.cos_azimuth, this.sin_azimuth) + Math.PI;
}
}

Expand Down Expand Up @@ -248,8 +246,8 @@ class Time {
sin_hour_angle,
cos_hour_angle,
_sin_elevation(sin_lat, cos_lat, sin_dec, cos_dec, cos_hour_angle),
-sin_hour_angle,
-(cos_hour_angle * sin_lat - tan_dec * cos_lat)
cos_hour_angle * sin_lat - tan_dec * cos_lat,
sin_hour_angle
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "astro",
"version": "2.2.3",
"version": "2.2.4",
"description": "Solar and lunar position calculations",
"main": "index.js",
"devDependencies": {
Expand Down

0 comments on commit aaa5153

Please sign in to comment.