Use glam_matrix_extensions and symmetric matrices#5
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
3D angular inertia tensors are symmetric 3x3 matrices. Currently, we just use a
Mat3, but for better performance and lower memory usage, it'd be better to use a dedicated symmetric matrix type instead. The same is done by physics engines like Rapier and Bepu.Instead of having a custom type in
bevy_heavy, I have recently developedglam_matrix_extensionsfor various matrix types and utilities needed for physics. I also added 2x2 and 3x3 Eigen solvers there. We should use them!Solution
Use
SymmetricMat3for theAngularInertiaTensorand update its constructor APIs. ReplaceSymmetricEigen3with the version provided byglam_matrix_extensions.Also added the
nostd-libmfeature.Migration Guide
The
AngularInertiaTensornow stores aSymmetricMat3. Thefrom_mat3constructor has been replaced byfrom_symmetric_mat3,try_from_mat3, andfrom_mat3_unchecked. Theas_mat3andas_mat3_mutgetters have been replaced byas_symmetric_mat3andas_symmetric_mat3_mut.The
SymmetricEigen3type is now provided byglam_matrix_extensionsinstead ofbevy_heavy.