aboutsummaryrefslogtreecommitdiff
path: root/src/dynamics/mass_properties_cuboid.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_cuboid.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_cuboid.rs')
-rw-r--r--src/dynamics/mass_properties_cuboid.rs33
1 files changed, 0 insertions, 33 deletions
diff --git a/src/dynamics/mass_properties_cuboid.rs b/src/dynamics/mass_properties_cuboid.rs
deleted file mode 100644
index 2d870cf..0000000
--- a/src/dynamics/mass_properties_cuboid.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use crate::dynamics::MassProperties;
-use crate::math::{Point, PrincipalAngularInertia, Vector};
-
-impl MassProperties {
- pub(crate) fn cuboid_volume_unit_inertia(
- half_extents: Vector<f32>,
- ) -> (f32, PrincipalAngularInertia<f32>) {
- #[cfg(feature = "dim2")]
- {
- let volume = half_extents.x * half_extents.y * 4.0;
- let ix = (half_extents.x * half_extents.x) / 3.0;
- let iy = (half_extents.y * half_extents.y) / 3.0;
-
- (volume, ix + iy)
- }
-
- #[cfg(feature = "dim3")]
- {
- let volume = half_extents.x * half_extents.y * half_extents.z * 8.0;
- let ix = (half_extents.x * half_extents.x) / 3.0;
- let iy = (half_extents.y * half_extents.y) / 3.0;
- let iz = (half_extents.z * half_extents.z) / 3.0;
-
- (volume, Vector::new(iy + iz, ix + iz, ix + iy))
- }
- }
-
- pub(crate) fn from_cuboid(density: f32, half_extents: Vector<f32>) -> Self {
- let (vol, unit_i) = Self::cuboid_volume_unit_inertia(half_extents);
- let mass = vol * density;
- Self::new(Point::origin(), mass, unit_i * mass)
- }
-}