pub struct PressureModifier {
pub config: PressureConfig,
pub pressure: ScalarField3D,
pub deformation: ScalarField3D,
pub enabled: bool,
}Expand description
Pressure-driven SDF deformation
Fields§
§config: PressureConfigConfiguration
pressure: ScalarField3DCurrent pressure field (transient)
deformation: ScalarField3DAccumulated permanent deformation (positive = surface pushed inward)
enabled: boolWhether modifier is enabled
Implementations§
Source§impl PressureModifier
impl PressureModifier
Sourcepub fn new(
config: PressureConfig,
resolution: usize,
min: (f32, f32, f32),
max: (f32, f32, f32),
) -> Self
pub fn new( config: PressureConfig, resolution: usize, min: (f32, f32, f32), max: (f32, f32, f32), ) -> Self
Create a new pressure modifier
resolution is clamped to a minimum of 1: ScalarField3D computes
its cell size from resolution - 1 and clamps grid reads to
resolution - 1, both of which underflow usize for a resolution
of 0. Clamping here keeps that invariant instead of deferring a
panic to the first call to Self::pressure_at /
Self::deformation_at.
Sourcepub fn apply_pressure_at(
&mut self,
x: f32,
y: f32,
z: f32,
force: f32,
radius: f32,
)
pub fn apply_pressure_at( &mut self, x: f32, y: f32, z: f32, force: f32, radius: f32, )
Apply pressure at a point (e.g., from collision contact)
force = contact force magnitude, radius = contact patch radius
Source§impl PressureModifier
impl PressureModifier
Sourcepub const PARTICIPANT_KIND: ParticipantKind
pub const PARTICIPANT_KIND: ParticipantKind
Snapshot tag of this type as a world participant: "PRES", the four
ASCII bytes read big endian. Never changes.
Trait Implementations§
Source§impl Participant for PressureModifier
One update(h) per world substep (h converted with
Fix128::to_f32); see the module documentation of
crate::sim_modifier for the payload and what is not coupled yet.
impl Participant for PressureModifier
One update(h) per world substep (h converted with
Fix128::to_f32); see the module documentation of
crate::sim_modifier for the payload and what is not coupled yet.
Observations: channel 0 the highest cell pressure (absent for a grid without cells), channel 1 the total permanent deformation.
Source§fn kind(&self) -> ParticipantKind
fn kind(&self) -> ParticipantKind
Source§fn substep(
&mut self,
_ctx: &mut SubstepCtx<'_>,
h: Fix128,
) -> Result<(), ParticipantFault>
fn substep( &mut self, _ctx: &mut SubstepCtx<'_>, h: Fix128, ) -> Result<(), ParticipantFault>
h (ctx.h()). Read bodies
from ctx, stage forces on them through ctx. Read moreSource§fn observe(&self, out: &mut ObservationSink)
fn observe(&self, out: &mut ObservationSink)
Observed::Undecided while a fault is recorded.Source§fn write_state(&self, out: &mut Vec<u8>)
fn write_state(&self, out: &mut Vec<u8>)
out.Source§fn check_state(&self, bytes: &[u8]) -> Result<(), StateError>
fn check_state(&self, bytes: &[u8]) -> Result<(), StateError>
Source§fn read_state(&mut self, bytes: &[u8])
fn read_state(&mut self, bytes: &[u8])
bytes. Only called with a payload
Self::check_state accepted.Source§fn step_rule(&self) -> StepRule
fn step_rule(&self) -> StepRule
Source§fn ports(&self) -> &[Port]
fn ports(&self) -> &[Port]
execution_order); they must not change while the participant is
registered.Source§impl PhysicsModifier for PressureModifier
impl PhysicsModifier for PressureModifier
Auto Trait Implementations§
impl Freeze for PressureModifier
impl RefUnwindSafe for PressureModifier
impl Send for PressureModifier
impl Sync for PressureModifier
impl Unpin for PressureModifier
impl UnsafeUnpin for PressureModifier
impl UnwindSafe for PressureModifier
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> 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 more