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
34
35
36
37
38
39
40
41
42
use std::any::Any;
use na::Real;
use utils::IdAllocator;
use shape::Shape;
use query::{ContactManifold, ContactPrediction};
use math::Isometry;
pub trait ContactManifoldGenerator<N: Real>: Any + Send + Sync {
fn update(
&mut self,
dispatcher: &ContactDispatcher<N>,
ida: usize,
ma: &Isometry<N>,
a: &Shape<N>,
idb: usize,
mb: &Isometry<N>,
b: &Shape<N>,
prediction: &ContactPrediction<N>,
id_alloc: &mut IdAllocator,
) -> bool;
fn num_contacts(&self) -> usize;
fn contacts<'a: 'b, 'b>(&'a self, out: &'b mut Vec<&'a ContactManifold<N>>);
}
pub type ContactAlgorithm<N> = Box<ContactManifoldGenerator<N>>;
pub trait ContactDispatcher<N>: Any + Send + Sync {
fn get_contact_algorithm(
&self,
a: &Shape<N>,
b: &Shape<N>,
) -> Option<ContactAlgorithm<N>>;
}