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
.