1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![allow(missing_docs)]
use downcast_rs::Downcast;
use na::{DVector, RealField};
use crate::detection::ColliderContactManifold;
use crate::object::BodySet;
use crate::material::MaterialsCoefficientsTable;
use crate::solver::{ConstraintSet, IntegrationParameters};
pub trait ContactModel<N: RealField>: Downcast + Send + Sync {
fn num_velocity_constraints(&self, manifold: &ColliderContactManifold<N>) -> usize;
fn constraints(
&mut self,
params: &IntegrationParameters<N>,
material_coefficients: &MaterialsCoefficientsTable<N>,
bodies: &BodySet<N>,
ext_vels: &DVector<N>,
manifolds: &[ColliderContactManifold<N>],
ground_j_id: &mut usize,
j_id: &mut usize,
jacobians: &mut [N],
constraints: &mut ConstraintSet<N>,
);
fn cache_impulses(&mut self, constraints: &ConstraintSet<N>);
}
impl_downcast!(ContactModel<N> where N: RealField);