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

source

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.

source

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.

source

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.

source

pub fn mass(&self) -> Real

The mass.

source

pub fn principal_inertia(&self) -> AngVector<Real>

The angular inertia along the principal inertia axes and center of mass of the rigid-body.

source

pub fn world_com(&self, pos: &Isometry<Real>) -> Point<Real>

The world-space center of mass of the rigid-body.

source

pub fn world_inv_inertia_sqrt( &self, rot: &Rotation<Real> ) -> AngularInertia<Real>

The world-space inverse angular inertia tensor of the rigid-body.

source

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.

source

pub fn reconstruct_inertia_matrix(&self) -> Matrix3<Real>

Reconstructs the angular inertia tensor of the rigid body from its principal inertia values and axes.

source

pub fn transform_by(&self, m: &Isometry<Real>) -> Self

Transform each element of the mass properties.

source

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

source

pub fn from_ball(density: Real, radius: Real) -> Self

Computes the mass properties of a ball.

source§

impl MassProperties

source

pub fn from_capsule( density: Real, a: Point<Real>, b: Point<Real>, radius: Real ) -> Self

Computes the mass properties of a capsule.

source§

impl MassProperties

source

pub fn from_compound( density: Real, shapes: &[(Isometry<Real>, SharedShape)] ) -> Self

Computes the mass properties of a compound shape.

source§

impl MassProperties

source

pub fn from_cone(density: Real, half_height: Real, radius: Real) -> Self

Computes the mass properties of a cone.

source§

impl MassProperties

source

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

source

pub fn from_cuboid(density: Real, half_extents: Vector<Real>) -> Self

Computes the mass properties of a cuboid.

source§

impl MassProperties

source

pub fn from_cylinder(density: Real, half_height: Real, radius: Real) -> Self

Computes the mass properties of a cylinder.

source§

impl MassProperties

source

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

§

type Epsilon = f32

Used for specifying relative comparisons.
source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

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.
source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
source§

impl Add for MassProperties

§

type Output = MassProperties

The resulting type after applying the + operator.
source§

fn add(self, other: MassProperties) -> Self

Performs the + operation. Read more
source§

impl AddAssign for MassProperties

source§

fn add_assign(&mut self, rhs: MassProperties)

Performs the += operation. Read more
source§

impl Clone for MassProperties

source§

fn clone(&self) -> MassProperties

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for MassProperties

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MassProperties

source§

fn default() -> MassProperties

Returns the “default value” for a type. Read more
source§

impl PartialEq for MassProperties

source§

fn eq(&self, other: &MassProperties) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl RelativeEq for MassProperties

source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

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.
source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of RelativeEq::relative_eq.
source§

impl Sub for MassProperties

§

type Output = MassProperties

The resulting type after applying the - operator.
source§

fn sub(self, other: MassProperties) -> Self

Performs the - operation. Read more
source§

impl SubAssign for MassProperties

source§

fn sub_assign(&mut self, rhs: MassProperties)

Performs the -= operation. Read more
source§

impl Sum for MassProperties

source§

fn sum<I>(iter: I) -> Self
where I: Iterator<Item = Self>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Zero for MassProperties

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Copy for MassProperties

source§

impl StructuralPartialEq for MassProperties

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,