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

How to use the 'regions' argument in the 'triangulate()' function? #43

Open
QuentinRoyerDev opened this issue Mar 11, 2020 · 5 comments

Comments

@QuentinRoyerDev
Copy link

In order to pass original attribute data of initals polygons to each generated triangle, i would like to know how to use the 'regions' argument in the 'triangulate()' function ? I haven't found any tips or examples.

@mzucker
Copy link
Contributor

mzucker commented Mar 15, 2020

I figured out how to do this for a project of my own today. See https://gist.github.com/mzucker/b0846f304b48702ff2530294134ae879

Interestingly, I needed to monkey-patch the triangle Python library, otherwise I got a KeyError at https://github.com/drufat/triangle/blob/master/triangle/tri.py#L67

Adding the extra key/value pair ('triangleattributelist', 'triangle_attributes') to the terms at https://github.com/drufat/triangle/blob/master/triangle/tri.py#L3 would fix this – @drufat would you consider adding it?

Example input and output images attached.

tri_input

tri_output

@drufat
Copy link
Owner

drufat commented Mar 16, 2020

@mzucker Thanks for the contribution. I would be happy to merge it. Could you add your example to the documentation as well?

@mzucker
Copy link
Contributor

mzucker commented Mar 16, 2020

Created a pull request, let me know if it passes muster. This was my first time editing Sphinx and my first pull request on github in a very long time, if not ever.

drufat added a commit that referenced this issue Mar 18, 2020
@QuentinRoyerDev
Copy link
Author

That's exactly what I was hoping for. Thank you very much for your responses.

@mzucker
Copy link
Contributor

mzucker commented Mar 19, 2020

Glad to help!

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