aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2020-09-01 17:47:21 +0200
committerSébastien Crozet <developer@crozet.re>2020-09-01 17:47:21 +0200
commit939e569491ca81d8deaca6f13119490c439fc9bf (patch)
tree74545e611ca89264a2a877446e54f6b6cf6bf682 /src/dynamics
parent1b7e343266c6012672c57b12e27b3a31d6d27eb1 (diff)
downloadrapier-939e569491ca81d8deaca6f13119490c439fc9bf.tar.gz
rapier-939e569491ca81d8deaca6f13119490c439fc9bf.tar.bz2
rapier-939e569491ca81d8deaca6f13119490c439fc9bf.zip
Take local inertial frame into accound for abs comparison of MassProperties.
Diffstat (limited to 'src/dynamics')
-rw-r--r--src/dynamics/mass_properties.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/dynamics/mass_properties.rs b/src/dynamics/mass_properties.rs
index 586eaaf..22e7da5 100644
--- a/src/dynamics/mass_properties.rs
+++ b/src/dynamics/mass_properties.rs
@@ -300,14 +300,22 @@ impl approx::AbsDiffEq for MassProperties {
}
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool {
- self.local_com.abs_diff_eq(&other.local_com, epsilon)
+ #[cfg(feature = "dim2")]
+ let inertia_is_ok = self
+ .inv_principal_inertia_sqrt
+ .abs_diff_eq(&other.inv_principal_inertia_sqrt, epsilon);
+
+ #[cfg(feature = "dim3")]
+ let inertia_is_ok = self
+ .reconstruct_inverse_inertia_matrix()
+ .abs_diff_eq(&other.reconstruct_inverse_inertia_matrix(), epsilon);
+
+ inertia_is_ok
+ && self.local_com.abs_diff_eq(&other.local_com, epsilon)
&& self.inv_mass.abs_diff_eq(&other.inv_mass, epsilon)
&& self
.inv_principal_inertia_sqrt
.abs_diff_eq(&other.inv_principal_inertia_sqrt, epsilon)
- // && self
- // .principal_inertia_local_frame
- // .abs_diff_eq(&other.principal_inertia_local_frame, epsilon)
}
}