use alga::linear::Translation; use na; use shape::{self, AnnotatedPoint, SupportMap}; use query::algorithms::gjk; use query::algorithms::{Simplex, JohnsonSimplex, VoronoiSimplex2, VoronoiSimplex3}; use query::Proximity; use math::{Isometry, Point}; /// Proximity between support-mapped shapes (`Cuboid`, `ConvexHull`, etc.) pub fn support_map_against_support_map
( m1: &M, g1: &G1, m2: &M, g2: &G2, margin: P::Real, ) -> Proximity where P: Point, M: Isometry
, G1: SupportMap
, G2: SupportMap
,
{
if na::dimension:: (
m1: &M,
g1: &G1,
m2: &M,
g2: &G2,
margin: P::Real,
simplex: &mut S,
init_dir: Option ,
S: Simplex ,
G2: SupportMap ,
{
assert!(
margin >= na::zero(),
"The proximity margin must be positive or null."
);
let mut dir = match init_dir {
// FIXME: or m2.translation - m1.translation ?
None => m1.translation().to_vector() - m2.translation().to_vector(),
Some(dir) => dir,
};
if dir == na::zero() {
dir[0] = na::one();
}
simplex.reset(shape::cso_support_point(m1, g1, m2, g2, dir));
gjk::proximity(m1, g1, m2, g2, margin, simplex)
}