-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SimplifyQuadricDecimation fixes (#6163)
* SimplifyQuadricDecimation: Check for flipped triangles connected to both vertices of the removed edge The previous code checks if any triangles connected to the removed vertex are flipped in the process of collapsing the edge. However, since the remaining vertex on the collapsed edge can be moved during the operation, triangles connected to this vertex can flip as well. This commit puts the flip-checking code into a loop so we can check both sets of triangles. * SimplifyQuadricDecimation: Disallow creating very small triangles This sets a threshold on how much any triangle can shrink in area during an edge collapse which should avoid creating degenerate triangles. The threshold is somewhat arbitrary, I found 0.001 worked well but it may make sense for this to become a function parameter. * SimplifyQuadricDecimation: Prevent 'pinching' of triangles When a vertex is connected to exactly 3 triangles and an edge of one of these triangles not connected to the vertex is collapsed, the remaining 2 triangles end up sharing the same vertices, with opposite normals. This creates a non-manifold location which is nearly always undesirable. This commit adds a check to see if any of the triangles attached to the collapsing edge share an edge that is not connected to `vidx0` or `vidx1` * SimplifyQuadricDecimation: Save some memory by clearing some vectors after they are no longer needed * Update Changelog with SimplifyQuadricDecimation fixes * SimplifyQuadricDecimation: Reduce memory requirements by removing need for vbars & costs maps Reduces the memory footprint by 27% in my tests runs ~15% faster as we remove a lot of allocations. * SimplifyQuadricDecimation: Simplify checking for pinched triangles Changing from tracking edges (`unordered_set<Vector2i>`) to vertices (`unordered_map<int, int>) gives a good performance increase
- Loading branch information
1 parent
75dccb4
commit a89031c
Showing
2 changed files
with
98 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters