Skip to main content

SoftBodyMaterial

Struct SoftBodyMaterial 

Source
pub struct SoftBodyMaterial {
Show 21 fields pub edge_softness: SpringCoefficients<f32>, pub bend_softness: SpringCoefficients<f32>, pub volume_softness: SpringCoefficients<f32>, pub shape_matching_softness: SpringCoefficients<f32>, pub young_modulus: f32, pub poisson_ratio: f32, pub elastic_damping_ratio: f32, pub plastic_yield: f32, pub plastic_creep: f32, pub plastic_max: f32, pub deformation_damping: f32, pub edge_plastic_yield: f32, pub edge_plastic_creep: f32, pub edge_plastic_max: f32, pub edge_plastic_flow: SoftEdgePlasticFlow, pub tear_strain: Option<f32>, pub tear_force: Option<f32>, pub tear_smoothing: f32, pub interior_strength: f32, pub max_tears_per_step: u32, pub min_piece: Option<u32>,
}
Expand description

The stiffness and damping of every soft-body constraint family: a natural_frequency (Hz) and damping_ratio per family, normalized by the constraint’s effective mass (independent of mass, substeps and timestep); a frequency far above the substep rate saturates instead of exploding.

Fields§

§edge_softness: SpringCoefficients<f32>

Softness of the structural edges.

§bend_softness: SpringCoefficients<f32>

Softness of the bending edges and dihedral constraints.

§volume_softness: SpringCoefficients<f32>

Softness of the per-cell volume constraints (crate::dynamics::SoftBodyCellModel::Volume) and of the global volume-preservation constraint.

§shape_matching_softness: SpringCoefficients<f32>

Softness of the shape-matching constraints.

§young_modulus: f32

Young’s modulus of the elastic cells (crate::dynamics::SoftBodyCellModel::Corotational and crate::dynamics::SoftBodyCellModel::NeoHookean), in force per unit area (3D) or length (2D); their natural frequency derives from it, so a finer mesh does not get stiffer.

§poisson_ratio: f32

Poisson’s ratio of the elastic cells, in [0, 0.5).

§elastic_damping_ratio: f32

Damping ratio of the elastic cells.

§plastic_yield: f32

Plastic yield of the elastic cells: the strain (Frobenius norm of the deviatoric part of sym(RᵀF) - I, read from stress by the constraint solver) beyond which a cell’s rest shape flows toward its current shape (default: 0.0, no plasticity).

§plastic_creep: f32

Rate (per second) at which the strain in excess of the yield is absorbed into the rest shape (default: 1.0); the flow is deviatoric (volume preserving).

§plastic_max: f32

Largest accumulated plastic deformation of a cell, the Frobenius norm of P - I with P its rest shape’s plastic stretch (default: 1.0). Flow past it is projected back onto the bound, so a crushed cell cannot flow toward a sliver; an inverted cell never flows.

§deformation_damping: f32

Rate (per second) at which the particles’ velocities are pulled toward the body’s best-fit rigid motion, damping every deformation mode but not the whole-body motion; a few units per second settle a stiff slender body’s residual bending sway (default: 0.0, off).

§edge_plastic_yield: f32

Plastic yield of the edges (structural and bending): the strain |length / rest_length - 1| beyond which the rest length flows toward the current length (default: 0.0, none), at the rate Self::edge_plastic_creep, up to edge_plastic_max; tears use the initial length.

§edge_plastic_creep: f32

Rate (per second) at which an edge’s strain in excess of its yield is absorbed into its rest length (default: 1.0); Real::INFINITY (or anything above the step rate) sets it at once.

§edge_plastic_max: f32

Largest permanent set an edge may accumulate, as a fraction of its initial length (default: 0.5); past it the edge stops yielding and stays elastic, so a crushed edge cannot flow to nothing.

§edge_plastic_flow: SoftEdgePlasticFlow

Whether the edges take a permanent set under a squeeze, a stretch, or both (default: both).

§tear_strain: Option<f32>

Strain beyond which elements break (default: None, unbreakable): an edge stretched past this fraction of its initial rest length, or a corotational cell whose largest tensile principal strain (capped at 1.0) exceeds it, tears at step end; volume cells never do.

§tear_force: Option<f32>

Force beyond which the edges break (default: None): an edge whose force along its direction (its impulse over the substep, positive when resisting stretching) exceeds it is torn at the end of the step. Either criterion tears an edge; cells tear on strain only.

§tear_smoothing: f32

Time constant, in seconds, over which an element’s load is smoothed exponentially before the tear test (default: 0.0, one step past the threshold tears); applies to the strain and force criteria alike, and crate::dynamics::SoftBodyEdge::stress reads the smoothed load.

§interior_strength: f32

How much tougher an undamaged interior element (no particle on the surface or on an earlier tear) is than a surface one (default: 1.0): it needs this many times its tear threshold, so tears start at the surface or existing damage and run inward; scales tear_resistance.

§max_tears_per_step: u32

Maximum number of edges torn per step (default: u32::MAX, no limit): the most loaded go first, the others wait for the next step (edges past twice their threshold always tear). Bounding it paces the cracks of a taut sheet but lets a projectile be caught as in a net.

§min_piece: Option<u32>

The smallest piece, in measure elements, a tear may split off (default: None: ten triangles for a 3D cloth, three cells in 2D or six in 3D, three segments for a rope). A tear leaving a smaller piece waits (cuts are exempt); Some(1) lets a tear shed single elements.

Implementations§

Source§

impl SoftBodyMaterial

Source

pub fn uniform(softness: SpringCoefficients<f32>) -> Self

A material with the same softness for every spring family (edges, bending, volume, shape matching); the elastic-cell parameters keep their defaults.

Source

pub fn tears(&self) -> bool

Whether some tear criterion is set (tear_strain or tear_force).

Source

pub fn lame_parameters(&self) -> (f32, f32)

The Lamé parameters (μ, λ) of the elastic cells.

Trait Implementations§

Source§

impl Clone for SoftBodyMaterial

Source§

fn clone(&self) -> SoftBodyMaterial

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for SoftBodyMaterial

Source§

impl Debug for SoftBodyMaterial

Source§

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

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

impl Default for SoftBodyMaterial

Source§

fn default() -> Self

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

impl PartialEq for SoftBodyMaterial

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SoftBodyMaterial

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

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

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

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

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

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

Converts &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> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

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

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be 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, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

Source§

const WITNESS: W = W::MAKE

A constant of the type witness
Source§

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

Source§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
Source§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
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> MaybeSync for T
where T: Sync + ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

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,

Source§

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

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.