webdial

Incomplete JS port of moondial.
git clone https://code.literati.org/webdial.git
Log | Files | Refs

commit fb45ae8cdca388f9e4bd21575499fb4957e81d0a
parent f929fd532cb7b92043aa1ca618d704e5b1fac3b5
Author: Sean Lynch <seanl@literati.org>
Date:   Thu,  8 Sep 2011 00:12:21 -0700

More debugging

Diffstat:
Msun.js | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sun.js b/sun.js @@ -66,21 +66,20 @@ function Sun() { }; this.equ_to_geo = function(ra, dec, st) { - console.debug(ra, dec, st); var lon = r_to_d(ra - st); - console.debug("lon", lon); if (lon > 180.0) { lon -= 360.0; } - console.debug("lon", lon, "dec", dec); return {longitude: lon, latitude: r_to_d(dec)}; }; this.sun_rst_altitude = -0.0145438286569; this.terminator = function(lat, lon, alt, w, h) { + console.debug(lat, lon, alt, w, h); lat = lat / 180.0 * Math.PI; var x_offset = (lon + 180.0) * w / 360.0; + console.debug("x_offset", x_offset); var obl = lat - Math.PI / 2; var points = []; var prev_x; @@ -93,7 +92,7 @@ function Sun() { var deg, H, equ, x, y; for (deg = 0; deg < 360; deg++) { H = deg * Math.PI / 180.0; - equ = ecl_to_equ(H, alt, obj); + equ = this.ecl_to_equ(H, alt, obj); x = Math.round(equ.ra * w / PI2 + x_offset) % w; y = Math.round((0.5 - equ.dec / Math.PI) * h); if (lat < alt) {