The Hyperbezier Pen Tool
I read this but didn’t find what I was looking for: a construction of the curve.<p>Firstly, the article talks about G2 continuity. I didn’t find a definition but I didn’t try very hard. I think it is: A curve g : [a,b] -&gt; R^n, parameterised by arclength is G_k-continuous if the kth derivative of g is continuous. So G2 continuity means that 0. The curve is connected; 1. There are no cusps—abrupt changes of angle; and 2. The rate of change of curvature is continuous—if you drove along the curve at constant speed, you could turn the steering wheel smoothly without jerking it.<p>For a bézier spline I don’t think there’s a good way to get G2 continuity. G1 continuity comes from the editor forcing the control points on either side of curve points to be colinear with the curve point.<p>I think the best place for the definition of these splines is [1], in particular [2]. It gives the following expression for the curve between two on-curve points:<p><pre><code>  k(s) = k0 * f(bias0, 1 - s) + k1 * f(bias1, s)
</code></pre>
I think s, is a normalised arclength which ranges over the unit interval, k0 and k1 are the (also normalised) curvatures at the endpoints, and f is a seemingly bizarre function defined in [2]. k(s) is an expression for the curvature a distance s along the curve. So to find the points on the curve, one must solve a system of differential equations,<p><pre><code>  x’^2 + y’^2 = 1
  x’’^2 + y’’^2 = k(s)^2,
</code></pre>
subject to some suitable initial conditions. The above equation is slightly wrong as it should be using signed curvature, but these are simpler to write down. I think the initial conditions would be initial x and y values and an initial tangent, which doesn’t feel like sufficiently many degrees of freedom to me (you could presumably come up with some initial conditions for the first curve point and control point but I don’t understand how to go from the solution to the equation to the final curve: you can’t seem to move the point at s=1 into the right place as scaling changes the curvature and rotating or skewing changes the initial tangent). Looking more at the code, it seems that the relative angles come from solving the equation and then parameters are chosen such that the solution to the equation gives the desired angles.<p>I’ll have to look more and try to understand it later but if there’s a better reference I’d be interested to know.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;linebender&#x2F;spline" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;linebender&#x2F;spline</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;linebender&#x2F;spline&#x2F;blob&#x2F;main&#x2F;src&#x2F;hyperbezier.rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;linebender&#x2F;spline&#x2F;blob&#x2F;main&#x2F;src&#x2F;hyperbezi...</a>