Struct rapier3d::dynamics::MassProperties[][src]

pub struct MassProperties {
    pub local_com: Point<f32, 3_usize>,
    pub inv_mass: f32,
    pub inv_principal_inertia_sqrt: Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>,
    pub principal_inertia_local_frame: Unit<Quaternion<f32>>,
}
Expand description

The local mass properties of a rigid-body.

Fields

local_com: Point<f32, 3_usize>

The center of mass of a rigid-body expressed in its local-space.

inv_mass: f32

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: Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>

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: Unit<Quaternion<f32>>

The principal vectors of the local angular inertia tensor of the rigid-body.

Implementations

impl MassProperties[src]

pub fn new(
    local_com: Point<f32, 3_usize>,
    mass: f32,
    principal_inertia: Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>
) -> MassProperties
[src]

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.

pub fn with_principal_inertia_frame(
    local_com: Point<f32, 3_usize>,
    mass: f32,
    principal_inertia: Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>,
    principal_inertia_local_frame: Unit<Quaternion<f32>>
) -> MassProperties
[src]

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.

pub fn with_inertia_matrix(
    local_com: Point<f32, 3_usize>,
    mass: f32,
    inertia: Matrix<f32, Const<{_: usize}>, Const<{_: usize}>, ArrayStorage<f32, 3_usize, 3_usize>>
) -> MassProperties
[src]

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.

pub fn world_com(
    &self,
    pos: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> Point<f32, 3_usize>
[src]

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

pub fn world_inv_inertia_sqrt(
    &self,
    rot: &Unit<Quaternion<f32>>
) -> SdpMatrix3<f32>
[src]

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

pub fn reconstruct_inverse_inertia_matrix(
    &self
) -> Matrix<f32, Const<{_: usize}>, Const<{_: usize}>, ArrayStorage<f32, 3_usize, 3_usize>>
[src]

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

pub fn reconstruct_inertia_matrix(
    &self
) -> Matrix<f32, Const<{_: usize}>, Const<{_: usize}>, ArrayStorage<f32, 3_usize, 3_usize>>
[src]

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

pub fn transform_by(
    &self,
    m: &Isometry<f32, Unit<Quaternion<f32>>, 3_usize>
) -> MassProperties
[src]

Transform each element of the mass properties.

pub fn set_mass(&mut self, new_mass: f32, adjust_angular_inertia: bool)[src]

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.

impl MassProperties[src]

pub fn from_ball(density: f32, radius: f32) -> MassProperties[src]

Computes the mass properties of a ball.

impl MassProperties[src]

pub fn from_capsule(
    density: f32,
    a: Point<f32, 3_usize>,
    b: Point<f32, 3_usize>,
    radius: f32
) -> MassProperties
[src]

Computes the mass properties of a capsule.

impl MassProperties[src]

pub fn from_compound(
    density: f32,
    shapes: &[(Isometry<f32, Unit<Quaternion<f32>>, 3_usize>, SharedShape)]
) -> MassProperties
[src]

Computes the mass properties of a compound shape.

impl MassProperties[src]

pub fn from_cone(density: f32, half_height: f32, radius: f32) -> MassProperties[src]

Computes the mass properties of a cone.

impl MassProperties[src]

pub fn from_convex_polyhedron(
    density: f32,
    vertices: &[Point<f32, 3_usize>],
    indices: &[[u32; 3]]
) -> MassProperties
[src]

Computes the mass properties of a convex polyhedron.

impl MassProperties[src]

pub fn from_cuboid(
    density: f32,
    half_extents: Matrix<f32, Const<{_: usize}>, Const<1_usize>, ArrayStorage<f32, 3_usize, 1_usize>>
) -> MassProperties
[src]

Computes the mass properties of a cuboid.

impl MassProperties[src]

pub fn from_cylinder(
    density: f32,
    half_height: f32,
    radius: f32
) -> MassProperties
[src]

Computes the mass properties of a cylinder.

Trait Implementations

impl AbsDiffEq<MassProperties> for MassProperties[src]

type Epsilon = f32

Used for specifying relative comparisons.

pub fn default_epsilon(
) -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
[src]

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

pub fn abs_diff_eq(
    &self,
    other: &MassProperties,
    epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
[src]

A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more

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

The inverse of AbsDiffEq::abs_diff_eq.

impl Add<MassProperties> for MassProperties[src]

type Output = MassProperties

The resulting type after applying the + operator.

pub fn add(self, other: MassProperties) -> MassProperties[src]

Performs the + operation. Read more

impl AddAssign<MassProperties> for MassProperties[src]

pub fn add_assign(&mut self, rhs: MassProperties)[src]

Performs the += operation. Read more

impl Clone for MassProperties[src]

pub fn clone(&self) -> MassProperties[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for MassProperties[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl From<MassProperties> for RigidBodyMassProps[src]

fn from(local_mprops: MassProperties) -> Self[src]

Performs the conversion.

impl From<MassProperties> for ColliderMassProps[src]

fn from(mprops: MassProperties) -> Self[src]

Performs the conversion.

impl PartialEq<MassProperties> for MassProperties[src]

pub fn eq(&self, other: &MassProperties) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &MassProperties) -> bool[src]

This method tests for !=.

impl RelativeEq<MassProperties> for MassProperties[src]

pub fn default_max_relative(
) -> <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
[src]

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

pub fn relative_eq(
    &self,
    other: &MassProperties,
    epsilon: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon,
    max_relative: <MassProperties as AbsDiffEq<MassProperties>>::Epsilon
) -> bool
[src]

A test for equality that uses a relative comparison if the values are far apart.

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

The inverse of RelativeEq::relative_eq.

impl Sub<MassProperties> for MassProperties[src]

type Output = MassProperties

The resulting type after applying the - operator.

pub fn sub(self, other: MassProperties) -> MassProperties[src]

Performs the - operation. Read more

impl SubAssign<MassProperties> for MassProperties[src]

pub fn sub_assign(&mut self, rhs: MassProperties)[src]

Performs the -= operation. Read more

impl Sum<MassProperties> for MassProperties[src]

pub fn sum<I>(iter: I) -> MassProperties where
    I: Iterator<Item = MassProperties>, 
[src]

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

impl Zero for MassProperties[src]

pub fn zero() -> MassProperties[src]

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

pub fn is_zero(&self) -> bool[src]

Returns true if self is equal to the additive identity.

fn set_zero(&mut self)[src]

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

impl Copy for MassProperties[src]

impl StructuralPartialEq for MassProperties[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any
[src]

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>[src]

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

pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>[src]

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

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)[src]

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

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

pub fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + 'static + Sync + Send>[src]

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

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pointable for T

pub const ALIGN: usize

The alignment of pointer.

type Init = T

The type for initializers.

pub unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more

pub unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more

pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more

pub unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

pub fn inlined_clone(&self) -> T[src]

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

fn is<T>() -> bool where
    T: Scalar
[src]

Tests if Self the same as the type T Read more

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

pub fn to_subset(&self) -> Option<SS>[src]

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

pub fn is_in_subset(&self) -> bool[src]

Checks if self is actually part of its subset T (and can be converted to it).

pub fn to_subset_unchecked(&self) -> SS[src]

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

pub fn from_subset(element: &SS) -> SP[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

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

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