aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/mass_properties_cone.rs
diff options
context:
space:
mode:
authorSébastien Crozet <developer@crozet.re>2021-01-29 14:42:32 +0100
committerGitHub <noreply@github.com>2021-01-29 14:42:32 +0100
commit7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c (patch)
tree3781b9d7c92a6a8111573ba4cae1c5d41435950e /src/dynamics/mass_properties_cone.rs
parente6fc8f67faf3e37afe38d683cbd930d457f289be (diff)
parent825f33efaec4ce6a8903751e836a0ea9c466ff92 (diff)
downloadrapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.gz
rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.bz2
rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.zip
Merge pull request #79 from dimforge/split_geom
Move most of the geometric code to another crate.
Diffstat (limited to 'src/dynamics/mass_properties_cone.rs')
-rw-r--r--src/dynamics/mass_properties_cone.rs29
1 files changed, 0 insertions, 29 deletions
diff --git a/src/dynamics/mass_properties_cone.rs b/src/dynamics/mass_properties_cone.rs
deleted file mode 100644
index 12f831f..0000000
--- a/src/dynamics/mass_properties_cone.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-use crate::dynamics::MassProperties;
-use crate::math::{Point, PrincipalAngularInertia, Rotation, Vector};
-
-impl MassProperties {
- pub(crate) fn cone_y_volume_unit_inertia(
- half_height: f32,
- radius: f32,
- ) -> (f32, PrincipalAngularInertia<f32>) {
- let volume = radius * radius * std::f32::consts::PI * half_height * 2.0 / 3.0;
- let sq_radius = radius * radius;
- let sq_height = half_height * half_height * 4.0;
- let off_principal = sq_radius * 3.0 / 20.0 + sq_height * 3.0 / 5.0;
- let principal = sq_radius * 3.0 / 10.0;
-
- (volume, Vector::new(off_principal, principal, off_principal))
- }
-
- pub(crate) fn from_cone(density: f32, half_height: f32, radius: f32) -> Self {
- let (cyl_vol, cyl_unit_i) = Self::cone_y_volume_unit_inertia(half_height, radius);
- let cyl_mass = cyl_vol * density;
-
- Self::with_principal_inertia_frame(
- Point::new(0.0, -half_height / 2.0, 0.0),
- cyl_mass,
- cyl_unit_i * cyl_mass,
- Rotation::identity(),
- )
- }
-}