-
Notifications
You must be signed in to change notification settings - Fork 12
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
Better shape reuse identification #103
Conversation
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 haven't finished reviewing this, but from a first glance it's looking promising 👍
"""Returns equivalent path with only absolute commands.""" | ||
return self._rewrite_path(_relative_to_absolute, inplace) | ||
|
||
def relative(self, inplace=False) -> "SVGPath": |
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.
nice, we could use this for #94
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.
what do you plan to do with the failing tests? Do we want to try re-exporting the SVGs from AI with greater float precision?
Upon further investigation some of them are more nefarious than expected: same shape, different drawing commands. I think we'll say Shape Reuse as a project is not done but this PR has moved as far as it intended so I would like to merge. Some examples of shapes that don't reuse are captured in #125. |
eaea959
to
5be6921
Compare
93fe078
to
819920f
Compare
… etc. Address some review comments.
Co-authored-by: Cosimo Lupo <clupo@google.com>
Improved implementation of shape reuse detection.
Annoyingly not working well for real sample data from Noto https://rsheeter.github.io/android_fonts/emoji.html?q=u:1f970 just yet; normalized shapes only match to 1 decimal place. Good chance I've done something silly and introduced enormous numeric instability.
EDIT: at least some of the paths are actually different despite the shapes being visually the same post-normalization. I think there may be ways to solve this but they are well beyond the intended scope of this PR.