frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

I built a real-time AR plane spotter, here's the math that makes it work

3•ananddhruv29•1h ago
I've been building an Android app that identifies aircraft overhead when you point your phone at the sky. The app fetches live ADS-B data and overlays aircraft labels on the camera feed, but getting the math right took much longer than I expected, so I wrote it all up.

The problem sounds simple, you have a GPS coordinate in the sky and a GPS coordinate in your hand. You want a pixel. But there are four distinct coordinate spaces between those two things, and the transitions between them have sign conventions that fail silently, wrong output with no error.

The pipeline:

  Geodetic (lat, lon, alt)
    ↓  flat-earth approx — valid <100 km, error <2 px at 50 nm range
  ENU — East, North, Up (metres)
    ↓  R⊤ from Android TYPE_ROTATION_VECTOR sensor
  Device frame (dX, dY, dZ)
    ↓  one sign flip: Cz = −dZ
  Camera frame (Cx, Cy, Cz)
    ↓  perspective divide + FOV normalisation
  Screen pixels (Xpx, Ypx)
Why each transition is non-obvious:

Geodetic → ENU. The East component has a cosine factor that most implementations miss: E = Δλ × (π·RE/180) × cos(φ_user). Meridians converge toward the poles, one degree of longitude is fewer metres at latitude 25° than at the equator. Without it, East-West positions look correct near the equator and quietly diverge as latitude increases.

ENU → Device frame. Android's rotation matrix R maps device axes to ENU world axes. To go the other direction you use R⊤. In Android's row-major FloatArray(9), this means column indices, not row indices:

  R  (forward): dX = R[0]·E + R[1]·N + R[2]·U
  R⊤ (inverse): dX = R[0]·E + R[3]·N + R[6]·U
These produce completely different results. Both compile without complaint.

Device → Camera frame. Android's sensor defines +Zd as pointing out of the screen toward your face. The camera convention requires +Cz to point into the scene. So Cz = −dZ, always. This is the only correction needed for portrait mode.

Camera → Screen. After the perspective divide and FOV normalisation, the Y axis flips: Ypx = (1 − NDCy) × H/2. Camera +Cy is up; screen y=0 is at the top. If we miss this, the aircraft above the horizon appears below screen centre.

Real captured values (ATR72, 18,000 ft):

  User:     24.8600°N, 80.9813°E
  Aircraft: 24.9321°N, 81.0353°E

  ENU:  E=6,010 m  N=8,014 m  U=5,486 m
  Bearing 34.2° (NNE),  Elevation 29.5°,  Range 11.1 km

  Camera frame (after R⊤ + sign fix): (729, 4692, 10077)
  Magnitude: 11,140 m ≈ 11,138 m (ENU range) 

  Screen (1080×1997, θH=66°, θV=50°): (600 px, 1 px)
Phone azimuth 33.0°, aircraft bearing 34.2° → 1.2° right of centre. Phone pitched −4.3°, elevation 29.5° → net 33.8° up, just inside the top edge of the frustum. Physically consistent throughout.

Happy to answer questions about any stage of the pipeline or about anything else, whatever is interesting to anyone.

Show HN: Claude Code Rust – a native Rust TUI that avoids the V8 heap OOM

https://github.com/srothgan/claude-code-rust
1•char8•2m ago•0 comments

Reconstructing a Dead USB Protocol: From Unknown Chip to Working Implementation

https://github.com/coremaze/ME2-Writeup/blob/master/README.md
1•birdculture•4m ago•0 comments

In the UK, EVs are cheaper than petrol cars, thanks to Chinese competition

https://electrek.co/2026/04/18/in-the-uk-evs-are-cheaper-than-petrol-cars-thanks-to-chinese-compe...
1•breve•8m ago•0 comments

Crypto Hack Worth $290M Triggers DeFi Contagion Shock

https://www.bloomberg.com/news/articles/2026-04-19/crypto-hack-worth-290-million-triggers-defi-co...
1•helsinkiandrew•11m ago•0 comments

The Work Runs on Different Maps

https://yusufaytas.com/the-work-runs-on-different-maps
8•yusufaytas•13m ago•0 comments

Memjar: Uncompromising, local-first second brain

https://github.com/m00dy/memjar
1•m00dy•17m ago•0 comments

Tim Davis – Probabilistic engineering and the 24-7 employee

https://www.timdavis.com/blog/probabilistic-engineering-and-the-24-7-employee
1•kiyanwang•20m ago•0 comments

2005 PS2 Game Returning with New Release on PS5, PS4

https://comicbook.com/gaming/news/ps2-playstation-2-games-ps5-ps4-release-2005/
1•01-_-•25m ago•0 comments

The framework built by a father in 2006 dominated the internet

https://comuniq.xyz/post?t=966
2•01-_-•27m ago•1 comments

An Amish Paradox: Diversity and Change in the Largest Amish Community

https://www.thepsmiths.com/p/review-an-amish-paradox-by-charles
1•barry-cotter•28m ago•0 comments

LlaMa.cpp Robot Wars

https://www.youtube.com/watch?v=bgZ3pmr0DIs
3•Pasyd•28m ago•1 comments

Performance • tldraw Docs

https://tldraw.dev/sdk-features/performance
2•aragonite•28m ago•0 comments

Ask HN: Is your Mac's menu bar throwing errors?

1•vsgherzi•28m ago•0 comments

SitTall – a macOS app that uses AirPods sensors to detect slouching

https://sittall.app/
1•anilatici•31m ago•1 comments

Anatomy of High-Performance Matrix Multiplication (2008) [pdf]

https://www.cs.utexas.edu/~flame/pubs/GotoTOMS_revision.pdf
2•tosh•33m ago•0 comments

Visual Studio Code Agents App (Preview)

https://code.visualstudio.com/updates/v1_115#_visual-studio-code-agents-preview
2•maxloh•43m ago•0 comments

Hero Engineering: In Defense of Unreasonable Optimizations

https://deancalver.substack.com/p/hero-engineering-in-defense-of-unreasonable
2•DeanoC•47m ago•0 comments

Edit store price tags using Flipper Zero

https://github.com/i12bp8/TagTinker
2•trueduke•57m ago•0 comments

Why Musicians Are Manufacturing Sold-Out Shows

https://www.bloomberg.com/news/articles/2026-04-17/how-bands-like-cameron-winter-s-geese-are-manu...
2•helsinkiandrew•1h ago•0 comments

A Private Recommendation System I Can Control

https://frankk.site/en/blog/controllable-recommendation-system/
1•langtang1996•1h ago•0 comments

Ask HN: How did you land your first projects as a solo engineer/consultant?

5•modelcroissant•1h ago•0 comments

Waterloo’s live AI-goose tracker. Never get ambushed by a cobra chicken again.

https://www.waddleloo.com/
1•consumer451•1h ago•0 comments

Public grocery stores are having a moment. Can they make food more affordable?

https://www.cbc.ca/radio/thecurrent/public-grocery-stores-9.7168321
3•Teever•1h ago•0 comments

Ask HN: Should I build *another* Markdown task manager?

1•simchri•1h ago•1 comments

Show HN: AI Primer – A Searchable AI Changelog for AI Engineers and Creatives

https://www.ai-primer.com
1•andyasprou•1h ago•0 comments

Deleteduser.com –A $15 PII Magnet

https://mike-sheward.medium.com/deleteduser-com-a-15-pii-magnet-c4396eb21061
3•birdculture•1h ago•0 comments

Shyell – a Rust shell with built-in benchmarking and project-aware prompts

https://github.com/sumant1122/shyell
2•paperplaneflyr•1h ago•0 comments

Resources for starting and growing an AI safety org

https://www.lesswrong.com/posts/fBDMCLTv8Cx28cJeJ/resources-for-starting-and-growing-an-ai-safety...
1•omer_k•1h ago•0 comments

Splitt – A gym set tracker that does nothing else

https://trysplitt.com/
4•zack-p•1h ago•2 comments

How to raise fund from investor for my startup?

1•SRMohitkr•1h ago•3 comments