pub struct PyRigidBody {
pub mass: f64,
pub half_extents: [f64; 3],
}Expand description
PyRigidBody is a lightweight handle-based wrapper that exposes
body-level computations (moment of inertia, etc.) without owning state.
Fields§
§mass: f64Mass of the body (kg).
half_extents: [f64; 3]Half-extents [hx, hy, hz] for box-shaped bodies.
Implementations§
Source§impl PyRigidBody
impl PyRigidBody
Sourcepub fn new(mass: f64, half_extents: [f64; 3]) -> Self
pub fn new(mass: f64, half_extents: [f64; 3]) -> Self
Create a new PyRigidBody with the given mass and box half-extents.
Sourcepub fn compute_moment_of_inertia_box(&self) -> InertiaTensor
pub fn compute_moment_of_inertia_box(&self) -> InertiaTensor
Compute the solid box inertia tensor for this body.
For a solid box with mass m and half-extents (hx, hy, hz):
Ixx = m/3 * (hy² + hz²)Iyy = m/3 * (hx² + hz²)Izz = m/3 * (hx² + hy²)
Returns an InertiaTensor with the principal-axis diagonal.
Sourcepub fn compute_moment_of_inertia_sphere(&self, radius: f64) -> InertiaTensor
pub fn compute_moment_of_inertia_sphere(&self, radius: f64) -> InertiaTensor
Compute moment of inertia for a solid sphere.
I = 2/5 * m * r² for each axis (isotropic).
Auto Trait Implementations§
impl Freeze for PyRigidBody
impl RefUnwindSafe for PyRigidBody
impl Send for PyRigidBody
impl Sync for PyRigidBody
impl Unpin for PyRigidBody
impl UnsafeUnpin for PyRigidBody
impl UnwindSafe for PyRigidBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.