bevy_heavy

Trait ComputeMassProperties2d

source
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§

source

fn mass(&self, density: f32) -> f32

Computes the mass of the object with a given density.

source

fn unit_angular_inertia(&self) -> f32

Computes the angular inertia corresponding to a mass of 1.0.

source

fn center_of_mass(&self) -> Vec2

Computes the local center of mass relative to the object’s origin.

Provided Methods§

source

fn angular_inertia(&self, mass: f32) -> f32

Computes the angular inertia corresponding to the given mass.

Equivalent to mass * shape.unit_angular_inertia().

source

fn mass_properties(&self, density: f32) -> MassProperties2d

Computes the MassProperties2d with a given density.

Implementations on Foreign Types§

source§

impl ComputeMassProperties2d for Annulus

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for Arc2d

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for BoxedPolygon

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for BoxedPolyline2d

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for Capsule2d

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for Circle

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for CircularSector

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for CircularSegment

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for Ellipse

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for Line2d

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for Plane2d

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for Rectangle

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for RegularPolygon

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for Rhombus

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

impl ComputeMassProperties2d for Segment2d

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

source§

impl ComputeMassProperties2d for Triangle2d

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, density: f32) -> MassProperties2d

source§

impl<const N: usize> ComputeMassProperties2d for Polygon<N>

source§

fn mass(&self, density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, density: f32) -> MassProperties2d

source§

impl<const N: usize> ComputeMassProperties2d for Polyline2d<N>

source§

fn mass(&self, _density: f32) -> f32

source§

fn unit_angular_inertia(&self) -> f32

source§

fn angular_inertia(&self, _mass: f32) -> f32

source§

fn center_of_mass(&self) -> Vec2

source§

fn mass_properties(&self, _density: f32) -> MassProperties2d

Implementors§