Skip to content

Draw gray-line terminator as a smooth analytic band#136

Merged
skyelaird merged 1 commit into
mainfrom
claude/fix-dashboard-responsive-J7fJp
May 1, 2026
Merged

Draw gray-line terminator as a smooth analytic band#136
skyelaird merged 1 commit into
mainfrom
claude/fix-dashboard-responsive-J7fJp

Conversation

@skyelaird

Copy link
Copy Markdown
Owner

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

sin(α) = sin(δ)·sin(lat) + cos(δ)·cos(HA)·cos(lat)
       = R·sin(lat + φ)

where R = √(sin²δ + cos²δ·cos²HA) and φ = atan2(cos(δ)·cos(HA), sin(δ)). Then lat = 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.html kept in sync with dashboard.html.

Test plan

  • node --check parses the inlined dashboard JS cleanly
  • diff src/dvoacap/dashboard/dashboard.html served.html is empty
  • Open dashboard in browser; confirm the yellow twilight band is a smooth diagonal sinusoid instead of a staircase
  • Drag the gray-line time slider; confirm the band shifts smoothly with no flicker
  • Sanity-check the band straddles the day/night transition for the current UTC hour

https://claude.ai/code/session_01BLfWHK9hf8k4aBBaQjfQa8


Generated by Claude Code

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
@skyelaird skyelaird marked this pull request as ready for review May 1, 2026 18:59
@skyelaird skyelaird merged commit e5aaadc into main May 1, 2026
14 checks passed
@skyelaird skyelaird deleted the claude/fix-dashboard-responsive-J7fJp branch May 1, 2026 18:59
@skyelaird skyelaird mentioned this pull request May 1, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants