From 32b6e122c154ecc21b20314c11b084ad93a0e836 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 3 Nov 2020 11:46:38 +0100 Subject: Add the ability to set the mass and mass properties of the rigid-body built with the RigidBodyBuilder --- src/dynamics/mass_properties.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/dynamics/mass_properties.rs') diff --git a/src/dynamics/mass_properties.rs b/src/dynamics/mass_properties.rs index d64839c..9cc22a9 100644 --- a/src/dynamics/mass_properties.rs +++ b/src/dynamics/mass_properties.rs @@ -25,8 +25,9 @@ pub struct MassProperties { } impl MassProperties { + /// Initializes the mass properties from the given center-of-mass, mass, and angular inertia. #[cfg(feature = "dim2")] - pub(crate) fn new(local_com: Point, mass: f32, principal_inertia: f32) -> Self { + pub fn new(local_com: Point, mass: f32, principal_inertia: f32) -> Self { let inv_mass = utils::inv(mass); let inv_principal_inertia_sqrt = utils::inv(principal_inertia.sqrt()); Self { @@ -36,13 +37,20 @@ impl MassProperties { } } + /// Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia. + /// + /// The principal angular inertia are the angular inertia along the coordinate axes. #[cfg(feature = "dim3")] - pub(crate) fn new(local_com: Point, mass: f32, principal_inertia: AngVector) -> Self { + pub fn new(local_com: Point, mass: f32, principal_inertia: AngVector) -> Self { Self::with_principal_inertia_frame(local_com, mass, principal_inertia, Rotation::identity()) } + /// Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia. + /// + /// The principal angular inertia are the angular inertia along the coordinate axes defined by + /// the `principal_inertia_local_frame`. #[cfg(feature = "dim3")] - pub(crate) fn with_principal_inertia_frame( + pub fn with_principal_inertia_frame( local_com: Point, mass: f32, principal_inertia: AngVector, -- cgit