Fix #144846: Mesh triangulation can generate duplicate faces and edges
Mesh invariants imply that edges and faces must be unique, so things like reversed edges or duplicate faces with equal vertices are invalid. For this reason, every time we generate new elements we have to ensure that all new elements are unique between each other and already existing elements. The recent refactor (ea875f6f32) introduced a new algorithm to generate new mesh elements, and deduplication of new elements was also a part of it. The problem is that the deduplication only guaranteed that the original elements and new elements don't overlap; deduplication between each new elements is not complete. To solve the problem both new triangles and new edges have to be deduplicated, even if there is no duplicates. Just to know this we have to build a hash sets. Triangle deduplication is a special part of the triangulation code, but edges already handled elsewhere in the code base. This refactor fixes this by replacing the original approach with one which guarantees distinct faces and edges in the result. Unfortunately, this fix increases runtime of the node 10x for a simple cube with 500-vertex sides. It should be possible to make the performance better again, but that requires more work. Other work had to be done to enable this, so this depends on: - [x]157e7e0351- [x]fa8574b80bCo-authored-by: Hans Goudey <hans@blender.org> Pull Request: https://projects.blender.org/blender/blender/pulls/147634
This commit is contained in:
BIN
tests/files/modeling/geometry_nodes/mesh/triangulate_deduplication.blend
(Stored with Git LFS)
Normal file
BIN
tests/files/modeling/geometry_nodes/mesh/triangulate_deduplication.blend
(Stored with Git LFS)
Normal file
Binary file not shown.
Reference in New Issue
Block a user