Skip to main content

shape_distance

Function shape_distance 

Source
pub fn shape_distance(
    input: &DistanceInput,
    cache: &mut SimplexCache,
    simplexes: Option<&mut [Simplex]>,
) -> DistanceOutput
Expand description

Compute the closest points between two shapes represented as point clouds. The cache is input/output: on the first call set SimplexCache::count to zero. (b2ShapeDistance)

The underlying GJK algorithm may be debugged by passing in a simplex buffer; pass None normally. The C version only records intermediate simplexes in debug builds; this port records them whenever a buffer is provided.

Uses GJK for computing the distance between convex shapes. https://box2d.org/files/ErinCatto_GJK_GDC2010.pdf