> And they are also… a math nightmare. Differential geometry. Integrals. Oh my… Which is probably why most games don’t even dare.

Wonder if cubic parabola (used by some railways, and visually near indistinguishable from clothoid) has easier maths.

Glad you mentioned it. Cubic parabolas were actually used by eraly railway engineers as good approximations of clothoids back when numerically solving a true euler spiral was a daunting task.

They are visually very close because their curvature increseases approximately linearly along the curve but not exactly. Mathematically speaking if you wirte the cubic parabola as something like y = kx^3, the second derivative (which give the curvature) grows linearly with x which makes it behave similary in gentle transitions.

The problem is that the second derivative is not enough alone for having a true smooth curvature. The real curvature formula has in the denominator the first derivative as well (slope) making it not increase perfectly linearly along the curve. (denominator becomes larger and larger as x incrases)

But yeah, cubic parabola is basaically a good enough approximation. Might be a good solution for a system like this.

[deleted]

I don't agree that the clothoid is a math nightmare. One of the central problems you have to solve for roads is the offset curve. And a clothoid is extremely unusual in that its offset curve has a clean analytic solution. This won't be the case for the cubic parabola (which is really just a special case of the cubic Bézier).

Sure, you have to have some facility with math to use clothoids, but I think the only other curve that will actually be simpler is circular arcs.

I mean they are not a math nightmare per se if you’re comfortable with the theory. What I meant is that they become comparatively complex to integrate into a system like this. Think about arc length, compute intersections, reparametrization, etc., and with clothoids that usually means some complex numerical algorithms.

Using circular arcs or even simple third-degree polynomials (like cubic parabolas) reduces many of those operations to trivial O(1) function calls, which makes them much cheaper to evaluate and manipulate procedurally, especially when you're computing it 60 times per frame

You might be familiar with these, but GP wrote a couple of excellent pieces on Euler spirals:

https://raphlinus.github.io/curves/2021/02/19/parallel-curve...

https://levien.com/phd/euler_hist.pdf