webdial

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

commit a5e53965e61fdf2ccff6fa1155cabc23e94aa538
parent aee45f80d168eaca53203d7f38e7d79812ce9cd4
Author: Sean Lynch <seanl@literati.org>
Date:   Thu,  8 Sep 2011 00:15:43 -0700

Fix stuff

Diffstat:
Msun.js | 5+----
Mwebdial.js | 11-----------
2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/sun.js b/sun.js @@ -76,10 +76,8 @@ function Sun() { 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; @@ -91,8 +89,7 @@ function Sun() { var deg, H, equ, x, y; for (deg = 0; deg < 360; deg++) { - console.debug(deg); - H = deg * Math.PI / 180.0; + H = deg * Math.PI / 180.0; equ = this.ecl_to_equ(H, alt, obl); x = Math.round(equ.ra * w / PI2 + x_offset) % w; y = Math.round((0.5 - equ.dec / Math.PI) * h); diff --git a/webdial.js b/webdial.js @@ -31,27 +31,16 @@ function WebDial(canvas) { } function drawNight(ctx, w, h) { - console.debug(1); ctx.fillStyle = "rgba(0, 0, 0, 128)"; - console.debug(sun); var jd = sun.cal_to_jd(new Date()); - console.debug(3); var epsilon = sun.obliquity(jd); - console.debug(4); var geometric_lon = sun.longitude_radius_low(jd).longitude; - console.debug(5); var lon = sun.apparent_longitude_low(jd, geometric_lon); - console.debug(6); var equ = sun.ecl_to_equ(lon, 0.0, epsilon); - console.debug(7); var st = sun.sidereal_time_greenwich(jd); - console.debug(8); var geo = sun.equ_to_geo(equ.ra, equ.dec, st); - console.debug(9); var points = sun.terminator(geo.latitude, geo.longitude, sun.sun_rst_altitude, w, h); - console.debug(points); - ctx.beginPath(); drawPoly(ctx, w, h, points); }