parry3d/query/sat/
sat_support_map_support_map.rs

1use crate::math::{Isometry, Real, Vector};
2use crate::shape::SupportMap;
3use na::Unit;
4
5/// Computes the separation along the given direction,
6/// between two convex shapes implementing the `SupportMap` trait.
7#[allow(dead_code)]
8pub fn support_map_support_map_compute_separation(
9    sm1: &impl SupportMap,
10    sm2: &impl SupportMap,
11    pos12: &Isometry<Real>,
12    dir1: &Unit<Vector<Real>>,
13) -> Real {
14    let p1 = sm1.local_support_point_toward(dir1);
15    let p2 = sm2.support_point_toward(pos12, &-*dir1);
16    (p2 - p1).dot(dir1)
17}