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

Better shape reuse identification #103

Merged
merged 15 commits into from
Nov 11, 2020
Merged

Better shape reuse identification #103

merged 15 commits into from
Nov 11, 2020

Conversation

rsheeter
Copy link
Collaborator

@rsheeter rsheeter commented Sep 30, 2020

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.

Copy link
Member

@anthrotype anthrotype left a 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 👍

src/picosvg/svg_types.py Outdated Show resolved Hide resolved
"""Returns equivalent path with only absolute commands."""
return self._rewrite_path(_relative_to_absolute, inplace)

def relative(self, inplace=False) -> "SVGPath":
Copy link
Member

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

Copy link
Member

@anthrotype anthrotype left a 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?

src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
@rsheeter rsheeter changed the title DRAFT: Better shape reuse identification Better shape reuse identification Nov 6, 2020
@rsheeter
Copy link
Collaborator Author

rsheeter commented Nov 6, 2020

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.

@rsheeter rsheeter force-pushed the normalize2 branch 3 times, most recently from eaea959 to 5be6921 Compare November 6, 2020 05:07
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_types.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
@rsheeter rsheeter force-pushed the normalize2 branch 2 times, most recently from 93fe078 to 819920f Compare November 9, 2020 07:18
src/picosvg/svg_reuse.py Outdated Show resolved Hide resolved
src/picosvg/svg.py Outdated Show resolved Hide resolved
@rsheeter rsheeter merged commit 2532618 into master Nov 11, 2020
@rsheeter rsheeter deleted the normalize2 branch November 11, 2020 03:33
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