For a project involving simulating traffic lights, I am currently looking for a formula to get a rounded 90-degree corner (to describe the path of a turning car) with certain properties:
- Defined in terms of elementary functions
- Cartesian, polar, parametric OK
- Implicit OK if solvable in terms of elementary functions
- Relevant portion fits exactly into square with unit side length (for simplicity, let's assume (0,0) to (1,1), with the endpoints of the relevant portion at (0,1) and (1,0))
- Symmetric about diagonal through "center" of turn (the line $y=x$ for the above simplifying assumptions)
- $\frac{dy}{dx}=0$ at one of the endpoints, and $\infty$ at the other (doesn't matter which one's which, as one can flip the result over the line $y=1-x$ to get the other case)
- Curvature increases until intersection with symmetry axis, and then decreases again
- Zero curvature at endpoints
- Curvature function of $x$, $\theta$, $t$, etc. is continuous (but it can have a cusp in the middle)
- Cusps of physical curve only at endpoints (if they exist)
- Constants should be expressible in terms of combinations of elementary functions of rational numbers and/or predefined values (so $2$, $\sqrt2$, and $\pi$, or even $\sqrt\pi$, are OK, but not something like $2.015287329...$, because I want this to be exact)
- Has arclength formula defined in terms of elementary functions
- Arclength formula is invertible (i.e. what value of $x$, $\theta$, $t$, etc. do I need in order to get an arc of length $\ell$?)
I've tried at least ten or twenty different curves from several different approaches (including polynomials, superellipses, a variant of Cassini ovals with four foci, fitting polar curves to $sec(x)$ and $csc(x)$, quartic Bézier curves, and finding other parametric equations that have zero second derivative at $t=0$, then flipping them across $t=\frac12$), and there's only one that I've tried ($x=\cos^5(t)$, $y=\sin^5(t)$) that has an actual arclength formula ($\frac5{8\sqrt3}(-\cos(2t)\sqrt3\sqrt{1+3\cos^2(2t)}+\ln(\sqrt{1+3\cos^2(2t)}-\cos(2t)\sqrt3))$), but it's not invertible, as there are $t$s both inside and outside of the $\ln$. (However, I may have missed a viable example.) I've tried searching online, without finding what I'm looking for (although it could be that I'm searching for the wrong thing).
The Euler spiral (also known as the Cornu spiral or clothoid) is the natural choice for a smooth transition curve, where by smooth we mean one that will not cause an abrupt change in acceleration (i.e., a jerk).
The Euler spiral is usually expressed in terms of the Fresnel integral, which can be expressed in closed form as follows,
$$z(s)=\int_0^s e^{i \pi s^2/2} ds=\frac{1+i}{2} erf\left(\frac{1-i}{2} \sqrt{\pi} \cdot s\right)$$
where $s$ is the arc length. Now it's also known that a spiral can be expressed in terms of it curvature, $\kappa$, namely,
$$z=\int e^{i\int \kappa(s)ds}ds$$
It follows that the natural equation of this spiral is $\kappa \propto s$, or in term of the radius of curvature, $\rho$
$$\rho s=\text{constant}$$
It is this property that we are interested in. When traversing a bend we seek to assure that the centrifugal force changes continuously in order to avoid a jerk. If this easement is not applied there would be an abrupt change in the acceleration at the point of transition from a straight path to a curved one.