parry3d/query/distance/
distance.rs

1use crate::math::{Isometry, Real};
2
3use crate::query::{DefaultQueryDispatcher, QueryDispatcher, Unsupported};
4use crate::shape::Shape;
5
6/// Computes the minimum distance separating two shapes.
7///
8/// Returns `0.0` if the objects are touching or penetrating.
9pub fn distance(
10    pos1: &Isometry<Real>,
11    g1: &dyn Shape,
12    pos2: &Isometry<Real>,
13    g2: &dyn Shape,
14) -> Result<Real, Unsupported> {
15    let pos12 = pos1.inv_mul(pos2);
16    DefaultQueryDispatcher.distance(&pos12, g1, g2)
17}