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.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback