Chaos::GJKDistance

Find the distance and nearest points on two convex geometries A and B.

Windows
MacOS
Linux

References

Module

Chaos

Header

/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/GJK.h

Include

#include "Chaos/GJK.h"

Syntax

namespace Chaos
{
    template<typename T, typename TGeometryA, typename TGeometryB>
    bool Chaos::GJKDistance
    (
        const TGeometryA & A,
        const TGeometryB & B,
        const TRigidTransform< T, 3 > & BToATM,
        T & OutDistance,
        TVector< T, 3 > & OutNearestA,
        TVector< T, 3 > & OutNearestB,
        const T Epsilon,
        const int32 MaxIts
    )
}

Remarks

Find the distance and nearest points on two convex geometries A and B. All calculations are performed in the local-space of object A, and the transform from B-space to A-space must be provided. For algorithm see "A Fast and Robust GJK Implementation for Collision Detection of Convex Objects", Gino Van Deb Bergen, 1999.

This algorithm aborts if objects are overlapping and it does not initialize the out parameters.

Returns

true if we succeeded in calculating the distance, false otherwise (i.e., false if objects are overlapping).

Parameters

Parameter

Description

A

The first object.

B

The second object.

BToATM

A transform taking vectors in B-space to A-space

B

The second object.

OutDistance

if returns true, the minimum distance between A and B, otherwise not modified.

OutNearestA

if returns true, the near point on A in local-space, otherwise not modified.

OutNearestB

if returns true, the near point on B in local-space, otherwise not modified.

Epsilon

The algorithm terminates when the iterative distance reduction gets below this threshold.

MaxIts

A limit on the number of iterations. Results may be approximate if this is too low.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss