Skip to main content

MassConstraintSystem

Struct MassConstraintSystem 

Source
pub struct MassConstraintSystem<N>
where N: RealField + Copy,
{ /* private fields */ }
Expand description

A deformable surface using a mass-LengthConstraint model with triangular elements.

Implementations§

Source§

impl<N> MassConstraintSystem<N>
where N: RealField + Copy,

Source

pub fn from_polyline( polyline: &Polyline<N>, mass: N, stiffness: Option<N>, ) -> MassConstraintSystem<N>

Builds a mass-spring system from a polyline.

Source

pub fn user_data(&self) -> Option<&(dyn Any + Send + Sync + 'static)>

Retrieves a reference to the user-defined user-data attached to this object.

Source

pub fn user_data_mut( &mut self, ) -> Option<&mut (dyn Any + Send + Sync + 'static)>

Retrieves a mutable reference to the user-defined user-data attached to this object.

Source

pub fn set_user_data( &mut self, data: Option<Box<dyn Any + Send + Sync>>, ) -> Option<Box<dyn Any + Send + Sync>>

Sets the user-defined data attached to this object.

Source

pub fn take_user_data(&mut self) -> Option<Box<dyn Any + Send + Sync>>

Replace by None the user-defined data attached to this object and returns the old value.

Source

pub fn add_constraint( &mut self, node1: usize, node2: usize, stiffness: Option<N>, )

Add one constraint to this mass-constraint system.

Source

pub fn generate_neighbor_constraints(&mut self, stiffness: Option<N>)

Generate additional constraints between nodes that are transitively neighbors.

Given three nodes a, b, c, if a constraint exists between a and b, and between b and c, then a constraint between a and c is created if it does not already exists.

Source

pub fn num_nodes(&self) -> usize

The number of nodes of this mass-constraint system.

Source

pub fn mass(&self) -> N

The total mass of this body.

Source

pub fn set_warmstart_coefficient(&mut self, coeff: N)

The coefficient used for warm-starting the resolution of internal constraints of this soft body (default: 0.5).

Source

pub fn warmstart_coefficient(&self) -> N

The coefficient used for warm-starting the resolution of internal constraints of this soft body (default: 0.5).

Source

pub fn set_node_kinematic(&mut self, i: usize, is_kinematic: bool)

Restrict the specified node acceleration to always be zero so it can be controlled manually by the user at the velocity level.

Source

pub fn clear_kinematic_nodes(&mut self)

Mark all nodes as non-kinematic.

Source

pub fn set_plasticity(&mut self, strain_threshold: N, creep: N, max_force: N)

Sets the plastic properties of this mass-constraint system.

Trait Implementations§

Source§

impl<N> Body<N> for MassConstraintSystem<N>
where N: RealField + Copy,

Source§

fn gravity_enabled(&self) -> bool

Whether this body is affected by gravity.
Source§

fn enable_gravity(&mut self, enabled: bool)

Enable or disable gravity for this body.
Source§

fn update_kinematics(&mut self)

Updates the kinematics, e.g., positions and jacobians, of this body.
Source§

fn update_dynamics(&mut self, _: N)

Update the dynamics property of this body.
Source§

fn update_acceleration( &mut self, gravity: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, parameters: &IntegrationParameters<N>, )

Update the acceleration of this body given the forces it is subject to and the gravity.
Source§

fn clear_forces(&mut self)

Reset the timestep-specific dynamic information of this body.
Source§

fn apply_displacement(&mut self, disp: &[N])

Applies a generalized displacement to this body.
Source§

fn status(&self) -> BodyStatus

The status of this body.
Source§

fn set_status(&mut self, status: BodyStatus)

Set the status of this body.
Source§

fn clear_update_flags(&mut self)

Clear all the update flags of this body.
Source§

fn update_status(&self) -> BodyUpdateStatus

The flags tracking what modifications were applied to a body.
Source§

fn activation_status(&self) -> &ActivationStatus<N>

Information regarding activation and deactivation (sleeping) of this body.
Source§

fn set_deactivation_threshold(&mut self, threshold: Option<N>)

Sets the energy bellow which this body is put to sleep. Read more
Source§

fn ndofs(&self) -> usize

The number of degrees of freedom of this body.
Source§

fn generalized_acceleration( &self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The generalized accelerations at each degree of freedom of this body.
Source§

fn generalized_velocity( &self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The generalized velocities of this body.
Source§

fn companion_id(&self) -> usize

The companion ID of this body.
Source§

fn set_companion_id(&mut self, id: usize)

Set the companion ID of this body (may be reinitialized by nphysics).
Source§

fn generalized_velocity_mut( &mut self, ) -> Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>

The mutable generalized velocities of this body.
Source§

fn integrate(&mut self, parameters: &IntegrationParameters<N>)

Integrate the position of this body.
Source§

fn activate_with_energy(&mut self, energy: N)

Force the activation of this body with the given level of energy.
Source§

fn deactivate(&mut self)

Put this body to sleep.
Source§

fn num_parts(&self) -> usize

The number of parts of this body.
Source§

fn part(&self, id: usize) -> Option<&(dyn BodyPart<N> + 'static)>

A reference to the specified body part.
Source§

fn deformed_positions(&self) -> Option<(DeformationsType, &[N])>

If this is a deformable body, returns its deformed positions.
Source§

fn deformed_positions_mut(&mut self) -> Option<(DeformationsType, &mut [N])>

If this is a deformable body, returns a mutable reference to its deformed positions.
Source§

fn world_point_at_material_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> OPoint<N, Const<2>>

Transform the given point expressed in material coordinates to world-space.
Source§

fn position_at_material_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> Isometry<N, Unit<Complex<N>>, 2>

Transform the given point expressed in material coordinates to world-space.
Source§

fn material_point_at_world_point( &self, part: &(dyn BodyPart<N> + 'static), point: &OPoint<N, Const<2>>, ) -> OPoint<N, Const<2>>

Transform the given point expressed in material coordinates to world-space.
Source§

fn fill_constraint_geometry( &self, part: &(dyn BodyPart<N> + 'static), _: usize, center: &OPoint<N, Const<2>>, force_dir: &ForceDirection<N>, j_id: usize, wj_id: usize, jacobians: &mut [N], inv_r: &mut N, ext_vels: Option<&Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>>, out_vel: Option<&mut N>, )

Fills all the jacobians (and the jacobians multiplied by the inverse augmented mass matrix) for a constraint applying a force at the point center (relative to the body part’s center of mass) and the direction dir. Read more
Source§

fn has_active_internal_constraints(&mut self) -> bool

Returns true if this bodies contains internal constraints that need to be solved.
Source§

fn setup_internal_velocity_constraints( &mut self, _: &Matrix<N, Dynamic, Const<1>, SliceStorage<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, _: &IntegrationParameters<N>, )

Initializes the internal velocity constraints of a body.
Source§

fn warmstart_internal_velocity_constraints( &mut self, dvels: &mut Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, )

For warmstarting the solver, modifies the delta velocity applied by the internal constraints of this body.
Source§

fn step_solve_internal_velocity_constraints( &mut self, dvels: &mut Matrix<N, Dynamic, Const<1>, SliceStorageMut<'_, N, Dynamic, Const<1>, Const<1>, Dynamic>>, )

Execute one step for the iterative resolution of this body’s internal velocity constraints.
Source§

fn step_solve_internal_position_constraints( &mut self, parameters: &IntegrationParameters<N>, )

Execute one step for the iterative resolution of this body’s internal position constraints.
Source§

fn velocity_at_point( &self, part_id: usize, point: &OPoint<N, Const<2>>, ) -> Velocity2<N>

Gets the velocity of the given point of this body.
Source§

fn apply_force_at_local_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at a given local point of a part of this body.
Source§

fn apply_force( &mut self, part_id: usize, force: &Force2<N>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at the center of mass of a part of this body.
Source§

fn apply_local_force( &mut self, part_id: usize, force: &Force2<N>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at the center of mass of a part of this body.
Source§

fn apply_force_at_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a force at a given point of a part of this body.
Source§

fn apply_local_force_at_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at a given point of a part of this body.
Source§

fn apply_local_force_at_local_point( &mut self, part_id: usize, force: &Matrix<N, Const<nalgebra::::base::dimension::U2::{constant#0}>, Const<1>, ArrayStorage<N, 2, 1>>, point: &OPoint<N, Const<2>>, force_type: ForceType, auto_wake_up: bool, )

Apply a local force at a given local point of a part of this body.
Source§

fn is_ground(&self) -> bool

Returns true if this body is the ground.
Source§

fn update_activation_status(&mut self)

Update whether this body needs to be waken up after a user-interaction.
Source§

fn advance(&mut self, _time_ratio: N)

Source§

fn validate_advancement(&mut self)

Source§

fn clamp_advancement(&mut self)

Source§

fn part_motion( &self, _part_id: usize, _time_origin: N, ) -> Option<BodyPartMotion<N>>

Source§

fn step_started(&mut self)

Source§

fn add_local_inertia_and_com( &mut self, _part_index: usize, _com: OPoint<N, Const<2>>, _inertia: Inertia2<N>, )

Add the given inertia to the local inertia of this body part.
Source§

fn status_dependent_ndofs(&self) -> usize

The number of degrees of freedom (DOF) of this body, taking its status into account. Read more
Source§

fn status_dependent_body_part_velocity( &self, part: &(dyn BodyPart<N> + 'static), ) -> Velocity2<N>

The velocity of the specified body part, taking this body status into account. Read more
Source§

fn is_active(&self) -> bool

Check if this body is active.
Source§

fn is_dynamic(&self) -> bool

Whether or not the status of this body is dynamic.
Source§

fn is_kinematic(&self) -> bool

Whether or not the status of this body is kinematic.
Source§

fn is_static(&self) -> bool

Whether or not the status of this body is static.
Source§

fn activate(&mut self)

Force the activation of this body.

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 + Send + Sync>

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> Finalize for T

Source§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Component for T
where T: Send + Sync + 'static,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,