Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Consistent orientation of mesh hole-filled triangles.

Open stormboy opened this issue 1 year ago • 4 comments

Type

  • [x] Bug fix (non-breaking change which fixes an issue): Fixes #
  • [ ] New feature (non-breaking change which adds functionality). Resolves #
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

Checklist:

  • [ ] I have run python util/check_style.py --apply to apply Open3D code style to my code.
  • [ ] This PR changes Open3D behavior or adds new functionality.
    • [ ] Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is updated accordingly.
    • [ ] I have added or updated C++ and / or Python unit tests OR included test results (e.g. screenshots or numbers) here.
  • [x] I will follow up and update the code if CI fails.
  • [ ] For fork PRs, I have selected Allow edits from maintainers.

Description

stormboy avatar Jun 05 '24 06:06 stormboy

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

update-docs[bot] avatar Jun 05 '24 06:06 update-docs[bot]

@stormboy Thanks for this PR! I think it would be very good to get consistent orientation for the newly created triangles. However, the proposed solution affects all triangles. This could change the orientation of the existing triangles which is an unexpected side effect. Do you want to give a solution a try that only affect the hole triangles?

benjaminum avatar Sep 02 '24 15:09 benjaminum

@stormboy Thanks for this PR! I think it would be very good to get consistent orientation for the newly created triangles. However, the proposed solution affects all triangles. This could change the orientation of the existing triangles which is an unexpected side effect. Do you want to give a solution a try that only affect the hole triangles?

I agree that this change adds a dirty way to try solve the problem. I have in fact found a few cases where this solution results in opposing normals in much of an original almost closed volume mesh.

I am in fact planning to have another look at this problem in the coming month. This is the first time I have looked at VTK, which is what is being used, so it might take me a while to understand approaches that can be taken here.

stormboy avatar Sep 05 '24 06:09 stormboy

This may require to directly manipulate the mesh arrays. Something like this

  1. Identify the new triangles
  2. Identify all edges connecting existing and new triangles
  3. Count number of edges for which the triangle orientations disagree between existing and new triangles
  4. Change orientation of new triangles if the majority in step 3 disagrees

benjaminum avatar Sep 05 '24 10:09 benjaminum