Draw gray-line terminator as a smooth analytic band#136
Merged
Conversation
Old drawGrayLine() built the twilight zone by sweeping a 2-degree
lat/lon grid for points where |solar altitude| < 6 deg, then bucketing
them into 5-degree latitude bands and emitting one rectangle per
band+segment. The result rendered as a stack of 10-degree-tall
rectangles -- a visible staircase along the terminator on the map.
Replace with a closed-form solve. For each longitude, solve
sin(alpha) = sin(decl)*sin(lat) + cos(decl)*cos(HA)*cos(lat)
= R * sin(lat + phi)
for alpha = +/-6 deg, giving the day-edge and night-edge latitude
of the civil-twilight band. Walk longitude west-to-east to build the
day edge, east-to-west to close the night edge, and render the result
as a single L.polygon. No bucketing, no rectangles, no staircase.
Sweep at 1-degree longitude steps (361 vertices per edge) for a
smooth curve at the price of a single L.polygon instead of dozens of
small ones, so total draw cost is comparable.
served.html kept in sync with dashboard.html.
https://claude.ai/code/session_01BLfWHK9hf8k4aBBaQjfQa8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the staircase rendering of the gray-line terminator band with a smooth analytic curve.
The previous
drawGrayLine()swept a 2° lat/lon grid for points where|solar altitude| < 6°, then bucketed those points into 5°-wide latitude bands and emitted one rectangle per (band, longitude segment). Because each rectangle was 10° tall (lat ± 5), the resulting band rendered as a stack of vertically-aligned rectangles — visibly stairsteppy where the terminator runs diagonally, with extra blocky artifacts wherever a band's longitudes had a gap > 10°.This rewrites it in closed form. For each longitude, solve
where
R = √(sin²δ + cos²δ·cos²HA)andφ = atan2(cos(δ)·cos(HA), sin(δ)). Thenlat = asin(sin(α)/R) − φ, clamped to[−90°, 90°]. Compute this at α = +6° (day edge) and α = −6° (night edge) for every 1° of longitude, then build a single closed polygon by walking the day edge west→east and the night edge east→west. No grid sweep, no bucketing, no rectangles.served.htmlkept in sync withdashboard.html.Test plan
node --checkparses the inlined dashboard JS cleanlydiff src/dvoacap/dashboard/dashboard.html served.htmlis emptyhttps://claude.ai/code/session_01BLfWHK9hf8k4aBBaQjfQa8
Generated by Claude Code