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

Draw path #1089

Open
sunjay opened this issue Sep 25, 2017 · 7 comments
Open

Draw path #1089

sunjay opened this issue Sep 25, 2017 · 7 comments

Comments

@sunjay
Copy link
Member

sunjay commented Sep 25, 2017

Hi,
Is there a way to draw multiple points that are collected by lines? The polygon method fills the shape. What can I use to draw the entire path as a set of lines? Drawing each line of the path individually is extremely slow at the moment.

Thanks!

@bvssvni
Copy link
Member

bvssvni commented Sep 25, 2017

This library doesn't do triangulation of paths in general, only convex polygons. Perhaps you could use https://github.com/nical/lyon for paths?

@sunjay
Copy link
Member Author

sunjay commented Sep 25, 2017

@bvssvni Thanks! Can I use that with piston?

@bvssvni
Copy link
Member

bvssvni commented Sep 25, 2017

I have not tried it yet, but believe it should work.

@sunjay
Copy link
Member Author

sunjay commented Sep 25, 2017

Would it be possible to add support for simple paths without bringing in something like lyon? All I need is something like line that accepts more than two points. It could be like polygon except the color shades the line instead of filling the area within the points. Is that a hard thing to add? (I'm genuinely asking because I don't know how much effort that would take.)

@bvssvni
Copy link
Member

bvssvni commented Sep 25, 2017

Could use this method https://github.com/PistonDevelopers/graphics/blob/master/src/triangulation.rs#L493. It generates triangles by emitting 2 points.

The work is to get the edge cases right. Depending on how the corner bends, you want to "lock" one point and move the other.

This could be added to the Polygon struct, just like Rectangle that has border settings.

@sunjay
Copy link
Member Author

sunjay commented Sep 25, 2017

If I'm understanding correctly, triangles would need to be closed. Is there a way to render a path of points that wouldn't connect end-to-end?

@bvssvni
Copy link
Member

bvssvni commented Sep 25, 2017

I don't think the quad stream function requires closing.

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

2 participants