pub struct PbdDistanceConstraint {
pub indices: [usize; 2],
pub rest_length: Real,
pub k: Real,
}Expand description
A simple PBD distance constraint between two particles.
Fields§
§indices: [usize; 2]Indices of the two particles.
rest_length: RealRest (target) distance.
k: RealStiffness in [0, 1].
Implementations§
Trait Implementations§
Source§impl PbdConstraint for PbdDistanceConstraint
impl PbdConstraint for PbdDistanceConstraint
Source§fn evaluate(&self, positions: &[[Real; 3]]) -> Real
fn evaluate(&self, positions: &[[Real; 3]]) -> Real
Evaluate constraint C(p) — returns violation (0 = satisfied).
Source§fn gradient(&self, positions: &[[Real; 3]]) -> Vec<[Real; 3]>
fn gradient(&self, positions: &[[Real; 3]]) -> Vec<[Real; 3]>
Compute constraint gradient ∇C with respect to each particle position.
Source§fn particle_indices(&self) -> &[usize]
fn particle_indices(&self) -> &[usize]
Particle indices involved in this constraint.
Auto Trait Implementations§
impl Freeze for PbdDistanceConstraint
impl RefUnwindSafe for PbdDistanceConstraint
impl Send for PbdDistanceConstraint
impl Sync for PbdDistanceConstraint
impl Unpin for PbdDistanceConstraint
impl UnsafeUnpin for PbdDistanceConstraint
impl UnwindSafe for PbdDistanceConstraint
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
Mutably borrows from an owned value. Read more
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.