diff options
| author | Crozet Sébastien <developer@crozet.re> | 2020-10-13 18:39:45 +0200 |
|---|---|---|
| committer | Crozet Sébastien <developer@crozet.re> | 2020-10-13 18:39:52 +0200 |
| commit | 8ee3c703d666785207c7db47e3881f2ca9723105 (patch) | |
| tree | b2b4aff8076bc8d690f7d70d6b3d6559d0a42481 /src/dynamics/mass_properties_capsule.rs | |
| parent | faec3d5d46c88e2949179dd2789899e5cf26ed48 (diff) | |
| download | rapier-8ee3c703d666785207c7db47e3881f2ca9723105.tar.gz rapier-8ee3c703d666785207c7db47e3881f2ca9723105.tar.bz2 rapier-8ee3c703d666785207c7db47e3881f2ca9723105.zip | |
Fix cylinder inertia tensor computation.
Diffstat (limited to 'src/dynamics/mass_properties_capsule.rs')
| -rw-r--r-- | src/dynamics/mass_properties_capsule.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/dynamics/mass_properties_capsule.rs b/src/dynamics/mass_properties_capsule.rs index 77ba96d..647cfc7 100644 --- a/src/dynamics/mass_properties_capsule.rs +++ b/src/dynamics/mass_properties_capsule.rs @@ -4,27 +4,6 @@ use crate::geometry::Capsule; use crate::math::{Point, PrincipalAngularInertia, Rotation, Vector}; impl MassProperties { - fn cylinder_y_volume_unit_inertia( - half_height: f32, - radius: f32, - ) -> (f32, PrincipalAngularInertia<f32>) { - #[cfg(feature = "dim2")] - { - Self::cuboid_volume_unit_inertia(Vector::new(radius, half_height)) - } - - #[cfg(feature = "dim3")] - { - let volume = half_height * radius * radius * std::f32::consts::PI * 2.0; - let sq_radius = radius * radius; - let sq_height = half_height * half_height * 4.0; - let off_principal = (sq_radius * 3.0 + sq_height) / 12.0; - - let inertia = Vector::new(off_principal, sq_radius / 2.0, off_principal); - (volume, inertia) - } - } - pub(crate) fn from_capsule(density: f32, a: Point<f32>, b: Point<f32>, radius: f32) -> Self { let half_height = (b - a).norm() / 2.0; let (cyl_vol, cyl_unit_i) = Self::cylinder_y_volume_unit_inertia(half_height, radius); @@ -57,16 +36,4 @@ impl MassProperties { ) } } - - #[cfg(feature = "dim3")] - pub(crate) fn from_cylinder(density: f32, half_height: f32, radius: f32) -> Self { - let (cyl_vol, cyl_unit_i) = Self::cylinder_y_volume_unit_inertia(half_height, radius); - - Self::with_principal_inertia_frame( - Point::origin(), - cyl_vol * density, - cyl_unit_i * density, - Rotation::identity(), - ) - } } |
