Correct east-west distances for latitude (cos(lat) scaling) - #50
Open
selmapi wants to merge 1 commit into
Open
Conversation
selmapi
force-pushed
the
fix/cos-lat-longitude-scaling
branch
from
July 5, 2026 14:08
217d221 to
beac8d6
Compare
Longitude degrees shrink by cos(latitude); the flat 111 km/deg model overstates E-W positions ~38% at the default Amsterdam center. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
selmapi
force-pushed
the
fix/cos-lat-longitude-scaling
branch
from
July 5, 2026 14:10
beac8d6 to
5f399e2
Compare
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.
offsetKmFromCenter()in bothradar_display.cppandrunway_overlay.cppconverts the longitude delta to kilometers with the same flat111 km/degfactor as latitude, which is only accurate at the equator — a degree of longitude shrinks bycos(latitude)toward the poles. This overstates all east-west screen positions and distances (aircraft and runways): ~19% at 36°N, and ~38% at this project's own default center (Amsterdam, ~52.37°N).The fix scales the longitude term by
cosf(center latitude)in both files'offsetKmFromCenter; no shared header is introduced, keeping the diff trivially reviewable. Sanity check: 1° of longitude at 52.37°N should be ~67.8 km (111 × cos 52.37°), which the corrected formula reproduces.Heads-up: aircraft will render slightly closer east-west after this change — that's the correction, not a regression. This fix has been running in a fork of this project in daily use with no issues.
(Builds against LovyanGFX 1.2.21; see #49 for why fresh installs currently need that pin.)
🤖 Generated with Claude Code