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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ComputeMassProperties2d for Annulus
impl ComputeMassProperties2d for Annulus
Source§impl ComputeMassProperties2d for Arc2d
impl ComputeMassProperties2d for Arc2d
fn mass(&self, _density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn angular_inertia(&self, _mass: f32) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, _density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Capsule2d
impl ComputeMassProperties2d for Capsule2d
fn mass(&self, density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Circle
impl ComputeMassProperties2d for Circle
Source§impl ComputeMassProperties2d for ConvexPolygon
impl ComputeMassProperties2d for ConvexPolygon
fn mass(&self, density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Ellipse
impl ComputeMassProperties2d for Ellipse
Source§impl ComputeMassProperties2d for Line2d
impl ComputeMassProperties2d for Line2d
fn mass(&self, _density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn angular_inertia(&self, _mass: f32) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, _density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Plane2d
impl ComputeMassProperties2d for Plane2d
fn mass(&self, _density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn angular_inertia(&self, _mass: f32) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, _density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Polyline2d
impl ComputeMassProperties2d for Polyline2d
fn mass(&self, _density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn angular_inertia(&self, _mass: f32) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, _density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Rectangle
impl ComputeMassProperties2d for Rectangle
Source§impl ComputeMassProperties2d for Rhombus
impl ComputeMassProperties2d for Rhombus
Source§impl ComputeMassProperties2d for Segment2d
impl ComputeMassProperties2d for Segment2d
fn mass(&self, _density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn angular_inertia(&self, _mass: f32) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, _density: f32) -> MassProperties2d
Source§impl ComputeMassProperties2d for Triangle2d
impl ComputeMassProperties2d for Triangle2d
fn mass(&self, density: f32) -> f32
fn unit_angular_inertia(&self) -> f32
fn center_of_mass(&self) -> Vec2
fn mass_properties(&self, density: f32) -> MassProperties2d
Implementors§
impl ComputeMassProperties2d for Collider
Available on crate feature
2d only.