Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaner parallel curves with Euler spirals #46

Closed
raphlinus opened this issue Feb 12, 2021 · 1 comment
Closed

Cleaner parallel curves with Euler spirals #46

raphlinus opened this issue Feb 12, 2021 · 1 comment

Comments

@raphlinus
Copy link
Owner

raphlinus commented Feb 12, 2021

I'm in the middle of writing, and won't go over the full outline here, but an issue is helpful in part to track some of the assets.

The core argument is that a piecewise Euler spiral representation is well suited to computing approximate parallel curves. The parallel curve of an Euler spiral has a particularly nice analytical representation (as a Cesàro equation).

There's an paper (in German, from 1906) with that result: Die Parallelkurve der Klothoide. I have a translation from @Rahix, and I think I'll just put the PDF of that in the assets folder. I think I have a simplification, namely $\kappa(s) = c/\sqrt{s - s_0} + 1/l$, but need to validate that.

The parallel curve is itself not an Euler spiral, but the error of G1 geometric Hermite interpolation by an Euler spiral segment has an especially simple formula, and shows that the error scales as $n^4$ in the number of segments. Further, it's possible to use a simple scaling formula to determine the subdivision points, $s_i = s_0 + (i \Delta s)^(4/3)$, so that the error is evenly distributed (note that this subdivides more finely near the cusp, which is intuitive).

I'm also preparing a PR against kurbo with code to compute these - it's likely the blog and PR will be in flight at the same time, as there are rough edges in the code that are fine for exploration (and producing images) but overall I have high standards for kurbo, so the algorithms should have rigorous error bounds and handle edge cases well.

The content of the blog post is intensely visual, and to make it work I need to produce quite a number of visuals (parallel curves, other examples of cusps such as circle involute, curvature plots, etc). I could take bitmap screenshots using tools at my disposal (or even "borrow" images from, say, Wikipedia), but that feels against the grain of the work. A more refined approach is to produce SVG's with a high degree of numerical accuracy, and inline them into the blog post. That will take more time, but I think it's worth it.

@raphlinus
Copy link
Owner Author

raphlinus commented Feb 12, 2021

The simplification I proposed checks out! See this Desmos graph for a demonstration. Connecting the simplified formula in the above comment with the notation in the Weileitner paper (in which $\kappa(s) = s / a^2$ for the source curve), $c = a / \sqrt{2 l^3}$, and $s_0$ = $-a^2/{2l}$. That, to me, is appealingly simple.

This simplification strongly connects the resulting curve to the circle involute, which has a Cesàro equation of $\kappa(s) = 1/\sqrt{2as}$. In other words, you can get the curvature of an Euler spiral parallel curve by just taking the curvature of a circle involute and adding $1/l$. As the offset (l) approaches infinity, the curve approaches the circle involute. I don't know about anyone else, but I find this a beautiful insight and I am more than a bit surprised I can't find it in the literature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant