The simple geometry behind any road

April 18, 2026
Colorful geometric shapes including a red triangle and yellow square on a black background.
Photo by Magda Ehlers on Pexels

The idea

A recent Hacker News thread pointed readers to a sandboxspirit blog post that lays out a delightfully simple backbone for procedurally generated roads. It has been reported that the author frames roads as a series of abstract cross-sections — “profiles” — rather than a single centerline spline. Think Bezier control points: you store snapshots, not the whole curve, and reconstruct the rest by interpolation. The profiles act as control information; the visible road is just the interpolated result.

The geometric trick

The core problem is elegant and very old-school: given two corresponding points on adjacent profiles, each with a desired tangent direction, how do you draw a smooth, parallel path between them? A single circular arc won’t usually cut it — the points must lie on the same circle for that to happen. The trick, as laid out in the post, is to relax the constraint by allowing each arc to be preceded by a short line along the tangent. Extend continuation lines from the endpoints, find their intersection C, then pick a point M on the longer continuation so that CM equals the other continuation length. Draw perpendiculars through M and the original endpoint; their intersection O is the circle center. By the Tangent–Radius Theorem, radii OA and OM make the arc tangent where you need it. Repeat for every corresponding pair across the profile and the paths remain parallel.

Why it matters

So what’s the payoff? Cleaner primitives — just lines and circular arcs — instead of sprawling Beziers or heavy spline math. That simplicity yields robustness and predictable parallel offsets, which are gold in procedural tools and game engines. Who knew high school circle geometry could feel like an “aha” moment for modern game tech? It’s a reminder that sometimes the best engineering is about rediscovering the obvious and using it well.

Sources: sandboxspirit.com, Hacker News