Skip to content

Commit 09e91be

Browse files
author
rmyers
committed
Fixes mourner#6
1 parent 75d83f4 commit 09e91be

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

suncalc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var e = rad * 23.4397; // obliquity of the Earth
3838
function rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }
3939
function declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }
4040

41-
function azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }
41+
function azimuth(H, phi, dec) { return PI + atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }
4242
function altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }
4343

4444
function siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }

test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var testTimes = {
3030
t.test('getPosition returns azimuth and altitude for the given time and location', function (t) {
3131
var sunPos = SunCalc.getPosition(date, lat, lng);
3232

33-
t.ok(near(sunPos.azimuth, -2.5003175907168385), 'azimuth');
33+
t.ok(near(sunPos.azimuth, 0.6412750628729547), 'azimuth');
3434
t.ok(near(sunPos.altitude, -0.7000406838781611), 'altitude');
3535
t.end();
3636
});
@@ -47,7 +47,7 @@ t.test('getTimes returns sun phases for the given date and location', function (
4747
t.test('getMoonPosition returns moon position data given time and location', function (t) {
4848
var moonPos = SunCalc.getMoonPosition(date, lat, lng);
4949

50-
t.ok(near(moonPos.azimuth, -0.9783999522438226), 'azimuth');
50+
t.ok(near(moonPos.azimuth, 2.1631927013459706), 'azimuth');
5151
t.ok(near(moonPos.altitude, 0.006969727754891917), 'altitude');
5252
t.ok(near(moonPos.distance, 364121.37256256194), 'distance');
5353
t.end();

0 commit comments

Comments
 (0)