simplify: Split quadrics update into a separate function #788
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of updating quadrics as we are collapsing edges, we can update
them in batch after all collapses are done. This makes the code cleaner
since we do not need to replicate the collapse structure explicitly for
both remap and quadric update, and also makes it ~5-7% faster on large
meshes - presumably due to better data locality during the update.
The only subtle part here is vertex_quadrics update: we need to do this
just once, and we know the primary vertex will have to move if any
wedge moved, so we do that during the corresponding collapse. The
target vertex may not have had any collapses to the primary vertex in
case some vertex gets collapsed into a locked vertex.
This change results in exactly identical output; in the future, this
would result in a more careful handling of Complex collapses as our note
about the attribute quadrics not requiring a merge was incorrect - even
though the attributes might be similar, merging quadrics is still
valuable to get area accumulation.
This contribution is sponsored by Valve.