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.
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
sourceimpl 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 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.
sourceimpl MassProperties
impl MassProperties
sourceimpl MassProperties
impl MassProperties
sourceimpl 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.
sourceimpl MassProperties
impl MassProperties
sourceimpl MassProperties
impl MassProperties
sourceimpl 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.
sourceimpl 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.
sourceimpl MassProperties
impl MassProperties
Trait Implementations
sourceimpl AbsDiffEq<MassProperties> for MassProperties
impl AbsDiffEq<MassProperties> for MassProperties
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl Add<MassProperties> for MassProperties
impl Add<MassProperties> for MassProperties
type Output = MassProperties
type Output = MassProperties
The resulting type after applying the +
operator.
sourcefn add(self, other: MassProperties) -> Self
fn add(self, other: MassProperties) -> Self
Performs the +
operation. Read more
sourceimpl AddAssign<MassProperties> for MassProperties
impl AddAssign<MassProperties> for MassProperties
sourcefn add_assign(&mut self, rhs: MassProperties)
fn add_assign(&mut self, rhs: MassProperties)
Performs the +=
operation. Read more
sourceimpl Clone for MassProperties
impl Clone for MassProperties
sourcefn clone(&self) -> MassProperties
fn clone(&self) -> MassProperties
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MassProperties
impl Debug for MassProperties
sourceimpl Default for MassProperties
impl Default for MassProperties
sourcefn default() -> MassProperties
fn default() -> MassProperties
Returns the “default value” for a type. Read more
sourceimpl PartialEq<MassProperties> for MassProperties
impl PartialEq<MassProperties> for MassProperties
sourcefn eq(&self, other: &MassProperties) -> bool
fn eq(&self, other: &MassProperties) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MassProperties) -> bool
fn ne(&self, other: &MassProperties) -> bool
This method tests for !=
.
sourceimpl RelativeEq<MassProperties> for MassProperties
impl RelativeEq<MassProperties> for MassProperties
sourcefn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn 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
A test for equality that uses a relative comparison if the values are far apart.
sourcefn 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
The inverse of RelativeEq::relative_eq
.
sourceimpl Sub<MassProperties> for MassProperties
impl Sub<MassProperties> for MassProperties
type Output = MassProperties
type Output = MassProperties
The resulting type after applying the -
operator.
sourcefn sub(self, other: MassProperties) -> Self
fn sub(self, other: MassProperties) -> Self
Performs the -
operation. Read more
sourceimpl SubAssign<MassProperties> for MassProperties
impl SubAssign<MassProperties> for MassProperties
sourcefn sub_assign(&mut self, rhs: MassProperties)
fn sub_assign(&mut self, rhs: MassProperties)
Performs the -=
operation. Read more
sourceimpl Sum<MassProperties> for MassProperties
impl Sum<MassProperties> for MassProperties
sourceimpl Zero for MassProperties
impl Zero for MassProperties
impl Copy for MassProperties
impl StructuralPartialEq for MassProperties
Auto Trait Implementations
impl RefUnwindSafe for MassProperties
impl Send for MassProperties
impl Sync for MassProperties
impl Unpin for MassProperties
impl UnwindSafe for MassProperties
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert 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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn 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 more
sourcefn 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).
sourcefn 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.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more