# bending an arc to accommodate a constraint

I'm working with piecewise polynomial spirals: curves of the form $z(t) = z_0 + \int_0^t e^{i f(s)} ds$ where $f$ is a quartic polynomial determined by the tangent angles and curvatures at given endpoints.

When an arc violates a constraint – goes too near to or too far from a point $C$ – I want to bend it so that it barely meets the constraint: that is, so that it passes through a point $B$, at distance $h$ from $C$, on the line that contains $C$ and crosses the original arc at a right angle. (Below, I'll use $z_a$ and $t_a$ for that crossing.) I can then either break the arc in two, joined at the new point, or raise the degree of $f$ by one to fit a new curvature where it passes the constraint point.

Obviously the new point should have the same tangent angle $f(t_a)$ as the old, but how do I estimate the new curvature?

My least-ugly idea so far is: find the polynomial spline of degree 6 5 that matches the original arc and its first two derivatives at the endpoints, and with $z(t_a \pm ih) = C$; take the new tangent angle and curvature from the first two derivatives at $t_a$. I'm hoping you can do better.

Context, if you're interested: my project is to create pretty outline fonts that, at appropriate low resolution, will match certain old favorite bitmap fonts dot-for-dot. Not trusting my own ability to draw graceful curves, I'm working on an algorithm to minimize the integral over path length of the square of the first derivative of curvature, while passing within half a grid-unit of each original black dot and missing each original white dot by the same amount.

(My first question; please suggest better tags)

LATER: Here's an estimate that at least has intuitive plausibility and lends itself to iterative improvement: $$f'(t_a) \pm \frac{(h-g)}{h} \frac{2h}{L} \frac{1}{h}$$ where $h$ is the desired separation, $g$ is the actual separation, and $L$ is the length of the original arc.

LATER STILL (Aug 30): Another idea that should be easier to implement. Call the original arc's endpoints A,B. Make an arc such that $$z(-L) = A \\ f(-L) = \theta_A \\ f'(-L) = \kappa_A \\ f(+L) = \theta_C \\$$ as you might expect, but $$z(+L+ih) = C$$ and similarly from B on the right. Adopt a compromise between the two resulting curvatures at the middle, weighted in favor of the shorter of these two arcs.

• If you're creating fonts, then your final output will presumably be either quadratic or cubic splines. So, I'd recommend working with these directly from the outset. Also, read Raph Levien's papers on font design and elastica, if you haven't already. en.wikipedia.org/wiki/Raph_Levien – bubba Jul 29 '15 at 5:44
• With polynomial splines, computing the penalty function is not nearly so convenient. – Anton Sherwood Jul 29 '15 at 23:42
• (Dammit, why can't I have a CR within a comment?) — What I've read, including Levien's doctoral thesis, is mostly about fitting given points exactly, whereas I don't care if my output exactly matches any of the input points. – Anton Sherwood Jul 29 '15 at 23:46
• Also, it's less easy to maintain continuity of curvature with cubic splines. – Anton Sherwood Jul 29 '15 at 23:49
• I've since decided that I like “my least-ugly idea so far” better than the others. – Anton Sherwood Sep 2 '16 at 19:27

A catalog of curves ( Lockwood, Mathworld, http://www-history.mcs.st-and.ac.uk/Curves/Curves.html, http://paulbourke.net/geometry, the French site, Zeeman & Rene Thom Cusp catastrophe ) etc. among others would all be helpful. A single case for Elastica $(a^2\cdot \kappa = y )$ might perhaps not alone suffice as curvature variation situation.
Some Eastern scripts have cusps ( curvatures tending to $\infty$ ), their font development may involve noticing quite fast changing curvature relations.
• Yes at that arc length of cusp $s= s_1$ curvature should preferably have a form like $1/ (s-s_1)$ – Narasimham Jul 30 '15 at 8:35
• They may coil between the cusps.Please examine a cycloid when the tracing point touches x-axis. It has the differential equation $k_2/ k_1 = 2$ where I have written $k_2 = \cos \phi /r ,\phi$ is slope. – Narasimham Jul 31 '15 at 12:36