parry3d/mass_properties/
mass_properties_compound.rs

1use crate::mass_properties::MassProperties;
2use crate::math::{Isometry, Real};
3use crate::shape::SharedShape;
4
5impl MassProperties {
6    /// Computes the mass properties of a compound shape.
7    pub fn from_compound(density: Real, shapes: &[(Isometry<Real>, SharedShape)]) -> Self {
8        shapes
9            .iter()
10            .map(|s| s.1.mass_properties(density).transform_by(&s.0))
11            .sum()
12    }
13}