avian3d::dynamics::prelude

Trait ComputeMassProperties3d

source
pub trait ComputeMassProperties3d {
    // Required methods
    fn mass(&self, density: f32) -> f32;
    fn unit_principal_angular_inertia(&self) -> Vec3;
    fn center_of_mass(&self) -> Vec3;

    // Provided methods
    fn principal_angular_inertia(&self, mass: f32) -> Vec3 { ... }
    fn local_inertial_frame(&self) -> Quat { ... }
    fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor { ... }
    fn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor { ... }
    fn mass_properties(&self, density: f32) -> MassProperties3d { ... }
}
Expand description

A trait for computing MassProperties3d for 3D objects.

For the 2D equivalent, see ComputeMassProperties2d.

Required Methods§

source

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

Computes the mass of the object with a given density.

source

fn unit_principal_angular_inertia(&self) -> Vec3

Computes the principal angular inertia corresponding to a mass of 1.0.

source

fn center_of_mass(&self) -> Vec3

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

Provided Methods§

source

fn principal_angular_inertia(&self, mass: f32) -> Vec3

Computes the principal angular inertia corresponding to the given mass.

Equivalent to mass * shape.unit_principal_angular_inertia().

source

fn local_inertial_frame(&self) -> Quat

Computes the orientation of the inertial frame used by the principal axes of inertia in local space.

For most primitive shapes, this returns an identity quaternion, which means that the principal axes are aligned with the object’s XYZ axes.

source

fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor

Computes the 3x3 AngularInertiaTensor corresponding to a mass of 1.0.

source

fn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor

Computes the 3x3 AngularInertiaTensor corresponding to the given mass.

source

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

Computes the MassProperties3d with a given density.

Implementations on Foreign Types§

source§

impl ComputeMassProperties3d for BoxedPolyline3d

source§

impl ComputeMassProperties3d for Capsule3d

source§

impl ComputeMassProperties3d for Cone

source§

impl ComputeMassProperties3d for ConicalFrustum

source§

impl ComputeMassProperties3d for Cuboid

source§

impl ComputeMassProperties3d for Cylinder

source§

impl ComputeMassProperties3d for Line3d

source§

impl ComputeMassProperties3d for Plane3d

source§

impl ComputeMassProperties3d for Segment3d

source§

impl ComputeMassProperties3d for Sphere

source§

impl ComputeMassProperties3d for Tetrahedron

source§

impl ComputeMassProperties3d for Torus

source§

impl<const N: usize> ComputeMassProperties3d for Polyline3d<N>

Implementors§