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

Add Euler spiral curve representation #169

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Add Euler spiral curve representation #169

wants to merge 12 commits into from

Conversation

raphlinus
Copy link
Contributor

@raphlinus raphlinus commented Feb 16, 2021

This commit adds support for piecewise Euler spirals, gated under the euler feature. A primary goal is to support parallel curves, as described in raphlinus/raphlinus.github.io#46.

There are some rough edges, and there's not an end-to-end parallel curve yet, but it's progress. Here's what's currently implemented:

  • The EulerSeg curve, along with some ParamCurve traits.
  • Geometric Hermite interpolation of an Euler spiral segment
  • Conversion of CubicBez to an iterator of Euler spiral segments
  • Conversion of an Euler spiral segment to an iterator of CubicBez

Here's what's missing:

  • The actual parallel curve algorithm at the heart of the blog post
  • An optimized version of Geometric Hermite interpolation (see blog post)
  • Error bounds on the above
  • ParamCurveNearest and ParamCurveExtrema on EulerSeg
  • Most of EulerPath including the Shape trait
  • And end-to-end driver

It's slightly unclear that we'll even develop EulerPath at this point. It's possible to exercise the main parallel curve flow by composing iterators, and ending up with a BezPath. Possibly that should be taken out of this PR and added later if/when needed.

Checkpoint of experiment work
Adds derivatives and curvature.
Generate Euler spirals from cubics.
Iterate from Euler spirals to cubics, with an error tolerance.
Provide accuracy (with verified error bounds).
Add benchmarks and refine error estimation (the powf was potentially
expensive).
Rename "FitEulerResult" to "EulerParams".
Also make them easier to find and improve docs a bit.
A pretty good implementation of parallel curves, including handling the
cusp, and applying the closed-form error metric for subdivision.
This commit captures the source code for the illustrations in the
parallel curve blog post.
@raphlinus raphlinus marked this pull request as ready for review February 19, 2021 17:51
@cmyr
Copy link
Member

cmyr commented Mar 26, 2021

@raphlinus is this ready? going to do a piet release soon, might as well get whatever outstanding kurbo work merged as makes sense.

@raphlinus
Copy link
Contributor Author

I don't think we should block a piet release on it. I want to make some tweaks to the API (take an accuracy parameter pretty much everywhere), put the euler stuff into an euler namespace instead of top level, and make sure things are labeled as experimental. I'm also increasingly unsure about the "euler" feature - it feels like there should be an "advanced" or "full" feature that would encompass this, #174, and other future stuff along similar lines.

I can get this ready but it would be tomorrow.

@cmyr
Copy link
Member

cmyr commented Mar 26, 2021

no stress, I'm not going to get the release done today, although we're not too far off.

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

Successfully merging this pull request may close these issues.

2 participants