SM'S DEX
Move 006 / Aviation Math

Flight Sun Tracker

An interactive TypeScript and Canvas visualization tool computing solar elevation relative to aircraft passenger seating, helping travelers choose direct sunlight or cool shade.

Executive Summary: Flight Sun Tracker is an open-source TypeScript and HTML5 Canvas application that calculates the sun's azimuth and altitude relative to an aircraft's heading along great-circle routes. It solves the traveler dilemma of window seat glare versus shade by delivering instant seat-specific solar exposure breakdowns.

LanguageTypeScript
RendererHTML5 Canvas
CalculationsSub-Solar Math
Dependencies0 External APIs

Problem: Window Seat Sun Glare vs Scenic Shade

Selecting a window seat on a long-haul commercial flight is typically guesswork. On morning eastbound flights, passengers on the right side face blinding solar glare and overheating cabins, while the left side stays comfortably shaded. On transatlantic or transpacific routes, seasonal variations in solar declination can flip sunlight exposure mid-flight.

Flight Sun Tracker eliminates guesswork by modeling solar positions deterministically across the entire route duration, calculating exact sun angles relative to the airplane's longitudinal axis.

Technical Architecture & Solar Calculations

The core engine computes astronomical and geodesic coordinates entirely client-side without relying on rate-limited third-party solar APIs:

  1. Great-Circle Route Interpolation: Computes waypoints between origin and destination airport pairs using spherical trigonometry (Haversine and spherical law of cosines) to calculate the aircraft's instantaneous true heading.
  2. Sub-Solar Point Modeling: Calculates solar declination and the Greenwich Hour Angle (GHA) for each flight segment timestamp using Jean Meeus astronomical algorithms.
  3. Relative Azimuth Transformation: Projects the sun's coordinates into the aircraft's local coordinate frame, determining whether sunlight strikes port (left / A-seats) or starboard (right / F-K seats).

Key Architectural Decisions

Design VectorFlight Sun Tracker ChoiceAlternative ConsideredTechnical Rationale
VisualizationHTML5 Canvas 2DHeavy 3D WebGL (Three.js)Zero bundle bloat, instant rendering on mobile browsers, 60 FPS animation.
Calculation EngineLocal TypeScript MathExternal REST Ephemeris APIsZero network latency, offline capability, 100% deterministic results.
Seat MappingRelative Angle VectorsBinary Left/Right ClassificationAllows calculating exact cabin glare duration, sunrise/sunset golden hours, and twilight.

Source Code & Verification

The code is fully open-source and maintained on GitHub. Explore the repository and implementation details: