pub trait ComputeMassProperties2d {
// Required methods
fn mass(&self, density: f32) -> f32;
fn unit_angular_inertia(&self) -> f32;
fn center_of_mass(&self) -> Vec2;
// Provided methods
fn angular_inertia(&self, mass: f32) -> f32 { ... }
fn mass_properties(&self, density: f32) -> MassProperties2d { ... }
}
Expand description
A trait for computing MassProperties2d
for 2D objects.
For the 3D equivalent, see ComputeMassProperties3d
.
Required Methods§
sourcefn unit_angular_inertia(&self) -> f32
fn unit_angular_inertia(&self) -> f32
Computes the angular inertia corresponding to a mass of 1.0
.
sourcefn center_of_mass(&self) -> Vec2
fn center_of_mass(&self) -> Vec2
Computes the local center of mass relative to the object’s origin.
Provided Methods§
sourcefn angular_inertia(&self, mass: f32) -> f32
fn angular_inertia(&self, mass: f32) -> f32
Computes the angular inertia corresponding to the given mass
.
Equivalent to mass * shape.unit_angular_inertia()
.
sourcefn mass_properties(&self, density: f32) -> MassProperties2d
fn mass_properties(&self, density: f32) -> MassProperties2d
Computes the MassProperties2d
with a given density
.