pub trait PbdConstraint {
// Required methods
fn evaluate(&self, positions: &[[Real; 3]]) -> Real;
fn gradient(&self, positions: &[[Real; 3]]) -> Vec<[Real; 3]>;
fn particle_indices(&self) -> &[usize];
// Provided method
fn stiffness(&self) -> Real { ... }
}Expand description
Trait for PBD position constraints.
Required Methods§
Sourcefn evaluate(&self, positions: &[[Real; 3]]) -> Real
fn evaluate(&self, positions: &[[Real; 3]]) -> Real
Evaluate constraint C(p) — returns violation (0 = satisfied).
Sourcefn 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.
Sourcefn particle_indices(&self) -> &[usize]
fn particle_indices(&self) -> &[usize]
Particle indices involved in this constraint.