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§
Sourcefn unit_principal_angular_inertia(&self) -> Vec3
fn unit_principal_angular_inertia(&self) -> Vec3
Computes the principal angular inertia corresponding to a mass of 1.0.
Sourcefn center_of_mass(&self) -> Vec3
fn center_of_mass(&self) -> Vec3
Computes the local center of mass relative to the object’s origin.
Provided Methods§
Sourcefn principal_angular_inertia(&self, mass: f32) -> Vec3
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().
Sourcefn local_inertial_frame(&self) -> Quat
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.
Sourcefn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
Computes the 3x3 AngularInertiaTensor corresponding to a mass of 1.0.
Sourcefn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor
fn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor
Computes the 3x3 AngularInertiaTensor corresponding to the given mass.
Sourcefn mass_properties(&self, density: f32) -> MassProperties3d
fn mass_properties(&self, density: f32) -> MassProperties3d
Computes the MassProperties3d with a given density.
Implementations on Foreign Types§
Source§impl ComputeMassProperties3d for Capsule3d
impl ComputeMassProperties3d for Capsule3d
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
fn mass_properties(&self, density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Cone
impl ComputeMassProperties3d for Cone
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
Source§impl ComputeMassProperties3d for ConicalFrustum
impl ComputeMassProperties3d for ConicalFrustum
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
fn mass_properties(&self, density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Cuboid
impl ComputeMassProperties3d for Cuboid
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
Source§impl ComputeMassProperties3d for Cylinder
impl ComputeMassProperties3d for Cylinder
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
Source§impl ComputeMassProperties3d for Line3d
impl ComputeMassProperties3d for Line3d
fn mass(&self, _density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
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 center_of_mass(&self) -> Vec3
fn mass_properties(&self, _density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Plane3d
impl ComputeMassProperties3d for Plane3d
fn mass(&self, _density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
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 center_of_mass(&self) -> Vec3
fn mass_properties(&self, _density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Polyline3d
impl ComputeMassProperties3d for Polyline3d
fn mass(&self, _density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
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 center_of_mass(&self) -> Vec3
fn mass_properties(&self, _density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Segment3d
impl ComputeMassProperties3d for Segment3d
fn mass(&self, _density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
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 center_of_mass(&self) -> Vec3
fn mass_properties(&self, _density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Sphere
impl ComputeMassProperties3d for Sphere
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
Source§impl ComputeMassProperties3d for Tetrahedron
impl ComputeMassProperties3d for Tetrahedron
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn local_inertial_frame(&self) -> Quat
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
fn mass_properties(&self, density: f32) -> MassProperties3d
Source§impl ComputeMassProperties3d for Torus
impl ComputeMassProperties3d for Torus
fn mass(&self, density: f32) -> f32
fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn center_of_mass(&self) -> Vec3
Implementors§
impl ComputeMassProperties3d for Collider
3d only.