Skip to main content

PbdConstraint

Trait PbdConstraint 

Source
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§

Source

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

Compute constraint gradient ∇C with respect to each particle position.

Source

fn particle_indices(&self) -> &[usize]

Particle indices involved in this constraint.

Provided Methods§

Source

fn stiffness(&self) -> Real

Stiffness in range [0, 1] (1 = fully rigid, 0 = no correction).

Implementors§