RC RANDOM CHAOS

Hengefinder: The Spherical Geometry Behind Predicting Manhattanhenge Anywhere

· via Hacker News

Original source

Hengefinder: Finding when the sun aligns with your street

Hacker News →

A Recurse Center project called Hengefinder calculates when the sun will align with any street on Earth, generalizing the twice-yearly Manhattanhenge phenomenon. The tool works by computing a road’s bearing relative to true north, determining the sun’s azimuth at sunset for a given location, and finding dates where the two angles match. The author treats the project as a series of nested sub-problems, opening some boxes for deeper investigation while leaning on libraries like Astral for the underlying astronomical math.

Two solved problems get detailed walkthroughs. Computing street bearings from lat/lon pairs naively breaks because longitude degrees shrink toward the poles while latitude stays constant, so the fix is to scale longitude by cos(latitude) before applying atan2, putting both axes in comparable units. Finding the precise henge moment requires a different definition of sunset than the standard astronomical one, since the sun’s disk must sit fully visible on the horizon. Rather than linearly polling Astral minute-by-minute, the author implements an upper-biased binary search to locate the last minute where the sun remains above a target altitude threshold.

The writeup is less about the finished tool and more about the gap between assumptions and physical reality: roads aren’t flat lines, coordinate grids aren’t Cartesian, and ‘sunset’ is ambiguous. A companion mobile app was built by another Recurser, and the source is publicly available.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.