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

Check winding order of input triangles #13

Open
kylebarron opened this issue Jun 10, 2020 · 1 comment · May be fixed by #14
Open

Check winding order of input triangles #13

kylebarron opened this issue Jun 10, 2020 · 1 comment · May be fixed by #14

Comments

@kylebarron
Copy link
Owner

kylebarron commented Jun 10, 2020

It looks like (py)martini creates a mesh with vertices (at least sometimes) in clockwise order, while the Quantized Mesh spec requires counter-clockwise winding order.

e.g. here are the first three 2D vertices, and it looks like they define a clockwise triangle

image

So I should add an option, probably True by default, that checks the input geometries and flips the order of indices if the triangle is in clockwise winding order.

It looks like it shouldn't actually be too slow to check, though it might be best in Cython... not sure if I can vectorize it easily

This might solve #9 , #11

@kylebarron
Copy link
Owner Author

You should be able to do this vectorised. Use positions as a lookup table, then you should be able to apply indices, to get triples of coordinates. Then just do the simple algorithm above and flip the order of indices where necessary

This was referenced Jun 11, 2020
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 a pull request may close this issue.

1 participant