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: f32Young’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: f32Poisson’s ratio of the elastic cells, in [0, 0.5).
elastic_damping_ratio: f32Damping ratio of the elastic cells.
plastic_yield: f32Plastic 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: f32Rate (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: f32Largest 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: f32Rate (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: f32Plastic 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: f32Rate (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: f32Largest 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: SoftEdgePlasticFlowWhether 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: f32Time 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: f32How 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: u32Maximum 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
impl SoftBodyMaterial
Sourcepub fn uniform(softness: SpringCoefficients<f32>) -> Self
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.
Sourcepub fn lame_parameters(&self) -> (f32, f32)
pub fn lame_parameters(&self) -> (f32, f32)
The Lamé parameters (μ, λ) of the elastic cells.
Trait Implementations§
Source§impl Clone for SoftBodyMaterial
impl Clone for SoftBodyMaterial
Source§fn clone(&self) -> SoftBodyMaterial
fn clone(&self) -> SoftBodyMaterial
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SoftBodyMaterial
Source§impl Debug for SoftBodyMaterial
impl Debug for SoftBodyMaterial
Source§impl Default for SoftBodyMaterial
impl Default for SoftBodyMaterial
Source§impl PartialEq for SoftBodyMaterial
impl PartialEq for SoftBodyMaterial
impl StructuralPartialEq for SoftBodyMaterial
Auto Trait Implementations§
impl Freeze for SoftBodyMaterial
impl RefUnwindSafe for SoftBodyMaterial
impl Send for SoftBodyMaterial
impl Sync for SoftBodyMaterial
impl Unpin for SoftBodyMaterial
impl UnsafeUnpin for SoftBodyMaterial
impl UnwindSafe for SoftBodyMaterial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreimpl<T> MaybeSync for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.