use crate::math::{Isometry, Point, Real};
use crate::shape::{Ball, Shape};
#[inline]
pub fn distance_ball_convex_polyhedron(
pos12: &Isometry<Real>,
ball1: &Ball,
shape2: &(impl Shape + ?Sized),
) -> Real {
distance_convex_polyhedron_ball(&pos12.inverse(), shape2, ball1)
}
#[inline]
pub fn distance_convex_polyhedron_ball(
pos12: &Isometry<Real>,
shape1: &(impl Shape + ?Sized),
ball2: &Ball,
) -> Real {
let center2_1 = Point::from(pos12.translation.vector);
let proj = shape1.project_local_point(¢er2_1, true);
(na::distance(&proj.point, ¢er2_1) - ball2.radius).max(0.0)
}