Externalize the proximity code (renamed intersection).

This commit is contained in:
Crozet Sébastien
2020-12-17 13:23:00 +01:00
parent e231bacec6
commit 29717c2887
22 changed files with 144 additions and 1051 deletions

View File

@@ -79,6 +79,19 @@ impl<T> InteractionGraph<T> {
self.graph.raw_edges().iter().map(move |edge| &edge.weight)
}
/// All the interactions on this graph with the corresponding endpoint weights.
pub fn interactions_with_endpoints(
&self,
) -> impl Iterator<Item = (ColliderHandle, ColliderHandle, &T)> {
self.graph.raw_edges().iter().map(move |edge| {
(
self.graph.raw_nodes()[edge.source().index()].weight,
self.graph.raw_nodes()[edge.target().index()].weight,
&edge.weight,
)
})
}
/// The interaction between the two collision objects identified by their graph index.
pub fn interaction_pair(
&self,