example::xpbd::constraint

Trait Constraint

Source
pub trait Constraint: Debug {
    // Required methods
    fn apply(&mut self, step: &mut Step);
    fn priority(&self) -> isize;
    fn body_idxs(&self) -> Vec<usize>;
    fn init(&mut self, get_or_insert: impl FnMut(RigidBodyHandle) -> usize);
}

Required Methods§

Source

fn apply(&mut self, step: &mut Step)

Apply this constraint, mutating bodies’ next positions.

Source

fn priority(&self) -> isize

Lower values indicate higher priority (0 being highest)

Source

fn body_idxs(&self) -> Vec<usize>

Indexes in the body buffer that this constraint will mutate. This is used to group mutually exclusive constraints to be evaluated in parallel.

Source

fn init(&mut self, get_or_insert: impl FnMut(RigidBodyHandle) -> usize)

Initialize the constraint with the ability to map rigid body handles to indices in the bodies buffer passed to apply.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Constraint for Constraint

Source§

impl Constraint for Contact

Source§

impl Constraint for example::xpbd::constraint::impl_::distance::Packed

Source§

impl Constraint for example::xpbd::constraint::impl_::distance::Single

Source§

impl Constraint for example::xpbd::constraint::impl_::tetrahedron_volume::Packed

Source§

impl Constraint for example::xpbd::constraint::impl_::tetrahedron_volume::Single