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

Implement transformation for glyph contents when kurbo available #110

Open
madig opened this issue Apr 21, 2021 · 6 comments
Open

Implement transformation for glyph contents when kurbo available #110

madig opened this issue Apr 21, 2021 · 6 comments

Comments

@madig
Copy link
Collaborator

madig commented Apr 21, 2021

I'd like to be able to do kurbo::Affine * Contour or some such, found at least two instances where that would come in handy. Maybe something for returning a transformed copy and for transforming in place?

@cmyr
Copy link
Member

cmyr commented Apr 22, 2021

mm. I was also today running into decomposition, so I do think it makes sense to have a to_kurbo method on Contour, behind the kurbo feature. Does it make more sense to use the norad affine type in your case? I'm not sure, just thinking aloud...

@madig
Copy link
Collaborator Author

madig commented Apr 23, 2021

Then all the affine transformations would need to be impl'd on norad's affine type, no? I thought we should reuse kurbo for that.

@simoncozens
Copy link
Contributor

Can we also have a to_kurbo method (or even better some kind of Into trait) on AffineTransform for components? Currently I'm doing this:

    let transform = [
        component.transform.x_scale as f64,
        component.transform.xy_scale as f64,
        component.transform.y_scale as f64,
        component.transform.yx_scale as f64,
        component.transform.x_offset as f64,
        component.transform.y_offset as f64,
    ];
    Affine::new(transform)

@cmyr
Copy link
Member

cmyr commented Apr 23, 2021

@simoncozens
Copy link
Contributor

Hah, great. Not sure why I couldn’t see it on docs.rs - maybe it doesn’t pick up stuff behind features.

@cmyr
Copy link
Member

cmyr commented Apr 28, 2021

Yes, I think that's true.

simoncozens added a commit to simoncozens/norad that referenced this issue May 9, 2021
cmyr added a commit that referenced this issue May 12, 2021
* Convert Contour to Kurbo path. See #110

* Correct start-of-path processing

* Add to_kurbo method to ContourPoint

* Match the slice, not the length of the slice

* Smarter way of rotating the contour

* .clear, not .truncate a vec

* Index-free quad implementation

* This turns out to be important

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Colin Rofls <[email protected]>
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

No branches or pull requests

3 participants