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

Commit

Permalink
fix sin/cos azimuth
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay LaPorte committed Oct 8, 2019
1 parent e0e33fe commit f80388b
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 f80388b

Please sign in to comment.