aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2020-09-01 17:35:32 +0200
committerSébastien Crozet <developer@crozet.re>2020-09-01 17:35:32 +0200
commitfc0b3bf39484029d956055943b38bb55ab2c5791 (patch)
treecd7855d71e0858ea3c695e9498ed177c87b5c328 /src
parent2f2a073ce47eaa17f44d88b9dc6cc56362c374e2 (diff)
downloadrapier-fc0b3bf39484029d956055943b38bb55ab2c5791.tar.gz
rapier-fc0b3bf39484029d956055943b38bb55ab2c5791.tar.bz2
rapier-fc0b3bf39484029d956055943b38bb55ab2c5791.zip
Mass properties: add a max number of iterations for the local-frame rotation computation.
Diffstat (limited to 'src')
-rw-r--r--src/dynamics/mass_properties.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dynamics/mass_properties.rs b/src/dynamics/mass_properties.rs
index f2fce4b..586eaaf 100644
--- a/src/dynamics/mass_properties.rs
+++ b/src/dynamics/mass_properties.rs
@@ -209,7 +209,8 @@ impl Sub<MassProperties> for MassProperties {
let i2 = other.construct_shifted_inertia_matrix(local_com - other.local_com);
let inertia = i1 - i2;
let eigen = inertia.symmetric_eigen();
- let principal_inertia_local_frame = Rotation::from_matrix(&eigen.eigenvectors);
+ let principal_inertia_local_frame =
+ Rotation::from_matrix_eps(&eigen.eigenvectors, 1.0e-6, 10, na::one());
let principal_inertia = eigen.eigenvalues;
// NOTE: we drop the negative eigenvalues that may result from subtraction rounding errors.
let inv_principal_inertia_sqrt = principal_inertia.map(|e| utils::inv(e.max(0.0).sqrt()));
@@ -272,7 +273,8 @@ impl Add<MassProperties> for MassProperties {
let i2 = other.construct_shifted_inertia_matrix(local_com - other.local_com);
let inertia = i1 + i2;
let eigen = inertia.symmetric_eigen();
- let principal_inertia_local_frame = Rotation::from_matrix(&eigen.eigenvectors);
+ let principal_inertia_local_frame =
+ Rotation::from_matrix_eps(&eigen.eigenvectors, 1.0e-6, 10, na::one());
let principal_inertia = eigen.eigenvalues;
let inv_principal_inertia_sqrt = principal_inertia.map(|e| utils::inv(e.sqrt()));