UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GJK.h File Reference
#include "Chaos/Box.h"
#include "Chaos/Capsule.h"
#include "Chaos/EPA.h"
#include "Chaos/GJKShape.h"
#include "Chaos/ImplicitObjectScaled.h"
#include "Chaos/Simplex.h"
#include "Chaos/Sphere.h"
#include "Math/VectorRegister.h"
#include "Chaos/VectorUtility.h"
#include "Chaos/SimplexVectorized.h"
#include "Chaos/EPAVectorized.h"
#include "ChaosCheck.h"
#include "ChaosLog.h"

Go to the source code of this file.

Classes

struct  Chaos::FGeomGJKHelperSIMD
 
struct  Chaos::TGJKSupportHelperSIMD< T, TestSpace >
 
struct  Chaos::TGJKSupportHelperSIMD< T, EGJKTestSpace::SameSpace >
 
struct  Chaos::TSupportBAtOriginHelperSIMD< TestSpace >
 
struct  Chaos::TSupportBAtOriginHelperSIMD< EGJKTestSpace::SameSpace >
 
class  Chaos::TGJKSimplexData< T >
 Internal simplex data for GJK that can also be stored for warm-starting subsequent calls. More...
 
struct  Chaos::FGeomGJKHelper
 

Namespaces

namespace  Chaos
 

Macros

#define CHAOS_COLLISIONERROR_LOG_ENABLED   ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 0)
 
#define CHAOS_COLLISIONERROR_ENSURE_ENABLED   ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 1)
 
#define CHAOS_COLLISIONERROR_CLOG(Condition, Fmt, ...)
 
#define CHAOS_COLLISIONERROR_ENSURE(X)   ensure(X)
 

Typedefs

using Chaos::FGJKSimplexData = TGJKSimplexData< FReal >
 

Enumerations

enum  Chaos::EGJKTestSpace { Chaos::SameSpace , Chaos::ALocalSpace }
 
enum class  Chaos::EGJKDistanceResult { Chaos::Separated , Chaos::Contact , Chaos::DeepContact }
 

Functions

template<typename ConvexTypeA , typename ConvexTypeB >
bool Chaos::CheckGJKIterationLimit (const int32 NumIterations, const ConvexTypeA &A, const ConvexTypeB &B)
 
template<typename TGeometryA , typename TGeometryB , typename T >
void Chaos::CalculateQueryMargins (const TGeometryA &A, const TGeometryB &B, T &outMarginA, T &outMarginB)
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKIntersection (const TGeometryA &RESTRICT A, const TGeometryB &RESTRICT B, const TRigidTransform< T, 3 > &BToATM, const T InThicknessA=0, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0))
 
template<typename TGeometryA , typename TGeometryB >
bool Chaos::GJKIntersectionSimd (const TGeometryA &RESTRICT A, const TGeometryB &RESTRICT B, const VectorRegister4Float &Translation, const VectorRegister4Float &Rotation, FRealSingle InThicknessA, const VectorRegister4Float &InitialDir)
 
bool Chaos::GJKIntersectionSimd (const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, FRealSingle EpsilonScale, const VectorRegister4Float &Translation, const VectorRegister4Float &Rotation, FRealSingle InThicknessA, const VectorRegister4Float &InitialDir)
 
template<typename T >
bool Chaos::GJKIntersection (const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, FReal EpsilonScale, const TRigidTransform< T, 3 > &BToATM, const T InThicknessA=0, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0))
 
template<typename TGeometryA , typename TGeometryB >
bool Chaos::GJKIntersectionSameSpaceSimd (const TGeometryA &A, const TGeometryB &B, FRealSingle InThicknessA, const VectorRegister4Float &InitialDir)
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKPenetrationWarmStartable (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormalA, TVec3< T > &OutNormalB, int32 &OutVertexA, int32 &OutVertexB, TGJKSimplexData< T > &InOutSimplexData, T &OutMaxSupportDelta, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
 Calculate the penetration data for two shapes using GJK and a warm-start buffer.
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKPenetrationWarmStartable2 (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormalA, TVec3< T > &OutNormalB, int32 &OutVertexA, int32 &OutVertexB, TGJKSimplexData< T > &InOutSimplexData, T &OutMaxSupportDelta, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKPenetrationSameSpace (const TGeometryA &A, const TGeometryB &B, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutVertexA, int32 &OutVertexB, T &OutMaxSupportDelta, const TVec3< T > &InitialDir, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
 Calculate the penetration data for two shapes using GJK, assuming both shapes are already in the same space. This is intended for use with triangles which have been transformed into the space of the convex shape.
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKPenetrationSameSpace2 (const TGeometryA &A, const TGeometryB &B, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutVertexA, int32 &OutVertexB, T &OutMaxSupportDelta, const TVec3< T > &InitialDir, const T Epsilon=T(1.e-3), const T EPAEpsilon=T(1.e-2))
 
template<bool bNegativePenetrationAllowed = false, typename T >
bool Chaos::GJKPenetrationImpl (const FGeomGJKHelper &A, const FGeomGJKHelper &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutClosestVertexIndexA, int32 &OutClosestVertexIndexB, const T InThicknessA=0.0f, const T InThicknessB=0.0f, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T Epsilon=1.e-3f)
 
template<bool bNegativePenetrationAllowed = false, typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKPenetration (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM, T &OutPenetration, TVec3< T > &OutClosestA, TVec3< T > &OutClosestB, TVec3< T > &OutNormal, int32 &OutClosestVertexIndexA, int32 &OutClosestVertexIndexB, const T InThicknessA=0.0f, const T InThicknessB=0.0f, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T Epsilon=1.e-3f)
 
template<typename T , typename TGeometryA , typename TGeometryB >
bool Chaos::GJKRaycast (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &StartTM, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T ThicknessA=0, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T ThicknessB=0)
 
template<typename T , EGJKTestSpace TestSpace = EGJKTestSpace::ALocalSpace>
bool Chaos::GJKRaycast2ImplSimd (const FGeomGJKHelperSIMD &RESTRICT A, const FGeomGJKHelperSIMD &RESTRICT B, const T &BToARotation, const T &StartPoint, const T &RayDir, FRealSingle RayLength, FRealSingle &OutTime, T &OutPosition, T &OutNormal, bool bComputeMTD, const T &InitialDir)
 
bool Chaos::GJKRaycast2Impl (const FGeomGJKHelperSIMD &A, const FGeomGJKHelperSIMD &B, const TRigidTransform< FReal, 3 > &StartTM, const TVector< FReal, 3 > &RayDir, const FReal RayLength, FReal &OutTime, TVector< FReal, 3 > &OutPosition, TVector< FReal, 3 > &OutNormal, const FReal GivenThicknessA, bool bComputeMTD, const TVector< FReal, 3 > &InitialDir, const FReal GivenThicknessB)
 
template<typename T = FReal, typename TGeometryA , typename TGeometryB >
bool Chaos::GJKRaycast2 (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &StartTM, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T GivenThicknessA=0, bool bComputeMTD=false, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T GivenThicknessB=0)
 
bool Chaos::GJKRaycast2SameSpaceImpl (const FGeomGJKHelperSIMD &A, const FGeomGJKHelperSIMD &B, const TVector< FReal, 3 > &Start, const TVector< FReal, 3 > &RayDir, const FReal RayLength, FReal &OutTime, TVector< FReal, 3 > &OutPosition, TVector< FReal, 3 > &OutNormal, const FReal GivenThicknessA, bool bComputeMTD, const TVector< FReal, 3 > &InitialDir, const FReal GivenThicknessB)
 
template<typename T = FReal, typename TGeometryA , typename TGeometryB >
bool Chaos::GJKRaycast2SameSpace (const TGeometryA &A, const TGeometryB &B, const TVector< T, 3 > &Start, const TVector< T, 3 > &RayDir, const T RayLength, T &OutTime, TVector< T, 3 > &OutPosition, TVector< T, 3 > &OutNormal, const T GivenThicknessA=0, bool bComputeMTD=false, const TVector< T, 3 > &InitialDir=TVector< T, 3 >(1, 0, 0), const T GivenThicknessB=0)
 
template<typename T , typename TGeometryA , typename TGeometryB >
TVector< T, 3 > Chaos::GJKDistanceInitialV (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM)
 
template<typename T , typename TGeometryA , typename TGeometryB >
TVector< T, 3 > Chaos::GJKDistanceInitialVFromRelativeTransform (const TGeometryA &A, const TGeometryB &B, const TRigidTransform< T, 3 > &BToATM)
 
template<typename T , typename TGeometryA , typename TGeometryB >
TVec3< T > Chaos::GJKDistanceInitialVFromDirection (const TGeometryA &A, const TGeometryB &B, TVec3< T > Direction)
 
template<typename T , typename GJKShapeTypeA , typename GJKShapeTypeB >
EGJKDistanceResult Chaos::GJKDistance (const GJKShapeTypeA &A, const GJKShapeTypeB &B, const TVec3< T > &InitialV, T &OutDistance, TVec3< T > &OutNearestA, TVec3< T > &OutNearestB, TVec3< T > &OutNormalA, const T Epsilon=(T) 1e-3, const int32 MaxIts=16)
 

Macro Definition Documentation

◆ CHAOS_COLLISIONERROR_CLOG

#define CHAOS_COLLISIONERROR_CLOG (   Condition,
  Fmt,
  ... 
)

◆ CHAOS_COLLISIONERROR_ENSURE

#define CHAOS_COLLISIONERROR_ENSURE (   X)    ensure(X)

◆ CHAOS_COLLISIONERROR_ENSURE_ENABLED

#define CHAOS_COLLISIONERROR_ENSURE_ENABLED   ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 1)

◆ CHAOS_COLLISIONERROR_LOG_ENABLED

#define CHAOS_COLLISIONERROR_LOG_ENABLED   ((!UE_BUILD_TEST && !UE_BUILD_SHIPPING) && 0)