pub struct MassProperties {
pub mass: Real,
pub center_of_mass: Vec3,
pub local_inertia: Mat3,
}Expand description
Mass properties of a rigid body.
Fields§
§mass: RealMass in kilograms.
center_of_mass: Vec3Center of mass in local space.
local_inertia: Mat3Local inertia tensor (3x3 matrix).
Implementations§
Source§impl MassProperties
impl MassProperties
Sourcepub fn new(mass: Real, center_of_mass: Vec3, local_inertia: Mat3) -> Self
pub fn new(mass: Real, center_of_mass: Vec3, local_inertia: Mat3) -> Self
Create new mass properties.
Sourcepub fn point_mass(mass: Real) -> Self
pub fn point_mass(mass: Real) -> Self
Mass properties for a point mass.
Sourcepub fn inverse_mass(&self) -> Real
pub fn inverse_mass(&self) -> Real
Inverse mass (0 for infinite/static mass).
Sourcepub fn inverse_inertia(&self) -> Mat3
pub fn inverse_inertia(&self) -> Mat3
Inverse inertia tensor (zero matrix for infinite/static inertia).
Source§impl MassProperties
impl MassProperties
Sourcepub fn cuboid(mass: Real, wx: Real, wy: Real, wz: Real) -> Self
pub fn cuboid(mass: Real, wx: Real, wy: Real, wz: Real) -> Self
Mass properties for a uniform-density box with dimensions (wx, wy, wz).
Sourcepub fn cylinder(mass: Real, radius: Real, height: Real) -> Self
pub fn cylinder(mass: Real, radius: Real, height: Real) -> Self
Mass properties for a uniform-density cylinder (axis along Y).
Sourcepub fn combine(&self, other: &MassProperties) -> MassProperties
pub fn combine(&self, other: &MassProperties) -> MassProperties
Combine two mass properties (additive).
Source§impl MassProperties
impl MassProperties
Sourcepub fn cone(mass: Real, radius: Real, height: Real) -> Self
pub fn cone(mass: Real, radius: Real, height: Real) -> Self
Mass properties for a uniform-density cone (apex at top, base at bottom,
axis along +Y). Height = height, base radius = radius.
Sourcepub fn spherical_shell(mass: Real, radius: Real) -> Self
pub fn spherical_shell(mass: Real, radius: Real) -> Self
Mass properties for a hollow spherical shell.
Sourcepub fn capsule(mass: Real, radius: Real, half_height: Real) -> Self
pub fn capsule(mass: Real, radius: Real, half_height: Real) -> Self
Mass properties for a uniform-density capsule (cylinder + 2 hemispheres, axis along Y).
Sourcepub fn shifted_inertia(&self, d: Vec3) -> Mat3
pub fn shifted_inertia(&self, d: Vec3) -> Mat3
Parallel-axis theorem: shift the inertia tensor by offset d from the
center of mass.
Trait Implementations§
Source§impl Clone for MassProperties
impl Clone for MassProperties
Source§fn clone(&self) -> MassProperties
fn clone(&self) -> MassProperties
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MassProperties
impl RefUnwindSafe for MassProperties
impl Send for MassProperties
impl Sync for MassProperties
impl Unpin for MassProperties
impl UnsafeUnpin for MassProperties
impl UnwindSafe for MassProperties
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.