-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(convertPathData): convert c to q #1892
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
dont worry that it now looks different, it's still under the error so its really just doing what svgo is supposed to do
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the math can be simplified, which is mentioned in the Stack Overflow post as well, but otherwise this looks great. Nice idea!
See any issues with the suggestion?
Co-authored-by: Seth Falco <seth@falco.fun>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can ignore the failing tests, you probably noticed, but we have an intermittent issue atm. Will look into that later, nothing to do with this PR.
Thanks for the contribution!
Some cubic beziers are quadratic beziers in disguise! They may have been degree elevated or just happen to be approximatable. Whatever the case is, we can find a smaller, faster representation as a quadratic bezier.
See https://stackoverflow.com/questions/2009160/how-do-i-convert-the-2-control-points-of-a-cubic-curve-to-the-single-control-poi for a better explanation.
Results
Closes #1891
Compared to current SVGO, removes 6452 bytes on Isometric Madness w/o multipass and 6500 with.
This would probably help some icon sets a lot, haven't tested the effects yet though.