Skip to content

refactor: share lat/lon projection between radar and runway overlay - #93

Open
dreamiurg wants to merge 1 commit into
MatixYo:mainfrom
dreamiurg:refactor/shared-projection
Open

dreamiurg wants to merge 1 commit into
MatixYo:mainfrom
dreamiurg:refactor/shared-projection

Conversation

@dreamiurg

Copy link
Copy Markdown
Contributor

radar_display.cpp and runway_overlay.cpp each carried their own private copy of the same four functions — offsetKmFromCenter, latLonToScreen, distSqFromCenter, clipPointToOuterRing — plus their own kKmPerDeg and kDegToRad. Identical code, two places to keep in sync: the cos(latitude) longitude-scaling fix had to be applied twice, and the next projection change would too.

Moved them into a new ui::radar translation unit (include/ui/radar_projection.h + src/ui/radar_projection.cpp) and removed both copies. The constants now exist once.

Pure refactor: same math, same call sites, no behavior change. User impact: none visible; the point is that aircraft and runway overlays can no longer drift apart in how they map lat/lon to the screen.

Tested: builds for env:supermini; ran on an ESP32-C3 Super Mini + GC9A01 (combined with other local changes).

🤖 Generated with Claude Code

https://claude.ai/code/session_017qjXYQiTkbgyVV7ZzvKzA3

radar_display.cpp and runway_overlay.cpp each held a private copy of
offsetKmFromCenter, latLonToScreen, distSqFromCenter and
clipPointToOuterRing, plus their own kKmPerDeg/kDegToRad. Move them into
ui/radar_projection.{h,cpp} and drop the duplicates. No behavior change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qjXYQiTkbgyVV7ZzvKzA3
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