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

Merge @raphlinus's upstream offset experiment for MFEK project testing/early alpha/beta use #1

Merged
merged 18 commits into from
Dec 30, 2022

Conversation

ctrlcctrlv
Copy link

@ctrlcctrlv ctrlcctrlv commented Dec 30, 2022

Note: This is one for one with linebender#230 as of 2022-12-30.

Following Orellana and de Michele 2020.

WIP
Add a suite of tests from the paper. Also some cleanup (getting rid of println).
Use abs and copysign rather than an abs to make the trig case give the highest-value root. This is probably a minor improvement, and makes the code slightly less true to the paper.
Strengthen the cubic fit logic, including better error measuring, and start cusp finding. However, it doesn't fully solve the parallel curve problem yet, and I have some refactoring in mind.
This commit gets a new `ParamCurveFit` trait in place, and uses it to compute offsets, but it is not breaking at cusps (which seems to be necessary, fitting through a cusp produces artifacts). Also needs some cleanup.
Use ITP method to find cusps. The logic probably doesn't handle double and higher multiplicity cusps.

Also arguably we should search for double cusps, but this is likely a fairly subtle improvement.
Also significant cleanup of `CurveOffset`, as a lot of that has moved into the fit module.
Mostly small changes to CubicOffset.
This computes an optimized fit (minimum number of segments, minimum error given that number), but without handling cusps.

Also includes an example that plots a quartic polynomial.
Make the ParamCurveFit trait return the raw integrals, for refinement into moments in the curve fitting logic. This is easier and more efficient for new curves, and also facilitates more efficient and robust downstream processing.
The moment_integrals function is probably correct but likely can be optimized.
Implementation of SimplifyBezPath including ParamCurveFit.

This also fixes some issues with the trait and fit implementation.

Also a bit of cleanup, comment fixes, and micro-optimization.
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