Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix normal flipping during triangulation #340

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

Merged
merged 8 commits into from
Oct 8, 2022

Conversation

tylermorganwall
Copy link
Contributor

This pull request fixes the triangulation issue by implementing Newell's method to ensure polygons aren't flipped, as well as turns off triangulation for faces when npolys == 3. I have confirmed it fixes all flipped normals on multiple large datasets with many polygonal faces. This fixes issue #319 .

-Update triangulation routine to use Newell's method to ensure polygons aren't flipped when triangulated
-Don't triangulate when npolys == 3
@syoyo
Copy link
Collaborator

syoyo commented Oct 2, 2022

@tylermorganwall Awesome! I will do double-check with dataset in #319

BTW PR requires some compilation fixes.

-Remove dependency on C++11 by using a custom struct instead of an std::array
-Fix compilation by adding default constructor and remove array access
-Fix struct constructor
-Change array access to struct member
@tylermorganwall
Copy link
Contributor Author

I fixed the compilation issues by replacing std::array with a custom struct, which should remove the C++11 dependency

@syoyo syoyo merged commit 9109078 into tinyobjloader:master Oct 8, 2022
@syoyo
Copy link
Collaborator

syoyo commented Oct 8, 2022

@tylermorganwall Awesme! At least confirmed the PR now compiles well on C++03 + clang and gcc on my side. Polygon tessellation seems working well on my local test, so merged!

You can ignore some CI build failure, which is related to Python things.

@syoyo syoyo mentioned this pull request Oct 9, 2022
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