I want to create a smooth curve that starts at point $P_0 = (Px_0, Py_0)$ with normalized tangent $T_0 = (Tx_0, Ty_0)$ (where $\sqrt{Tx_0^2 + Ty_0^2} = 1$) and with curvature $κ_0$ (where positive values are in the opposite direction relative to the normal and negative values are in the same direction as the normal), and which ends at point $P_1 = (Px_1, Py_1)$ with normalized tangent $T_1 = (Tx_1, Ty_1)$ and with curvature $κ_1$. That is, a parametric curve $P(t)$ where
- $P(0) = P_0 = (Px_0, Py_0)$
- $P(1) = P_1 = (Px_1, Py_1)$
- $κ(0) = κ_0$
- $κ(1) = κ_1$
- $T(0) = T_0 = (Tx_0, Ty_0)$ where $\sqrt{Tx_0^2 + Ty_0^2} = 1$
- $T(1) = T_1 = (Tx_1, Ty_1)$ where $\sqrt{Tx_1^2 + Ty_1^2} = 1$
Note that curvature is calculated as $κ(t) = \frac{Px'(t) Py''(t) - Px''(t) Py'(t)}{\left(\sqrt{Px'(t)^2 + Py'(t)^2}\right)^3}$, while the normalized tangent vector is calculated as $T(t) = \frac{P'(t)}{\sqrt{Px'(t)^2 + Py'(t)^2}}$.
The video "The Continuity of Splines" by Freya Holmér implies that one approach to creating my desired curve is to put together a polynomial equation of degree five, with six unknown variables to go with the six constraints, giving $P(t) = a × t^5 + b × t^4 + c × t^3 + d × t^2 + e × t + f$. To have $P(0) = P_0$, it is easy to see that the variable $f$ must be $P_0$, giving $P(t) = a × t^5 + b × t^4 + c × t^3 + d × t^2 + e × t + P_0$.
However, I can't figure out how to find the values of the other five variables given the constraints I have. The definitions for the curvature and tangent seem to be too complicated to plug in nicely. Can this be done? Is there an easy way that I'm missing, is it tricky but doable, or is it actually impossible?
This problem was addressed in
High accuracy geometric Hermite interpolation
Carl de Boor, Klaus Höllig, Malcolm Sabin
Computer Aided Geometric Design
Volume 4, Issue 4, December 1987, Pages 269-278
There is an open-access version of the paper here.
Their technique produces a cubic curve, not the quintic suggested by Freda Holmér. There is not always a cubic solution, but usually there is.
Let’s use $p_0$, $p_1$, $p_2$ and $p_3$ to denote the control points of the cubic. We already know $p_0$ and $p_3$, so we just need to find $p_1$ and $p_2$. We are given the initial tangent direction, $d_0$, so we know that $p_1$ must be $p_0 + \delta_0*d_0$, for some (unknown) value of $\delta_0$. Similarly, we have $p_2 = p_3 - \delta_1*d_1$, for some (unknown) value of $\delta_1$. We just have to calculate $\delta_0$ and $\delta_1$. We do that by solving the equations (Q) given on page 2 of the paper. The equations reduce to a single quartic, which can be solved numerically or by the usual formulas. See here.
Once we have $p_0$, $p_1$, $p_2$ and $p_3$, the equation of the curve is given by the standard Bézier curve formula, which is given in the paper at the bottom of the first page.
Unit tangents and curvatures don’t give you enough info to uniquely define a quintic.