Struct parry3d::mass_properties::MassProperties
source · pub struct MassProperties {
pub local_com: Point<Real>,
pub inv_mass: Real,
pub inv_principal_inertia_sqrt: AngVector<Real>,
pub principal_inertia_local_frame: Rotation<Real>,
}
Expand description
The local mass properties of a rigid-body.
Fields§
§local_com: Point<Real>
The center of mass of a rigid-body expressed in its local-space.
inv_mass: Real
The inverse of the mass of a rigid-body.
If this is zero, the rigid-body is assumed to have infinite mass.
inv_principal_inertia_sqrt: AngVector<Real>
The inverse of the principal angular inertia of the rigid-body.
The angular inertia is calculated relative to Self::local_com
.
Components set to zero are assumed to be infinite along the corresponding principal axis.
principal_inertia_local_frame: Rotation<Real>
The principal vectors of the local angular inertia tensor of the rigid-body.
Implementations§
source§impl MassProperties
impl MassProperties
sourcepub fn new(
local_com: Point<Real>,
mass: Real,
principal_inertia: AngVector<Real>
) -> Self
pub fn new( local_com: Point<Real>, mass: Real, principal_inertia: AngVector<Real> ) -> Self
Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia.
The center-of-mass is specified in the local-space of the rigid-body. The principal angular inertia are the angular inertia along the coordinate axes in the local-space of the rigid-body.
sourcepub fn with_principal_inertia_frame(
local_com: Point<Real>,
mass: Real,
principal_inertia: AngVector<Real>,
principal_inertia_local_frame: Rotation<Real>
) -> Self
pub fn with_principal_inertia_frame( local_com: Point<Real>, mass: Real, principal_inertia: AngVector<Real>, principal_inertia_local_frame: Rotation<Real> ) -> Self
Initializes the mass properties from the given center-of-mass, mass, and principal angular inertia.
The center-of-mass is specified in the local-space of the rigid-body.
The principal angular inertia are the angular inertia along the coordinate axes defined by
the principal_inertia_local_frame
expressed in the local-space of the rigid-body.
sourcepub fn with_inertia_matrix(
local_com: Point<Real>,
mass: Real,
inertia: Matrix3<Real>
) -> Self
pub fn with_inertia_matrix( local_com: Point<Real>, mass: Real, inertia: Matrix3<Real> ) -> Self
Initialize a new MassProperties
from a given center-of-mass, mass, and angular inertia matrix.
The angular inertia matrix will be diagonalized in order to extract the principal inertia values and principal inertia frame.
sourcepub fn principal_inertia(&self) -> AngVector<Real>
pub fn principal_inertia(&self) -> AngVector<Real>
The angular inertia along the principal inertia axes and center of mass of the rigid-body.
sourcepub fn world_com(&self, pos: &Isometry<Real>) -> Point<Real>
pub fn world_com(&self, pos: &Isometry<Real>) -> Point<Real>
The world-space center of mass of the rigid-body.
sourcepub fn world_inv_inertia_sqrt(
&self,
rot: &Rotation<Real>
) -> AngularInertia<Real>
pub fn world_inv_inertia_sqrt( &self, rot: &Rotation<Real> ) -> AngularInertia<Real>
The world-space inverse angular inertia tensor of the rigid-body.
sourcepub fn reconstruct_inverse_inertia_matrix(&self) -> Matrix3<Real>
pub fn reconstruct_inverse_inertia_matrix(&self) -> Matrix3<Real>
Reconstructs the inverse angular inertia tensor of the rigid body from its principal inertia values and axes.
sourcepub fn reconstruct_inertia_matrix(&self) -> Matrix3<Real>
pub fn reconstruct_inertia_matrix(&self) -> Matrix3<Real>
Reconstructs the angular inertia tensor of the rigid body from its principal inertia values and axes.
sourcepub fn transform_by(&self, m: &Isometry<Real>) -> Self
pub fn transform_by(&self, m: &Isometry<Real>) -> Self
Transform each element of the mass properties.
sourcepub fn set_mass(&mut self, new_mass: Real, adjust_angular_inertia: bool)
pub fn set_mass(&mut self, new_mass: Real, adjust_angular_inertia: bool)
Changes the mass on these mass-properties.
The adjust_angular_inertia
argument should always be true
, unless
there are some specific reasons not to do so. Setting this to true
will automatically adjust the angular inertia of self
to account
for the mass change (i.e. it will multiply the angular inertia by
new_mass / prev_mass
). Setting it to false
will not change the
current angular inertia.
source§impl MassProperties
impl MassProperties
sourcepub fn from_compound(
density: Real,
shapes: &[(Isometry<Real>, SharedShape)]
) -> Self
pub fn from_compound( density: Real, shapes: &[(Isometry<Real>, SharedShape)] ) -> Self
Computes the mass properties of a compound shape.
source§impl MassProperties
impl MassProperties
sourcepub fn from_convex_polyhedron(
density: Real,
vertices: &[Point<Real>],
indices: &[[u32; 3]]
) -> MassProperties
pub fn from_convex_polyhedron( density: Real, vertices: &[Point<Real>], indices: &[[u32; 3]] ) -> MassProperties
Computes the mass properties of a convex polyhedron.
source§impl MassProperties
impl MassProperties
sourcepub fn from_cuboid(density: Real, half_extents: Vector<Real>) -> Self
pub fn from_cuboid(density: Real, half_extents: Vector<Real>) -> Self
Computes the mass properties of a cuboid.
source§impl MassProperties
impl MassProperties
sourcepub fn from_cylinder(density: Real, half_height: Real, radius: Real) -> Self
pub fn from_cylinder(density: Real, half_height: Real, radius: Real) -> Self
Computes the mass properties of a cylinder.
source§impl MassProperties
impl MassProperties
sourcepub fn from_trimesh(
density: Real,
vertices: &[Point<Real>],
indices: &[[u32; 3]]
) -> MassProperties
pub fn from_trimesh( density: Real, vertices: &[Point<Real>], indices: &[[u32; 3]] ) -> MassProperties
Computes the mass properties of a triangle mesh.
Trait Implementations§
source§impl AbsDiffEq for MassProperties
impl AbsDiffEq for MassProperties
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.source§impl Add for MassProperties
impl Add for MassProperties
§type Output = MassProperties
type Output = MassProperties
+
operator.source§fn add(self, other: MassProperties) -> Self
fn add(self, other: MassProperties) -> Self
+
operation. Read moresource§impl AddAssign for MassProperties
impl AddAssign for MassProperties
source§fn add_assign(&mut self, rhs: MassProperties)
fn add_assign(&mut self, rhs: MassProperties)
+=
operation. Read moresource§impl Clone for MassProperties
impl Clone for MassProperties
source§fn clone(&self) -> MassProperties
fn clone(&self) -> MassProperties
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MassProperties
impl Debug for MassProperties
source§impl Default for MassProperties
impl Default for MassProperties
source§fn default() -> MassProperties
fn default() -> MassProperties
source§impl PartialEq for MassProperties
impl PartialEq for MassProperties
source§fn eq(&self, other: &MassProperties) -> bool
fn eq(&self, other: &MassProperties) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl RelativeEq for MassProperties
impl RelativeEq for MassProperties
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
RelativeEq::relative_eq
.source§impl Sub for MassProperties
impl Sub for MassProperties
§type Output = MassProperties
type Output = MassProperties
-
operator.source§fn sub(self, other: MassProperties) -> Self
fn sub(self, other: MassProperties) -> Self
-
operation. Read moresource§impl SubAssign for MassProperties
impl SubAssign for MassProperties
source§fn sub_assign(&mut self, rhs: MassProperties)
fn sub_assign(&mut self, rhs: MassProperties)
-=
operation. Read moresource§impl Sum for MassProperties
impl Sum for MassProperties
source§impl Zero for MassProperties
impl Zero for MassProperties
impl Copy for MassProperties
impl StructuralPartialEq for MassProperties
Auto Trait Implementations§
impl Freeze for MassProperties
impl RefUnwindSafe for MassProperties
impl Send for MassProperties
impl Sync for MassProperties
impl Unpin for MassProperties
impl UnwindSafe for MassProperties
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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§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>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.